mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 14:01:53 +00:00
Make compatible with V8 3.23.11 (and below)
This commit is contained in:
parent
69290b5779
commit
e20e5098c7
@ -34,6 +34,14 @@ extern "C" {
|
||||
/* V8Js Version */
|
||||
#define V8JS_VERSION "0.1.3"
|
||||
|
||||
/* V8 from 3.23.12 has most v8::Anything::New constructors expect isolates
|
||||
as their first argument. Older versions don't provide these. */
|
||||
#if PHP_V8_API_VERSION < 3023012
|
||||
#define V8JS_NEW(t, i, v...) t::New(v)
|
||||
#else
|
||||
#define V8JS_NEW(t, i, v...) t::New(i, v)
|
||||
#endif
|
||||
|
||||
/* Helper macros */
|
||||
#define V8JS_SYM(v) v8::String::NewFromUtf8(isolate, v, v8::String::kInternalizedString, sizeof(v) - 1)
|
||||
#define V8JS_SYML(v, l) v8::String::NewFromUtf8(isolate, v, v8::String::kInternalizedString, l)
|
||||
|
@ -279,7 +279,7 @@ static void php_v8js_weak_closure_callback(const v8::WeakCallbackData<v8::Object
|
||||
!strncasecmp(key, mname, key_len - 1))
|
||||
|
||||
#define PHP_V8JS_CALLBACK(isolate, mptr, tmpl) \
|
||||
v8::FunctionTemplate::New(php_v8js_php_callback, v8::External::New(isolate, mptr), v8::Signature::New((isolate), tmpl))->GetFunction()
|
||||
v8::FunctionTemplate::New(php_v8js_php_callback, v8::External::New(isolate, mptr), V8JS_NEW(v8::Signature, (isolate), tmpl))->GetFunction()
|
||||
|
||||
|
||||
static void php_v8js_named_property_enumerator(const v8::PropertyCallbackInfo<v8::Array> &info) /* {{{ */
|
||||
@ -287,7 +287,7 @@ static void php_v8js_named_property_enumerator(const v8::PropertyCallbackInfo<v8
|
||||
// note: 'special' properties like 'constructor' are not enumerated.
|
||||
v8::Isolate *isolate = info.GetIsolate();
|
||||
v8::Local<v8::Object> self = info.Holder();
|
||||
v8::Local<v8::Array> result = v8::Array::New(isolate, 0);
|
||||
v8::Local<v8::Array> result = V8JS_NEW(v8::Array, isolate, 0);
|
||||
uint32_t result_len = 0;
|
||||
|
||||
V8JS_TSRMLS_FETCH();
|
||||
@ -547,7 +547,7 @@ static inline v8::Local<v8::Value> php_v8js_named_property_callback(v8::Local<v8
|
||||
v8::Local<v8::Function> cb =
|
||||
v8::FunctionTemplate::New(
|
||||
php_v8js_fake_call_impl, V8JS_NULL,
|
||||
v8::Signature::New(isolate, tmpl))->GetFunction();
|
||||
V8JS_NEW(v8::Signature, isolate, tmpl))->GetFunction();
|
||||
cb->SetName(property);
|
||||
ret_value = cb;
|
||||
} else {
|
||||
@ -729,7 +729,7 @@ static v8::Handle<v8::Value> php_v8js_hash_to_jsobj(zval *value, v8::Isolate *is
|
||||
new_tpl->InstanceTemplate()->SetCallAsFunctionHandler(php_v8js_invoke_callback, PHP_V8JS_CALLBACK(isolate, invoke_method_ptr, new_tpl));
|
||||
}
|
||||
}
|
||||
v8::Local<v8::Array> call_handler_data = v8::Array::New(isolate, 2);
|
||||
v8::Local<v8::Array> call_handler_data = V8JS_NEW(v8::Array, isolate, 2);
|
||||
call_handler_data->Set(0, v8::External::New(isolate, persist_tpl_));
|
||||
call_handler_data->Set(1, v8::External::New(isolate, ce));
|
||||
new_tpl->SetCallHandler(php_v8js_construct_callback, call_handler_data);
|
||||
@ -814,7 +814,7 @@ static v8::Handle<v8::Value> php_v8js_hash_to_jsarr(zval *value, v8::Isolate *is
|
||||
return V8JS_NULL;
|
||||
}
|
||||
|
||||
newarr = v8::Array::New(isolate, i);
|
||||
newarr = V8JS_NEW(v8::Array, isolate, i);
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
|
@ -86,7 +86,7 @@ void php_v8js_register_accessors(std::vector<php_v8js_accessor_ctx*> *accessor_l
|
||||
ctx->isolate = isolate;
|
||||
|
||||
/* Set the variable fetch callback for given symbol on named property */
|
||||
php_obj->SetAccessor(V8JS_STRL(property_name, property_name_len - 1), php_v8js_fetch_php_variable, NULL, v8::External::New(isolate, ctx), v8::PROHIBITS_OVERWRITING, v8::ReadOnly, v8::AccessorSignature::New(isolate, php_obj_t));
|
||||
php_obj->SetAccessor(V8JS_STRL(property_name, property_name_len - 1), php_v8js_fetch_php_variable, NULL, V8JS_NEW(v8::External, isolate, ctx), v8::PROHIBITS_OVERWRITING, v8::ReadOnly, V8JS_NEW(v8::AccessorSignature, isolate, php_obj_t));
|
||||
|
||||
/* record the context so we can free it later */
|
||||
accessor_list->push_back(ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user