mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 19:51:51 +00:00
Move zend_try block into v8::Unlocker block
If the v8::Unlocker block is within the zend_try block, then v8::~Unlocker (dtor) is not called and hence V8 doesn't re-aquire the lock. Besides before we re-entered the isolate within zend_try and hence *before* taking the lock.
This commit is contained in:
parent
362eb0b806
commit
2d9c831eeb
@ -354,27 +354,29 @@ V8JS_METHOD(require)
|
|||||||
int call_result;
|
int call_result;
|
||||||
zval params[1];
|
zval params[1];
|
||||||
|
|
||||||
zend_try {
|
{
|
||||||
{
|
isolate->Exit();
|
||||||
isolate->Exit();
|
v8::Unlocker unlocker(isolate);
|
||||||
v8::Unlocker unlocker(isolate);
|
|
||||||
|
|
||||||
|
zend_try {
|
||||||
ZVAL_STRING(¶ms[0], normalised_module_id);
|
ZVAL_STRING(¶ms[0], normalised_module_id);
|
||||||
call_result = call_user_function_ex(EG(function_table), NULL, &c->module_loader, &module_code, 1, params, 0, NULL TSRMLS_CC);
|
call_result = call_user_function_ex(EG(function_table), NULL, &c->module_loader, &module_code, 1, params, 0, NULL TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
zend_catch {
|
||||||
isolate->Enter();
|
v8js_terminate_execution(isolate);
|
||||||
|
V8JSG(fatal_error_abort) = 1;
|
||||||
if (call_result == FAILURE) {
|
|
||||||
info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Module loader callback failed")));
|
|
||||||
}
|
}
|
||||||
|
zend_end_try();
|
||||||
}
|
}
|
||||||
zend_catch {
|
|
||||||
v8js_terminate_execution(isolate);
|
isolate->Enter();
|
||||||
V8JSG(fatal_error_abort) = 1;
|
|
||||||
|
if (V8JSG(fatal_error_abort)) {
|
||||||
call_result = FAILURE;
|
call_result = FAILURE;
|
||||||
}
|
}
|
||||||
zend_end_try();
|
else if (call_result == FAILURE) {
|
||||||
|
info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Module loader callback failed")));
|
||||||
|
}
|
||||||
|
|
||||||
zval_dtor(¶ms[0]);
|
zval_dtor(¶ms[0]);
|
||||||
|
|
||||||
|
@ -114,11 +114,11 @@ static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, v
|
|||||||
fci.no_separation = 1;
|
fci.no_separation = 1;
|
||||||
info.GetReturnValue().Set(V8JS_NULL);
|
info.GetReturnValue().Set(V8JS_NULL);
|
||||||
|
|
||||||
zend_try {
|
{
|
||||||
{
|
isolate->Exit();
|
||||||
isolate->Exit();
|
v8::Unlocker unlocker(isolate);
|
||||||
v8::Unlocker unlocker(isolate);
|
|
||||||
|
|
||||||
|
zend_try {
|
||||||
/* zend_fcall_info_cache */
|
/* zend_fcall_info_cache */
|
||||||
fcc.initialized = 1;
|
fcc.initialized = 1;
|
||||||
fcc.function_handler = method_ptr;
|
fcc.function_handler = method_ptr;
|
||||||
@ -128,14 +128,13 @@ static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, v
|
|||||||
|
|
||||||
zend_call_function(&fci, &fcc TSRMLS_CC);
|
zend_call_function(&fci, &fcc TSRMLS_CC);
|
||||||
}
|
}
|
||||||
|
zend_catch {
|
||||||
isolate->Enter();
|
v8js_terminate_execution(isolate);
|
||||||
|
V8JSG(fatal_error_abort) = 1;
|
||||||
|
}
|
||||||
|
zend_end_try();
|
||||||
}
|
}
|
||||||
zend_catch {
|
isolate->Enter();
|
||||||
v8js_terminate_execution(isolate);
|
|
||||||
V8JSG(fatal_error_abort) = 1;
|
|
||||||
}
|
|
||||||
zend_end_try();
|
|
||||||
|
|
||||||
failure:
|
failure:
|
||||||
/* Cleanup */
|
/* Cleanup */
|
||||||
|
Loading…
Reference in New Issue
Block a user