mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-09 23:08:41 +00:00
all test passed v8 8.9
This commit is contained in:
parent
0eec3bd764
commit
e648f431ac
@ -48,7 +48,7 @@ if test "$PHP_V8JS" != "no"; then
|
|||||||
CPPFLAGS=$old_CPPFLAGS
|
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=""
|
ac_cv_v8_narrowing=""
|
||||||
old_CXXFLAGS=$CXXFLAGS
|
old_CXXFLAGS=$CXXFLAGS
|
||||||
AC_LANG_PUSH([C++])
|
AC_LANG_PUSH([C++])
|
||||||
@ -58,12 +58,12 @@ if test "$PHP_V8JS" != "no"; then
|
|||||||
(void) foo;
|
(void) foo;
|
||||||
return 0;
|
return 0;
|
||||||
}]])],[ac_cv_v8_narrowing=""],[
|
}]])],[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() {
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() {
|
||||||
struct { unsigned int x; } foo = {-1};
|
struct { unsigned int x; } foo = {-1};
|
||||||
(void) foo;
|
(void) foo;
|
||||||
return 0;
|
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
|
CXXFLAGS="-Wno-narrowing -std="$ac_cv_v8_cstd
|
||||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() {
|
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() {
|
||||||
struct { unsigned int x; } foo = {-1};
|
struct { unsigned int x; } foo = {-1};
|
||||||
|
@ -210,11 +210,11 @@ void v8js_array_access_enumerator(const v8::PropertyCallbackInfo<v8::Array>& inf
|
|||||||
|
|
||||||
for(int j = 0; j < length; j ++) {
|
for(int j = 0; j < length; j ++) {
|
||||||
if(v8js_array_access_isset_p(object, 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);
|
info.GetReturnValue().Set(result);
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
@ -245,12 +245,12 @@ void v8js_array_access_named_getter(v8::Local<v8::Name> property_name, const v8:
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Object> prototype_object;
|
v8::Local<v8::Object> 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. */
|
/* ehh? Array.prototype not an object? strange, stop. */
|
||||||
info.GetReturnValue().Set(ret_value);
|
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);
|
info.GetReturnValue().Set(ret_value);
|
||||||
|
@ -79,7 +79,7 @@ static v8::Local<v8::Value> v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate
|
|||||||
return V8JS_NULL;
|
return V8JS_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Local<v8::Context> v8_context = isolate->GetEnteredContext();
|
v8::Local<v8::Context> v8_context = isolate->GetEnteredOrMicrotaskContext();
|
||||||
newarr = v8::Array::New(isolate, i);
|
newarr = v8::Array::New(isolate, i);
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
@ -149,7 +149,7 @@ v8::Local<v8::Value> zval_to_v8js(zval *value, v8::Isolate *isolate) /* {{{ */
|
|||||||
if (instanceof_function(Z_OBJCE_P(value), ce)) {
|
if (instanceof_function(Z_OBJCE_P(value), ce)) {
|
||||||
zval dtval;
|
zval dtval;
|
||||||
zend_call_method_with_0_params(value, NULL, NULL, "getTimestamp", &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);
|
zval_dtor(&dtval);
|
||||||
} else
|
} else
|
||||||
jsValue = v8js_hash_to_jsobj(value, isolate);
|
jsValue = v8js_hash_to_jsobj(value, isolate);
|
||||||
|
@ -488,7 +488,7 @@ V8JS_METHOD(require)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(Z_TYPE(module_code) == IS_OBJECT) {
|
if(Z_TYPE(module_code) == IS_OBJECT) {
|
||||||
v8::Local<v8::Object> newobj = zval_to_v8js(&module_code, isolate)->ToObject(isolate->GetEnteredContext()).ToLocalChecked();
|
v8::Local<v8::Object> newobj = zval_to_v8js(&module_code, isolate)->ToObject(isolate->GetEnteredOrMicrotaskContext()).ToLocalChecked();
|
||||||
c->modules_loaded[normalised_module_id].Reset(isolate, newobj);
|
c->modules_loaded[normalised_module_id].Reset(isolate, newobj);
|
||||||
info.GetReturnValue().Set(newobj);
|
info.GetReturnValue().Set(newobj);
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ static void v8js_weak_object_callback(const v8::WeakCallbackInfo<zend_object> &d
|
|||||||
static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, const v8::FunctionCallbackInfo<v8::Value>& info) /* {{{ */
|
static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, const v8::FunctionCallbackInfo<v8::Value>& info) /* {{{ */
|
||||||
{
|
{
|
||||||
v8::Isolate *isolate = info.GetIsolate();
|
v8::Isolate *isolate = info.GetIsolate();
|
||||||
v8::Local<v8::Context> v8_context = isolate->GetEnteredContext();
|
v8::Local<v8::Context> v8_context = isolate->GetEnteredOrMicrotaskContext();
|
||||||
v8::Local<v8::Value> return_value = V8JS_NULL;
|
v8::Local<v8::Value> return_value = V8JS_NULL;
|
||||||
zend_fcall_info fci;
|
zend_fcall_info fci;
|
||||||
zend_fcall_info_cache fcc;
|
zend_fcall_info_cache fcc;
|
||||||
@ -231,8 +231,8 @@ static void v8js_construct_callback(const v8::FunctionCallbackInfo<v8::Value>& i
|
|||||||
v8::Local<v8::Array> cons_data = v8::Local<v8::Array>::Cast(info.Data());
|
v8::Local<v8::Array> cons_data = v8::Local<v8::Array>::Cast(info.Data());
|
||||||
v8::Local<v8::Value> cons_tmpl, cons_ce;
|
v8::Local<v8::Value> cons_tmpl, cons_ce;
|
||||||
|
|
||||||
if (!cons_data->Get(isolate->GetEnteredContext(), 0).ToLocal(&cons_tmpl)
|
if (!cons_data->Get(isolate->GetEnteredOrMicrotaskContext(), 0).ToLocal(&cons_tmpl)
|
||||||
||!cons_data->Get(isolate->GetEnteredContext(), 1).ToLocal(&cons_ce))
|
||!cons_data->Get(isolate->GetEnteredOrMicrotaskContext(), 1).ToLocal(&cons_ce))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -328,14 +328,14 @@ static void v8js_weak_closure_callback(const v8::WeakCallbackInfo<v8js_function_
|
|||||||
!strncasecmp(ZSTR_VAL(key), mname, ZSTR_LEN(key)))
|
!strncasecmp(ZSTR_VAL(key), mname, ZSTR_LEN(key)))
|
||||||
|
|
||||||
#define PHP_V8JS_CALLBACK(isolate, mptr, tmpl) \
|
#define PHP_V8JS_CALLBACK(isolate, mptr, tmpl) \
|
||||||
(v8::FunctionTemplate::New((isolate), v8js_php_callback, v8::External::New((isolate), mptr), v8::Signature::New((isolate), tmpl))->GetFunction(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<v8::Array> &info) /* {{{ */
|
static void v8js_named_property_enumerator(const v8::PropertyCallbackInfo<v8::Array> &info) /* {{{ */
|
||||||
{
|
{
|
||||||
// note: 'special' properties like 'constructor' are not enumerated.
|
// note: 'special' properties like 'constructor' are not enumerated.
|
||||||
v8::Isolate *isolate = info.GetIsolate();
|
v8::Isolate *isolate = info.GetIsolate();
|
||||||
v8::Local<v8::Context> v8_context = isolate->GetEnteredContext();
|
v8::Local<v8::Context> v8_context = isolate->GetEnteredOrMicrotaskContext();
|
||||||
|
|
||||||
v8::Local<v8::Object> self = info.Holder();
|
v8::Local<v8::Object> self = info.Holder();
|
||||||
v8::Local<v8::Array> result = v8::Array::New(isolate, 0);
|
v8::Local<v8::Array> result = v8::Array::New(isolate, 0);
|
||||||
@ -435,7 +435,7 @@ static void v8js_named_property_enumerator(const v8::PropertyCallbackInfo<v8::Ar
|
|||||||
static void v8js_invoke_callback(const v8::FunctionCallbackInfo<v8::Value>& info) /* {{{ */
|
static void v8js_invoke_callback(const v8::FunctionCallbackInfo<v8::Value>& info) /* {{{ */
|
||||||
{
|
{
|
||||||
v8::Isolate *isolate = info.GetIsolate();
|
v8::Isolate *isolate = info.GetIsolate();
|
||||||
v8::Local<v8::Context> v8_context = isolate->GetEnteredContext();
|
v8::Local<v8::Context> v8_context = isolate->GetEnteredOrMicrotaskContext();
|
||||||
|
|
||||||
v8::Local<v8::Object> self = info.Holder();
|
v8::Local<v8::Object> self = info.Holder();
|
||||||
v8::Local<v8::Function> cb = v8::Local<v8::Function>::Cast(info.Data());
|
v8::Local<v8::Function> cb = v8::Local<v8::Function>::Cast(info.Data());
|
||||||
@ -480,7 +480,7 @@ static void v8js_invoke_callback(const v8::FunctionCallbackInfo<v8::Value>& info
|
|||||||
static void v8js_fake_call_impl(const v8::FunctionCallbackInfo<v8::Value>& info) /* {{{ */
|
static void v8js_fake_call_impl(const v8::FunctionCallbackInfo<v8::Value>& info) /* {{{ */
|
||||||
{
|
{
|
||||||
v8::Isolate *isolate = info.GetIsolate();
|
v8::Isolate *isolate = info.GetIsolate();
|
||||||
v8::Local<v8::Context> v8_context = isolate->GetEnteredContext();
|
v8::Local<v8::Context> v8_context = isolate->GetEnteredOrMicrotaskContext();
|
||||||
|
|
||||||
v8::Local<v8::Object> self = info.Holder();
|
v8::Local<v8::Object> self = info.Holder();
|
||||||
v8::Local<v8::Value> return_value = V8JS_NULL;
|
v8::Local<v8::Value> return_value = V8JS_NULL;
|
||||||
@ -623,7 +623,7 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::Name> property_n
|
|||||||
v8::Local<v8::String> property = v8::Local<v8::String>::Cast(property_name);
|
v8::Local<v8::String> property = v8::Local<v8::String>::Cast(property_name);
|
||||||
|
|
||||||
v8::Isolate *isolate = info.GetIsolate();
|
v8::Isolate *isolate = info.GetIsolate();
|
||||||
v8::Local<v8::Context> v8_context = isolate->GetEnteredContext();
|
v8::Local<v8::Context> v8_context = isolate->GetEnteredOrMicrotaskContext();
|
||||||
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
|
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
|
||||||
v8::String::Utf8Value cstr(isolate, property);
|
v8::String::Utf8Value cstr(isolate, property);
|
||||||
const char *name = ToCString(cstr);
|
const char *name = ToCString(cstr);
|
||||||
@ -848,7 +848,7 @@ static void v8js_named_property_query(v8::Local<v8::Name> property, const v8::Pr
|
|||||||
}
|
}
|
||||||
|
|
||||||
v8::Isolate *isolate = info.GetIsolate();
|
v8::Isolate *isolate = info.GetIsolate();
|
||||||
v8::MaybeLocal<v8::Integer> value = r->ToInteger(isolate->GetEnteredContext());
|
v8::MaybeLocal<v8::Integer> value = r->ToInteger(isolate->GetEnteredOrMicrotaskContext());
|
||||||
if (!value.IsEmpty()) {
|
if (!value.IsEmpty()) {
|
||||||
info.GetReturnValue().Set(value.ToLocalChecked());
|
info.GetReturnValue().Set(value.ToLocalChecked());
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ int v8js_get_properties_hash(v8::Local<v8::Value> jsValue, HashTable *retval, in
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Skip any prototype properties */
|
/* 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->HasRealNamedProperty(v8_context, jsKey).FromMaybe(false)
|
||||||
&& !jsObj->HasRealNamedCallbackProperty(v8_context, jsKey).FromMaybe(false)) {
|
&& !jsObj->HasRealNamedCallbackProperty(v8_context, jsKey).FromMaybe(false)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -344,7 +344,7 @@ static int v8js_v8object_call_method(zend_string *method, zend_object *object, I
|
|||||||
std::function< v8::MaybeLocal<v8::Value>(v8::Isolate *) > v8_call = [obj, method, argc, argv, object, &return_value](v8::Isolate *isolate) {
|
std::function< v8::MaybeLocal<v8::Value>(v8::Isolate *) > v8_call = [obj, method, argc, argv, object, &return_value](v8::Isolate *isolate) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
v8::Local<v8::Context> v8_context = isolate->GetEnteredContext();
|
v8::Local<v8::Context> v8_context = isolate->GetEnteredOrMicrotaskContext();
|
||||||
v8::Local<v8::String> method_name = V8JS_SYML(ZSTR_VAL(method), static_cast<int>(ZSTR_LEN(method)));
|
v8::Local<v8::String> method_name = V8JS_SYML(ZSTR_VAL(method), static_cast<int>(ZSTR_LEN(method)));
|
||||||
v8::Local<v8::Object> v8obj = v8::Local<v8::Value>::New(isolate, obj->v8obj)->ToObject(v8_context).ToLocalChecked();
|
v8::Local<v8::Object> v8obj = v8::Local<v8::Value>::New(isolate, obj->v8obj)->ToObject(v8_context).ToLocalChecked();
|
||||||
v8::Local<v8::Object> thisObj;
|
v8::Local<v8::Object> thisObj;
|
||||||
@ -573,7 +573,7 @@ static void v8js_v8generator_next(v8js_v8generator *g) /* {{{ */
|
|||||||
* some memory on bailout. */
|
* some memory on bailout. */
|
||||||
{
|
{
|
||||||
std::function< v8::MaybeLocal<v8::Value>(v8::Isolate *) > v8_call = [g](v8::Isolate *isolate) {
|
std::function< v8::MaybeLocal<v8::Value>(v8::Isolate *) > v8_call = [g](v8::Isolate *isolate) {
|
||||||
v8::Local<v8::Context> v8_context = isolate->GetEnteredContext();
|
v8::Local<v8::Context> v8_context = isolate->GetEnteredOrMicrotaskContext();
|
||||||
v8::Local<v8::String> method_name = V8JS_SYM("next");
|
v8::Local<v8::String> method_name = V8JS_SYM("next");
|
||||||
v8::Local<v8::Object> v8obj = v8::Local<v8::Value>::New(isolate, g->v8obj.v8obj)->ToObject(v8_context).ToLocalChecked();
|
v8::Local<v8::Object> v8obj = v8::Local<v8::Value>::New(isolate, g->v8obj.v8obj)->ToObject(v8_context).ToLocalChecked();
|
||||||
v8::Local<v8::Function> cb = v8::Local<v8::Function>::Cast(v8obj->Get(v8_context, method_name).ToLocalChecked());;
|
v8::Local<v8::Function> cb = v8::Local<v8::Function>::Cast(v8obj->Get(v8_context, method_name).ToLocalChecked());;
|
||||||
|
Loading…
Reference in New Issue
Block a user