diff --git a/config.m4 b/config.m4 index 221a9e4..228c9a4 100644 --- a/config.m4 +++ b/config.m4 @@ -48,7 +48,7 @@ if test "$PHP_V8JS" != "no"; then CPPFLAGS=$old_CPPFLAGS ]); - AC_CACHE_CHECK(how to allow c++11 narrowing, ac_cv_v8_narrowing, [ + AC_CACHE_CHECK(how to allow c++14 narrowing, ac_cv_v8_narrowing, [ ac_cv_v8_narrowing="" old_CXXFLAGS=$CXXFLAGS AC_LANG_PUSH([C++]) @@ -58,12 +58,12 @@ if test "$PHP_V8JS" != "no"; then (void) foo; return 0; }]])],[ac_cv_v8_narrowing=""],[ - CXXFLAGS="-Wno-c++11-narrowing -std="$ac_cv_v8_cstd + CXXFLAGS="-Wno-c++14-narrowing -std="$ac_cv_v8_cstd AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { struct { unsigned int x; } foo = {-1}; (void) foo; return 0; - }]])],[ac_cv_v8_narrowing="-Wno-c++11-narrowing"],[ + }]])],[ac_cv_v8_narrowing="-Wno-c++14-narrowing"],[ CXXFLAGS="-Wno-narrowing -std="$ac_cv_v8_cstd AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { struct { unsigned int x; } foo = {-1}; diff --git a/v8js_array_access.cc b/v8js_array_access.cc index e1d410e..7c5218a 100644 --- a/v8js_array_access.cc +++ b/v8js_array_access.cc @@ -210,11 +210,11 @@ void v8js_array_access_enumerator(const v8::PropertyCallbackInfo& inf for(int j = 0; j < length; j ++) { if(v8js_array_access_isset_p(object, j)) { - result->Set(isolate->GetEnteredContext(), i ++, V8JS_INT(j)); + result->Set(isolate->GetEnteredOrMicrotaskContext(), i ++, V8JS_INT(j)); } } - result->Set(isolate->GetEnteredContext(), V8JS_SYM("length"), V8JS_INT(i)); + result->Set(isolate->GetEnteredOrMicrotaskContext(), V8JS_SYM("length"), V8JS_INT(i)); info.GetReturnValue().Set(result); } /* }}} */ @@ -245,12 +245,12 @@ void v8js_array_access_named_getter(v8::Local property_name, const v8: } v8::Local prototype_object; - if(!prototype->ToObject(isolate->GetEnteredContext()).ToLocal(&prototype_object)) { + if(!prototype->ToObject(isolate->GetEnteredOrMicrotaskContext()).ToLocal(&prototype_object)) { /* ehh? Array.prototype not an object? strange, stop. */ info.GetReturnValue().Set(ret_value); } - prototype_object->Get(isolate->GetEnteredContext(), property).ToLocal(&ret_value); + prototype_object->Get(isolate->GetEnteredOrMicrotaskContext(), property).ToLocal(&ret_value); } info.GetReturnValue().Set(ret_value); diff --git a/v8js_convert.cc b/v8js_convert.cc index c3d877a..8dc07f4 100644 --- a/v8js_convert.cc +++ b/v8js_convert.cc @@ -79,7 +79,7 @@ static v8::Local v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate return V8JS_NULL; } - v8::Local v8_context = isolate->GetEnteredContext(); + v8::Local v8_context = isolate->GetEnteredOrMicrotaskContext(); newarr = v8::Array::New(isolate, i); if (i > 0) @@ -149,7 +149,7 @@ v8::Local zval_to_v8js(zval *value, v8::Isolate *isolate) /* {{{ */ if (instanceof_function(Z_OBJCE_P(value), ce)) { zval dtval; zend_call_method_with_0_params(value, NULL, NULL, "getTimestamp", &dtval); - v8::Date::New(isolate->GetEnteredContext(), ((double)Z_LVAL(dtval) * 1000.0)).ToLocal(&jsValue); + v8::Date::New(isolate->GetEnteredOrMicrotaskContext(), ((double)Z_LVAL(dtval) * 1000.0)).ToLocal(&jsValue); zval_dtor(&dtval); } else jsValue = v8js_hash_to_jsobj(value, isolate); diff --git a/v8js_methods.cc b/v8js_methods.cc index 63f5fec..7f7f926 100644 --- a/v8js_methods.cc +++ b/v8js_methods.cc @@ -488,7 +488,7 @@ V8JS_METHOD(require) } if(Z_TYPE(module_code) == IS_OBJECT) { - v8::Local newobj = zval_to_v8js(&module_code, isolate)->ToObject(isolate->GetEnteredContext()).ToLocalChecked(); + v8::Local newobj = zval_to_v8js(&module_code, isolate)->ToObject(isolate->GetEnteredOrMicrotaskContext()).ToLocalChecked(); c->modules_loaded[normalised_module_id].Reset(isolate, newobj); info.GetReturnValue().Set(newobj); diff --git a/v8js_object_export.cc b/v8js_object_export.cc index fa483b5..b36a347 100644 --- a/v8js_object_export.cc +++ b/v8js_object_export.cc @@ -38,7 +38,7 @@ static void v8js_weak_object_callback(const v8::WeakCallbackInfo &d static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, const v8::FunctionCallbackInfo& info) /* {{{ */ { v8::Isolate *isolate = info.GetIsolate(); - v8::Local v8_context = isolate->GetEnteredContext(); + v8::Local v8_context = isolate->GetEnteredOrMicrotaskContext(); v8::Local return_value = V8JS_NULL; zend_fcall_info fci; zend_fcall_info_cache fcc; @@ -231,8 +231,8 @@ static void v8js_construct_callback(const v8::FunctionCallbackInfo& i v8::Local cons_data = v8::Local::Cast(info.Data()); v8::Local cons_tmpl, cons_ce; - if (!cons_data->Get(isolate->GetEnteredContext(), 0).ToLocal(&cons_tmpl) - ||!cons_data->Get(isolate->GetEnteredContext(), 1).ToLocal(&cons_ce)) + if (!cons_data->Get(isolate->GetEnteredOrMicrotaskContext(), 0).ToLocal(&cons_tmpl) + ||!cons_data->Get(isolate->GetEnteredOrMicrotaskContext(), 1).ToLocal(&cons_ce)) { return; } @@ -328,14 +328,14 @@ static void v8js_weak_closure_callback(const v8::WeakCallbackInfoGetFunction(isolate->GetEnteredContext()).ToLocalChecked()) + (v8::FunctionTemplate::New((isolate), v8js_php_callback, v8::External::New((isolate), mptr), v8::Signature::New((isolate), tmpl))->GetFunction(isolate->GetEnteredOrMicrotaskContext()).ToLocalChecked()) static void v8js_named_property_enumerator(const v8::PropertyCallbackInfo &info) /* {{{ */ { // note: 'special' properties like 'constructor' are not enumerated. v8::Isolate *isolate = info.GetIsolate(); - v8::Local v8_context = isolate->GetEnteredContext(); + v8::Local v8_context = isolate->GetEnteredOrMicrotaskContext(); v8::Local self = info.Holder(); v8::Local result = v8::Array::New(isolate, 0); @@ -435,7 +435,7 @@ static void v8js_named_property_enumerator(const v8::PropertyCallbackInfo& info) /* {{{ */ { v8::Isolate *isolate = info.GetIsolate(); - v8::Local v8_context = isolate->GetEnteredContext(); + v8::Local v8_context = isolate->GetEnteredOrMicrotaskContext(); v8::Local self = info.Holder(); v8::Local cb = v8::Local::Cast(info.Data()); @@ -480,7 +480,7 @@ static void v8js_invoke_callback(const v8::FunctionCallbackInfo& info static void v8js_fake_call_impl(const v8::FunctionCallbackInfo& info) /* {{{ */ { v8::Isolate *isolate = info.GetIsolate(); - v8::Local v8_context = isolate->GetEnteredContext(); + v8::Local v8_context = isolate->GetEnteredOrMicrotaskContext(); v8::Local self = info.Holder(); v8::Local return_value = V8JS_NULL; @@ -623,7 +623,7 @@ v8::Local v8js_named_property_callback(v8::Local property_n v8::Local property = v8::Local::Cast(property_name); v8::Isolate *isolate = info.GetIsolate(); - v8::Local v8_context = isolate->GetEnteredContext(); + v8::Local v8_context = isolate->GetEnteredOrMicrotaskContext(); v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0); v8::String::Utf8Value cstr(isolate, property); const char *name = ToCString(cstr); @@ -848,7 +848,7 @@ static void v8js_named_property_query(v8::Local property, const v8::Pr } v8::Isolate *isolate = info.GetIsolate(); - v8::MaybeLocal value = r->ToInteger(isolate->GetEnteredContext()); + v8::MaybeLocal value = r->ToInteger(isolate->GetEnteredOrMicrotaskContext()); if (!value.IsEmpty()) { info.GetReturnValue().Set(value.ToLocalChecked()); } diff --git a/v8js_v8.cc b/v8js_v8.cc index 0730866..0b5eab1 100644 --- a/v8js_v8.cc +++ b/v8js_v8.cc @@ -304,7 +304,7 @@ int v8js_get_properties_hash(v8::Local jsValue, HashTable *retval, in } /* Skip any prototype properties */ - if (!jsObj->HasOwnProperty(isolate->GetEnteredContext(), jsKey).FromMaybe(false) + if (!jsObj->HasOwnProperty(isolate->GetEnteredOrMicrotaskContext(), jsKey).FromMaybe(false) && !jsObj->HasRealNamedProperty(v8_context, jsKey).FromMaybe(false) && !jsObj->HasRealNamedCallbackProperty(v8_context, jsKey).FromMaybe(false)) { continue; diff --git a/v8js_v8object_class.cc b/v8js_v8object_class.cc index de17e26..0ea8158 100644 --- a/v8js_v8object_class.cc +++ b/v8js_v8object_class.cc @@ -344,7 +344,7 @@ static int v8js_v8object_call_method(zend_string *method, zend_object *object, I std::function< v8::MaybeLocal(v8::Isolate *) > v8_call = [obj, method, argc, argv, object, &return_value](v8::Isolate *isolate) { int i = 0; - v8::Local v8_context = isolate->GetEnteredContext(); + v8::Local v8_context = isolate->GetEnteredOrMicrotaskContext(); v8::Local method_name = V8JS_SYML(ZSTR_VAL(method), static_cast(ZSTR_LEN(method))); v8::Local v8obj = v8::Local::New(isolate, obj->v8obj)->ToObject(v8_context).ToLocalChecked(); v8::Local thisObj; @@ -573,7 +573,7 @@ static void v8js_v8generator_next(v8js_v8generator *g) /* {{{ */ * some memory on bailout. */ { std::function< v8::MaybeLocal(v8::Isolate *) > v8_call = [g](v8::Isolate *isolate) { - v8::Local v8_context = isolate->GetEnteredContext(); + v8::Local v8_context = isolate->GetEnteredOrMicrotaskContext(); v8::Local method_name = V8JS_SYM("next"); v8::Local v8obj = v8::Local::New(isolate, g->v8obj.v8obj)->ToObject(v8_context).ToLocalChecked(); v8::Local cb = v8::Local::Cast(v8obj->Get(v8_context, method_name).ToLocalChecked());;