From d97832d9fba3d2d97979c203e8cee13c5916660a Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Sat, 11 Mar 2017 13:31:40 +0100 Subject: [PATCH 1/4] v8::Handle -> v8::Local --- php_v8js_macros.h | 8 ++++---- v8js_array_access.cc | 2 +- v8js_convert.cc | 10 +++++----- v8js_exceptions.cc | 2 +- v8js_methods.cc | 2 +- v8js_object_export.cc | 30 +++++++++++++++--------------- v8js_object_export.h | 2 +- v8js_v8.cc | 2 +- v8js_v8.h | 2 +- v8js_v8object_class.cc | 2 +- v8js_v8object_class.h | 2 +- v8js_variables.cc | 2 +- 12 files changed, 33 insertions(+), 33 deletions(-) diff --git a/php_v8js_macros.h b/php_v8js_macros.h index 0196b74..3232aa9 100644 --- a/php_v8js_macros.h +++ b/php_v8js_macros.h @@ -79,13 +79,13 @@ extern "C" { /* Convert zval into V8 value */ -v8::Handle zval_to_v8js(zval *, v8::Isolate *); +v8::Local zval_to_v8js(zval *, v8::Isolate *); /* Convert zend_long into V8 value */ -v8::Handle zend_long_to_v8js(zend_long, v8::Isolate *); +v8::Local zend_long_to_v8js(zend_long, v8::Isolate *); /* Convert V8 value into zval */ -int v8js_to_zval(v8::Handle, zval *, int, v8::Isolate * TSRMLS_DC); +int v8js_to_zval(v8::Local, zval *, int, v8::Isolate * TSRMLS_DC); struct v8js_accessor_ctx { @@ -159,7 +159,7 @@ struct _v8js_process_globals { extern struct _v8js_process_globals v8js_process_globals; /* Register builtin methods into passed object */ -void v8js_register_methods(v8::Handle, v8js_ctx *c); +void v8js_register_methods(v8::Local, v8js_ctx *c); #endif /* PHP_V8JS_MACROS_H */ diff --git a/v8js_array_access.cc b/v8js_array_access.cc index 5fda1d7..bf36269 100644 --- a/v8js_array_access.cc +++ b/v8js_array_access.cc @@ -94,7 +94,7 @@ void v8js_array_access_setter(uint32_t index, v8::Local value, ZVAL_UNDEF(&zvalue); if (v8js_to_zval(value, &zvalue, 0, isolate TSRMLS_CC) != SUCCESS) { - info.GetReturnValue().Set(v8::Handle()); + info.GetReturnValue().Set(v8::Local()); return; } diff --git a/v8js_convert.cc b/v8js_convert.cc index 1dd95cc..d181ae7 100644 --- a/v8js_convert.cc +++ b/v8js_convert.cc @@ -57,7 +57,7 @@ static int v8js_is_assoc_array(HashTable *myht TSRMLS_DC) /* {{{ */ /* }}} */ -static v8::Handle v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ +static v8::Local v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ { HashTable *myht = HASH_OF(value); int i = myht ? zend_hash_num_elements(myht) : 0; @@ -100,7 +100,7 @@ static v8::Handle v8js_hash_to_jsarr(zval *value, v8::Isolate *isolat } /* }}} */ -v8::Handle zend_long_to_v8js(zend_long v, v8::Isolate *isolate) /* {{{ */ +v8::Local zend_long_to_v8js(zend_long v, v8::Isolate *isolate) /* {{{ */ { if (v < - std::numeric_limits::min() || v > std::numeric_limits::max()) { return V8JS_FLOAT(static_cast(v)); @@ -110,9 +110,9 @@ v8::Handle zend_long_to_v8js(zend_long v, v8::Isolate *isolate) /* {{ } /* }}} */ -v8::Handle zval_to_v8js(zval *value, v8::Isolate *isolate) /* {{{ */ +v8::Local zval_to_v8js(zval *value, v8::Isolate *isolate) /* {{{ */ { - v8::Handle jsValue; + v8::Local jsValue; zend_string *value_str; zend_class_entry *ce; @@ -186,7 +186,7 @@ v8::Handle zval_to_v8js(zval *value, v8::Isolate *isolate) /* {{{ */ } /* }}} */ -int v8js_to_zval(v8::Handle jsValue, zval *return_value, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ +int v8js_to_zval(v8::Local jsValue, zval *return_value, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ { if (jsValue->IsString()) { diff --git a/v8js_exceptions.cc b/v8js_exceptions.cc index 5fa4281..6d5a9a8 100644 --- a/v8js_exceptions.cc +++ b/v8js_exceptions.cc @@ -41,7 +41,7 @@ void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8:: { v8::String::Utf8Value exception(try_catch->Exception()); const char *exception_string = ToCString(exception); - v8::Handle tc_message = try_catch->Message(); + v8::Local tc_message = try_catch->Message(); const char *filename_string, *sourceline_string; char *message_string; int linenum, start_col, end_col; diff --git a/v8js_methods.cc b/v8js_methods.cc index 5cd0edf..a939d12 100644 --- a/v8js_methods.cc +++ b/v8js_methods.cc @@ -502,7 +502,7 @@ V8JS_METHOD(require) info.GetReturnValue().Set(newobj); } -void v8js_register_methods(v8::Handle global, v8js_ctx *c) /* {{{ */ +void v8js_register_methods(v8::Local global, v8js_ctx *c) /* {{{ */ { v8::Isolate *isolate = c->isolate; global->Set(V8JS_SYM("exit"), v8::FunctionTemplate::New(isolate, V8JS_MN(exit)), v8::ReadOnly); diff --git a/v8js_object_export.cc b/v8js_object_export.cc index 5e6fcd9..5cac0bb 100644 --- a/v8js_object_export.cc +++ b/v8js_object_export.cc @@ -37,7 +37,7 @@ static void v8js_weak_object_callback(const v8::WeakCallbackInfo &d /* Callback for PHP methods and functions */ static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, v8::Isolate *isolate, const v8::FunctionCallbackInfo& info TSRMLS_DC) /* {{{ */ { - v8::Handle return_value = V8JS_NULL; + v8::Local return_value = V8JS_NULL; zend_fcall_info fci; zend_fcall_info_cache fcc; zval fname, retval; @@ -211,7 +211,7 @@ static void v8js_construct_callback(const v8::FunctionCallbackInfo& i v8::Isolate *isolate = info.GetIsolate(); info.GetReturnValue().Set(V8JS_UNDEFINED); - v8::Handle newobj = info.This(); + v8::Local newobj = info.This(); zval value; if (!info.IsConstructCall()) { @@ -460,7 +460,7 @@ static void v8js_fake_call_impl(const v8::FunctionCallbackInfo& info) { v8::Isolate *isolate = info.GetIsolate(); v8::Local self = info.Holder(); - v8::Handle return_value = V8JS_NULL; + v8::Local return_value = V8JS_NULL; char *error; size_t error_len; @@ -674,7 +674,7 @@ v8::Local v8js_named_property_callback(v8::Local property ret_value = V8JS_BOOL(false); } else { /* shouldn't reach here! but bail safely */ - ret_value = v8::Handle(); + ret_value = v8::Local(); } } else { if (name[0]=='$') { @@ -697,7 +697,7 @@ v8::Local v8js_named_property_callback(v8::Local property // (indicating that we don't intercept this property) if the // property doesn't exist. if (property_val == &EG(uninitialized_zval)) { - ret_value = v8::Handle(); + ret_value = v8::Local(); } else { // wrap it ret_value = zval_to_v8js(property_val, isolate TSRMLS_CC); @@ -719,7 +719,7 @@ v8::Local v8js_named_property_callback(v8::Local property } else if (callback_type == V8JS_PROP_SETTER) { if (v8js_to_zval(set_value, &php_value, ctx->flags, isolate TSRMLS_CC) != SUCCESS) { - ret_value = v8::Handle(); + ret_value = v8::Local(); } else { zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1 TSRMLS_CC); @@ -752,7 +752,7 @@ v8::Local v8js_named_property_callback(v8::Local property if (h->has_property(&zobject, &zname, 0, NULL TSRMLS_CC)) { ret_value = V8JS_UINT(v8::None); } else { - ret_value = v8::Handle(); // empty handle + ret_value = v8::Local(); // empty handle } } else { zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1 TSRMLS_CC); @@ -764,12 +764,12 @@ v8::Local v8js_named_property_callback(v8::Local property ret_value = V8JS_TRUE(); } else { - ret_value = v8::Handle(); // empty handle + ret_value = v8::Local(); // empty handle } } } else { /* shouldn't reach here! but bail safely */ - ret_value = v8::Handle(); + ret_value = v8::Local(); } zval_ptr_dtor(&zname); @@ -813,7 +813,7 @@ static void v8js_named_property_deleter(v8::Local property, const v8 -static v8::Handle v8js_wrap_object(v8::Isolate *isolate, zend_class_entry *ce, zval *value TSRMLS_DC) /* {{{ */ +static v8::Local v8js_wrap_object(v8::Isolate *isolate, zend_class_entry *ce, zval *value TSRMLS_DC) /* {{{ */ { v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0); v8::Local new_tpl; @@ -911,8 +911,8 @@ static v8::Handle v8js_wrap_object(v8::Isolate *isolate, zend_class_ } // Create v8 wrapper object - v8::Handle external = v8::External::New(isolate, Z_OBJ_P(value)); - v8::Handle newobj = new_tpl->GetFunction()->NewInstance(1, &external); + v8::Local external = v8::External::New(isolate, Z_OBJ_P(value)); + v8::Local newobj = new_tpl->GetFunction()->NewInstance(1, &external); if (ce == zend_ce_closure) { // free uncached function template when object is freed @@ -925,7 +925,7 @@ static v8::Handle v8js_wrap_object(v8::Isolate *isolate, zend_class_ /* }}} */ -static v8::Handle v8js_wrap_array_to_object(v8::Isolate *isolate, zval *value TSRMLS_DC) /* {{{ */ +static v8::Local v8js_wrap_array_to_object(v8::Isolate *isolate, zval *value TSRMLS_DC) /* {{{ */ { int i; zend_string *key; @@ -948,7 +948,7 @@ static v8::Handle v8js_wrap_array_to_object(v8::Isolate *isolate, zv new_tpl = v8::Local::New(isolate, ctx->array_tmpl); } - v8::Handle newobj = new_tpl->InstanceTemplate()->NewInstance(); + v8::Local newobj = new_tpl->InstanceTemplate()->NewInstance(); HashTable *myht = HASH_OF(value); i = myht ? zend_hash_num_elements(myht) : 0; @@ -1003,7 +1003,7 @@ static v8::Handle v8js_wrap_array_to_object(v8::Isolate *isolate, zv /* }}} */ -v8::Handle v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ +v8::Local v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ { HashTable *myht; zend_class_entry *ce = NULL; diff --git a/v8js_object_export.h b/v8js_object_export.h index 9e3ec84..bf5be2c 100644 --- a/v8js_object_export.h +++ b/v8js_object_export.h @@ -14,7 +14,7 @@ #ifndef V8JS_OBJECT_EXPORT_H #define V8JS_OBJECT_EXPORT_H -v8::Handle v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS_DC); +v8::Local v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS_DC); typedef enum { diff --git a/v8js_v8.cc b/v8js_v8.cc index 16809f2..8ef473d 100644 --- a/v8js_v8.cc +++ b/v8js_v8.cc @@ -258,7 +258,7 @@ void v8js_terminate_execution(v8::Isolate *isolate) /* {{{ */ /* }}} */ -int v8js_get_properties_hash(v8::Handle jsValue, HashTable *retval, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ +int v8js_get_properties_hash(v8::Local jsValue, HashTable *retval, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ { v8::Local jsObj = jsValue->ToObject(); diff --git a/v8js_v8.h b/v8js_v8.h index 7a761b6..310ea93 100644 --- a/v8js_v8.h +++ b/v8js_v8.h @@ -58,7 +58,7 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value, void v8js_terminate_execution(v8::Isolate *isolate); /* Fetch V8 object properties */ -int v8js_get_properties_hash(v8::Handle jsValue, HashTable *retval, int flags, v8::Isolate *isolate TSRMLS_DC); +int v8js_get_properties_hash(v8::Local jsValue, HashTable *retval, int flags, v8::Isolate *isolate TSRMLS_DC); #define V8JS_CTX_PROLOGUE_EX(ctx, ret) \ if (!V8JSG(v8_initialized)) { \ diff --git a/v8js_v8object_class.cc b/v8js_v8object_class.cc index 95b8834..fbeb101 100644 --- a/v8js_v8object_class.cc +++ b/v8js_v8object_class.cc @@ -688,7 +688,7 @@ PHP_METHOD(V8Generator, valid) /* }}} */ -void v8js_v8object_create(zval *res, v8::Handle value, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ +void v8js_v8object_create(zval *res, v8::Local value, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ { v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0); diff --git a/v8js_v8object_class.h b/v8js_v8object_class.h index 4e1ded1..7bf0877 100644 --- a/v8js_v8object_class.h +++ b/v8js_v8object_class.h @@ -28,7 +28,7 @@ extern zend_class_entry *php_ce_v8object; extern zend_class_entry *php_ce_v8function; /* Create PHP V8 object */ -void v8js_v8object_create(zval *, v8::Handle, int, v8::Isolate * TSRMLS_DC); +void v8js_v8object_create(zval *, v8::Local, int, v8::Isolate * TSRMLS_DC); static inline v8js_v8object *v8js_v8object_fetch_object(zend_object *obj) { return (v8js_v8object *)((char *)obj - XtOffsetOf(struct v8js_v8object, std)); diff --git a/v8js_variables.cc b/v8js_variables.cc index 654dce7..246af07 100644 --- a/v8js_variables.cc +++ b/v8js_variables.cc @@ -27,7 +27,7 @@ extern "C" { static void v8js_fetch_php_variable(v8::Local name, const v8::PropertyCallbackInfo& info) /* {{{ */ { - v8::Handle data = v8::Handle::Cast(info.Data()); + v8::Local data = v8::Local::Cast(info.Data()); v8js_accessor_ctx *ctx = static_cast(data->Value()); v8::Isolate *isolate = ctx->isolate; zval *variable; From 24bb1761bf163a5aae07290dd2bc858659434f7c Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Sat, 11 Mar 2017 13:35:21 +0100 Subject: [PATCH 2/4] remove TSRMLS_DC, TSRMLS_CC --- php_v8js_macros.h | 6 +-- v8js_array_access.cc | 34 ++++++++-------- v8js_class.cc | 92 +++++++++++++++++++++--------------------- v8js_convert.cc | 28 ++++++------- v8js_exceptions.cc | 36 ++++++++--------- v8js_exceptions.h | 4 +- v8js_methods.cc | 12 +++--- v8js_object_export.cc | 54 ++++++++++++------------- v8js_object_export.h | 2 +- v8js_timer.cc | 2 +- v8js_timer.h | 2 +- v8js_v8.cc | 20 ++++----- v8js_v8.h | 4 +- v8js_v8object_class.cc | 80 ++++++++++++++++++------------------ v8js_v8object_class.h | 2 +- v8js_variables.cc | 8 ++-- 16 files changed, 193 insertions(+), 193 deletions(-) diff --git a/php_v8js_macros.h b/php_v8js_macros.h index 3232aa9..f233ec3 100644 --- a/php_v8js_macros.h +++ b/php_v8js_macros.h @@ -85,7 +85,7 @@ v8::Local zval_to_v8js(zval *, v8::Isolate *); v8::Local zend_long_to_v8js(zend_long, v8::Isolate *); /* Convert V8 value into zval */ -int v8js_to_zval(v8::Local, zval *, int, v8::Isolate * TSRMLS_DC); +int v8js_to_zval(v8::Local, zval *, int, v8::Isolate *); struct v8js_accessor_ctx { @@ -93,10 +93,10 @@ struct v8js_accessor_ctx v8::Isolate *isolate; }; -void v8js_accessor_ctx_dtor(v8js_accessor_ctx * TSRMLS_DC); +void v8js_accessor_ctx_dtor(v8js_accessor_ctx *); /* Register accessors into passed object */ -void v8js_register_accessors(std::vector *accessor_list, v8::Local, zval *, v8::Isolate * TSRMLS_DC); +void v8js_register_accessors(std::vector *accessor_list, v8::Local, zval *, v8::Isolate *); /* Forward declarations */ diff --git a/v8js_array_access.cc b/v8js_array_access.cc index bf36269..ea8beb4 100644 --- a/v8js_array_access.cc +++ b/v8js_array_access.cc @@ -29,7 +29,7 @@ extern "C" { } static zval v8js_array_access_dispatch(zend_object *object, const char *method_name, int param_count, - uint32_t index, zval zvalue TSRMLS_DC) /* {{{ */ + uint32_t index, zval zvalue) /* {{{ */ { zend_fcall_info fci; zval php_value; @@ -52,7 +52,7 @@ static zval v8js_array_access_dispatch(zend_object *object, const char *method_n fci.object = object; fci.no_separation = 0; - zend_call_function(&fci, NULL TSRMLS_CC); + zend_call_function(&fci, NULL); zval_dtor(&fci.function_name); return php_value; } @@ -72,8 +72,8 @@ void v8js_array_access_getter(uint32_t index, const v8::PropertyCallbackInfo ret_value = zval_to_v8js(&php_value, isolate TSRMLS_CC); + zval php_value = v8js_array_access_dispatch(object, "offsetGet", 1, index, zvalue); + v8::Local ret_value = zval_to_v8js(&php_value, isolate); zval_ptr_dtor(&php_value); info.GetReturnValue().Set(ret_value); @@ -93,12 +93,12 @@ void v8js_array_access_setter(uint32_t index, v8::Local value, zval zvalue; ZVAL_UNDEF(&zvalue); - if (v8js_to_zval(value, &zvalue, 0, isolate TSRMLS_CC) != SUCCESS) { + if (v8js_to_zval(value, &zvalue, 0, isolate) != SUCCESS) { info.GetReturnValue().Set(v8::Local()); return; } - zval php_value = v8js_array_access_dispatch(object, "offsetSet", 2, index, zvalue TSRMLS_CC); + zval php_value = v8js_array_access_dispatch(object, "offsetSet", 2, index, zvalue); zval_ptr_dtor(&php_value); /* simply pass back the value to tell we intercepted the call @@ -112,15 +112,15 @@ void v8js_array_access_setter(uint32_t index, v8::Local value, /* }}} */ -static int v8js_array_access_get_count_result(zend_object *object TSRMLS_DC) /* {{{ */ +static int v8js_array_access_get_count_result(zend_object *object) /* {{{ */ { zval zvalue; ZVAL_UNDEF(&zvalue); - zval php_value = v8js_array_access_dispatch(object, "count", 0, 0, zvalue TSRMLS_CC); + zval php_value = v8js_array_access_dispatch(object, "count", 0, 0, zvalue); if(Z_TYPE(php_value) != IS_LONG) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Non-numeric return value from count() method"); + php_error_docref(NULL, E_WARNING, "Non-numeric return value from count() method"); zval_ptr_dtor(&php_value); return 0; } @@ -137,15 +137,15 @@ static int v8js_array_access_get_count_result(zend_object *object TSRMLS_DC) /* } /* }}} */ -static bool v8js_array_access_isset_p(zend_object *object, int index TSRMLS_DC) /* {{{ */ +static bool v8js_array_access_isset_p(zend_object *object, int index) /* {{{ */ { zval zvalue; ZVAL_UNDEF(&zvalue); - zval php_value = v8js_array_access_dispatch(object, "offsetExists", 1, index, zvalue TSRMLS_CC); + zval php_value = v8js_array_access_dispatch(object, "offsetExists", 1, index, zvalue); if(Z_TYPE(php_value) != IS_TRUE && Z_TYPE(php_value) != IS_FALSE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Non-boolean return value from offsetExists() method"); + php_error_docref(NULL, E_WARNING, "Non-boolean return value from offsetExists() method"); zval_ptr_dtor(&php_value); return false; } @@ -164,7 +164,7 @@ static void v8js_array_access_length(v8::Local property, const v8::P zend_object *object = reinterpret_cast(self->GetAlignedPointerFromInternalField(1)); - int length = v8js_array_access_get_count_result(object TSRMLS_CC); + int length = v8js_array_access_get_count_result(object); info.GetReturnValue().Set(V8JS_INT(length)); } /* }}} */ @@ -181,7 +181,7 @@ void v8js_array_access_deleter(uint32_t index, const v8::PropertyCallbackInfo& inf zend_object *object = reinterpret_cast(self->GetAlignedPointerFromInternalField(1)); - int length = v8js_array_access_get_count_result(object TSRMLS_CC); + int length = v8js_array_access_get_count_result(object); v8::Local result = v8::Array::New(isolate, length); int i = 0; for(int j = 0; j < length; j ++) { - if(v8js_array_access_isset_p(object, j TSRMLS_CC)) { + if(v8js_array_access_isset_p(object, j)) { result->Set(i ++, V8JS_INT(j)); } } diff --git a/v8js_class.cc b/v8js_class.cc index a34b7c7..e073b66 100644 --- a/v8js_class.cc +++ b/v8js_class.cc @@ -82,11 +82,11 @@ public: }; -static void v8js_free_storage(zend_object *object TSRMLS_DC) /* {{{ */ +static void v8js_free_storage(zend_object *object) /* {{{ */ { v8js_ctx *c = v8js_ctx_fetch_object(object); - zend_object_std_dtor(&c->std TSRMLS_CC); + zend_object_std_dtor(&c->std); zval_ptr_dtor(&c->pending_exception); zval_ptr_dtor(&c->module_normaliser); @@ -134,7 +134,7 @@ static void v8js_free_storage(zend_object *object TSRMLS_DC) /* {{{ */ /* Clear contexts */ for (std::vector::iterator it = c->accessor_list.begin(); it != c->accessor_list.end(); ++it) { - v8js_accessor_ctx_dtor(*it TSRMLS_CC); + v8js_accessor_ctx_dtor(*it); } c->accessor_list.~vector(); @@ -204,12 +204,12 @@ static void v8js_free_storage(zend_object *object TSRMLS_DC) /* {{{ */ } /* }}} */ -static zend_object* v8js_new(zend_class_entry *ce TSRMLS_DC) /* {{{ */ +static zend_object* v8js_new(zend_class_entry *ce) /* {{{ */ { v8js_ctx *c; c = (v8js_ctx *) ecalloc(1, sizeof(*c) + zend_object_properties_size(ce)); - zend_object_std_init(&c->std, ce TSRMLS_CC); + zend_object_std_init(&c->std, ce); object_properties_init(&c->std, ce); c->std.handlers = &v8js_object_handlers; @@ -340,7 +340,7 @@ static PHP_METHOD(V8Js, __construct) return; } - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|Saabz", &object_name, &vars_arr, &exts_arr, &report_uncaught, &snapshot_blob) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "|Saabz", &object_name, &vars_arr, &exts_arr, &report_uncaught, &snapshot_blob) == FAILURE) { return; } @@ -372,7 +372,7 @@ static PHP_METHOD(V8Js, __construct) c->snapshot_blob.raw_size = static_cast(Z_STRLEN_P(snapshot_blob)); c->create_params.snapshot_blob = &c->snapshot_blob; } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument snapshot_blob expected to be of string type"); + php_error_docref(NULL, E_WARNING, "Argument snapshot_blob expected to be of string type"); } } @@ -462,7 +462,7 @@ static PHP_METHOD(V8Js, __construct) /* Register Get accessor for passed variables */ if (vars_arr && zend_hash_num_elements(Z_ARRVAL_P(vars_arr)) > 0) { - v8js_register_accessors(&c->accessor_list, php_obj_t, vars_arr, isolate TSRMLS_CC); + v8js_register_accessors(&c->accessor_list, php_obj_t, vars_arr, isolate); } /* Set name for the PHP JS object */ @@ -490,12 +490,12 @@ static PHP_METHOD(V8Js, __construct) V8JS_GLOBAL(isolate)->ForceSet(object_name_js, php_obj, v8::ReadOnly); /* Export public property values */ - HashTable *properties = zend_std_get_properties(getThis() TSRMLS_CC); + HashTable *properties = zend_std_get_properties(getThis()); zval *value; zend_string *member; ZEND_HASH_FOREACH_STR_KEY(properties, member) { - zend_property_info *property_info = zend_get_property_info(c->std.ce, member, 1 TSRMLS_CC); + zend_property_info *property_info = zend_get_property_info(c->std.ce, member, 1); if(property_info && property_info != ZEND_WRONG_PROPERTY_INFO && (property_info->flags & ZEND_ACC_PUBLIC)) { @@ -510,7 +510,7 @@ static PHP_METHOD(V8Js, __construct) /* Write value to PHP JS object */ value = OBJ_PROP(Z_OBJ_P(getThis()), property_info->offset); - php_obj->ForceSet(key, zval_to_v8js(value, isolate TSRMLS_CC), v8::ReadOnly); + php_obj->ForceSet(key, zval_to_v8js(value, isolate), v8::ReadOnly); } } ZEND_HASH_FOREACH_END(); @@ -595,7 +595,7 @@ static PHP_METHOD(V8Js, __construct) PHP_METHOD(V8Js, __sleep) { zend_throw_exception(php_ce_v8js_exception, - "You cannot serialize or unserialize V8Js instances", 0 TSRMLS_CC); + "You cannot serialize or unserialize V8Js instances", 0); RETURN_FALSE; } /* }}} */ @@ -605,12 +605,12 @@ PHP_METHOD(V8Js, __sleep) PHP_METHOD(V8Js, __wakeup) { zend_throw_exception(php_ce_v8js_exception, - "You cannot serialize or unserialize V8Js instances", 0 TSRMLS_CC); + "You cannot serialize or unserialize V8Js instances", 0); RETURN_FALSE; } /* }}} */ -static void v8js_compile_script(zval *this_ptr, const zend_string *str, const zend_string *identifier, v8js_script **ret TSRMLS_DC) +static void v8js_compile_script(zval *this_ptr, const zend_string *str, const zend_string *identifier, v8js_script **ret) { v8js_script *res = NULL; @@ -642,7 +642,7 @@ static void v8js_compile_script(zval *this_ptr, const zend_string *str, const ze /* Compile errors? */ if (script.IsEmpty()) { - v8js_throw_script_exception(c->isolate, &try_catch TSRMLS_CC); + v8js_throw_script_exception(c->isolate, &try_catch); return; } res = (v8js_script *)emalloc(sizeof(v8js_script)); @@ -655,7 +655,7 @@ static void v8js_compile_script(zval *this_ptr, const zend_string *str, const ze return; } -static void v8js_execute_script(zval *this_ptr, v8js_script *res, long flags, long time_limit, long memory_limit, zval **return_value TSRMLS_DC) +static void v8js_execute_script(zval *this_ptr, v8js_script *res, long flags, long time_limit, long memory_limit, zval **return_value) { v8js_ctx *c = Z_V8JS_CTX_OBJ_P(this_ptr); @@ -681,7 +681,7 @@ static void v8js_execute_script(zval *this_ptr, v8js_script *res, long flags, lo return script->Run(); }; - v8js_v8_call(c, return_value, flags, time_limit, memory_limit, v8_call TSRMLS_CC); + v8js_v8_call(c, return_value, flags, time_limit, memory_limit, v8_call); } if(V8JSG(fatal_error_abort)) { @@ -699,17 +699,17 @@ static PHP_METHOD(V8Js, executeString) long flags = V8JS_FLAG_NONE, time_limit = 0, memory_limit = 0; v8js_script *res = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|Slll", &str, &identifier, &flags, &time_limit, &memory_limit) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|Slll", &str, &identifier, &flags, &time_limit, &memory_limit) == FAILURE) { return; } - v8js_compile_script(getThis(), str, identifier, &res TSRMLS_CC); + v8js_compile_script(getThis(), str, identifier, &res); if (!res) { RETURN_FALSE; } zend_try { - v8js_execute_script(getThis(), res, flags, time_limit, memory_limit, &return_value TSRMLS_CC); + v8js_execute_script(getThis(), res, flags, time_limit, memory_limit, &return_value); v8js_script_free(res); } zend_catch { @@ -730,11 +730,11 @@ static PHP_METHOD(V8Js, compileString) zend_string *str = NULL, *identifier = NULL; v8js_script *res = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &str, &identifier) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|S", &str, &identifier) == FAILURE) { return; } - v8js_compile_script(getThis(), str, identifier, &res TSRMLS_CC); + v8js_compile_script(getThis(), str, identifier, &res); if (res) { RETVAL_RES(zend_register_resource(res, le_v8js_script)); @@ -754,7 +754,7 @@ static PHP_METHOD(V8Js, executeScript) zval *zscript; v8js_script *res; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lll", &zscript, &flags, &time_limit, &memory_limit) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|lll", &zscript, &flags, &time_limit, &memory_limit) == FAILURE) { return; } @@ -762,7 +762,7 @@ static PHP_METHOD(V8Js, executeScript) RETURN_FALSE; } - v8js_execute_script(getThis(), res, flags, time_limit, memory_limit, &return_value TSRMLS_CC); + v8js_execute_script(getThis(), res, flags, time_limit, memory_limit, &return_value); } /* }}} */ @@ -775,11 +775,11 @@ static PHP_METHOD(V8Js, checkString) v8js_script *res = NULL; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &str) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &str) == FAILURE) { return; } - v8js_compile_script(getThis(), str, identifier, &res TSRMLS_CC); + v8js_compile_script(getThis(), str, identifier, &res); zend_string_release(identifier); if (!res) { @@ -836,7 +836,7 @@ static PHP_METHOD(V8Js, setModuleNormaliser) v8js_ctx *c; zval *callable; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &callable) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callable) == FAILURE) { return; } @@ -852,7 +852,7 @@ static PHP_METHOD(V8Js, setModuleLoader) v8js_ctx *c; zval *callable; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &callable) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &callable) == FAILURE) { return; } @@ -868,7 +868,7 @@ static PHP_METHOD(V8Js, setTimeLimit) v8js_ctx *c; long time_limit = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &time_limit) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &time_limit) == FAILURE) { return; } @@ -904,7 +904,7 @@ static PHP_METHOD(V8Js, setMemoryLimit) v8js_ctx *c; long memory_limit = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &memory_limit) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &memory_limit) == FAILURE) { return; } @@ -935,7 +935,7 @@ static PHP_METHOD(V8Js, setAverageObjectSize) v8js_ctx *c; long average_object_size = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &average_object_size) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &average_object_size) == FAILURE) { return; } @@ -979,7 +979,7 @@ static void v8js_script_dtor(zend_resource *rsrc) /* {{{ */ } /* }}} */ -static int v8js_register_extension(zend_string *name, zend_string *source, zval *deps_arr, zend_bool auto_enable TSRMLS_DC) /* {{{ */ +static int v8js_register_extension(zend_string *name, zend_string *source, zval *deps_arr, zend_bool auto_enable) /* {{{ */ { v8js_jsext *jsext = NULL; @@ -1003,7 +1003,7 @@ static int v8js_register_extension(zend_string *name, zend_string *source, zval jsext->deps_count = zend_hash_num_elements(Z_ARRVAL_P(deps_arr)); if (v8js_create_ext_strarr(&jsext->deps, jsext->deps_count, Z_ARRVAL_P(deps_arr)) == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid dependency array passed"); + php_error_docref(NULL, E_WARNING, "Invalid dependency array passed"); v8js_jsext_free_storage(jsext); #ifdef ZTS v8js_process_globals.lock.unlock(); @@ -1057,15 +1057,15 @@ static PHP_METHOD(V8Js, registerExtension) zval *deps_arr = NULL; zend_bool auto_enable = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "SS|ab", &ext_name, &script, &deps_arr, &auto_enable) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "SS|ab", &ext_name, &script, &deps_arr, &auto_enable) == FAILURE) { return; } if (!ZSTR_LEN(ext_name)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Extension name cannot be empty"); + php_error_docref(NULL, E_WARNING, "Extension name cannot be empty"); } else if (!ZSTR_LEN(script)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Script cannot be empty"); - } else if (v8js_register_extension(ext_name, script, deps_arr, auto_enable TSRMLS_CC) == SUCCESS) { + php_error_docref(NULL, E_WARNING, "Script cannot be empty"); + } else if (v8js_register_extension(ext_name, script, deps_arr, auto_enable) == SUCCESS) { RETURN_TRUE; } RETURN_FALSE; @@ -1121,12 +1121,12 @@ static PHP_METHOD(V8Js, createSnapshot) { zend_string *script; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S", &script) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "S", &script) == FAILURE) { return; } if (!ZSTR_LEN(script)) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Script cannot be empty"); + php_error_docref(NULL, E_WARNING, "Script cannot be empty"); RETURN_FALSE; } @@ -1136,7 +1136,7 @@ static PHP_METHOD(V8Js, createSnapshot) v8::StartupData snapshot_blob = v8::V8::CreateSnapshotDataBlob(ZSTR_VAL(script)); if (!snapshot_blob.data) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to create V8 heap snapshot. Check $embed_source for errors."); + php_error_docref(NULL, E_WARNING, "Failed to create V8 heap snapshot. Check $embed_source for errors."); RETURN_FALSE; } @@ -1253,12 +1253,12 @@ const zend_function_entry v8js_methods[] = { /* {{{ */ /* V8Js object handlers */ -static void v8js_write_property(zval *object, zval *member, zval *value, void **cache_slot TSRMLS_DC) /* {{{ */ +static void v8js_write_property(zval *object, zval *member, zval *value, void **cache_slot) /* {{{ */ { V8JS_BEGIN_CTX(c, object) /* Check whether member is public, if so, export to V8. */ - zend_property_info *property_info = zend_get_property_info(c->std.ce, Z_STR_P(member), 1 TSRMLS_CC); + zend_property_info *property_info = zend_get_property_info(c->std.ce, Z_STR_P(member), 1); if(!property_info || (property_info != ZEND_WRONG_PROPERTY_INFO && (property_info->flags & ZEND_ACC_PUBLIC))) { @@ -1274,7 +1274,7 @@ static void v8js_write_property(zval *object, zval *member, zval *value, void ** /* Write value to PHP JS object */ v8::Local key = V8JS_SYML(Z_STRVAL_P(member), static_cast(Z_STRLEN_P(member))); - jsobj->ForceSet(key, zval_to_v8js(value, isolate TSRMLS_CC), v8::ReadOnly); + jsobj->ForceSet(key, zval_to_v8js(value, isolate), v8::ReadOnly); } /* Write value to PHP object */ @@ -1282,7 +1282,7 @@ static void v8js_write_property(zval *object, zval *member, zval *value, void ** } /* }}} */ -static void v8js_unset_property(zval *object, zval *member, void **cache_slot TSRMLS_DC) /* {{{ */ +static void v8js_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */ { V8JS_BEGIN_CTX(c, object) @@ -1311,7 +1311,7 @@ PHP_MINIT_FUNCTION(v8js_class) /* {{{ */ /* V8Js Class */ INIT_CLASS_ENTRY(ce, "V8Js", v8js_methods); - php_ce_v8js = zend_register_internal_class(&ce TSRMLS_CC); + php_ce_v8js = zend_register_internal_class(&ce); php_ce_v8js->create_object = v8js_new; /* V8Js handlers */ @@ -1325,7 +1325,7 @@ PHP_MINIT_FUNCTION(v8js_class) /* {{{ */ zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("FLAG_NONE"), V8JS_FLAG_NONE TSRMLS_CC); zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("FLAG_FORCE_ARRAY"), V8JS_FLAG_FORCE_ARRAY TSRMLS_CC); - zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("FLAG_PROPAGATE_PHP_EXCEPTIONS"), V8JS_FLAG_PROPAGATE_PHP_EXCEPTIONS TSRMLS_CC); + zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("FLAG_PROPAGATE_PHP_EXCEPTIONS"), V8JS_FLAG_PROPAGATE_PHP_EXCEPTIONS); le_v8js_script = zend_register_list_destructors_ex(v8js_script_dtor, NULL, PHP_V8JS_SCRIPT_RES_NAME, module_number); diff --git a/v8js_convert.cc b/v8js_convert.cc index d181ae7..056e31b 100644 --- a/v8js_convert.cc +++ b/v8js_convert.cc @@ -34,7 +34,7 @@ extern "C" { #include "zend_exceptions.h" } -static int v8js_is_assoc_array(HashTable *myht TSRMLS_DC) /* {{{ */ +static int v8js_is_assoc_array(HashTable *myht) /* {{{ */ { zend_string *key; zend_ulong index, idx = 0; @@ -57,14 +57,14 @@ static int v8js_is_assoc_array(HashTable *myht TSRMLS_DC) /* {{{ */ /* }}} */ -static v8::Local v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ +static v8::Local v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate) /* {{{ */ { HashTable *myht = HASH_OF(value); int i = myht ? zend_hash_num_elements(myht) : 0; /* Return object if dealing with assoc array */ - if (i > 0 && v8js_is_assoc_array(myht TSRMLS_CC)) { - return v8js_hash_to_jsobj(value, isolate TSRMLS_CC); + if (i > 0 && v8js_is_assoc_array(myht)) { + return v8js_hash_to_jsobj(value, isolate); } v8::Local newarr; @@ -89,7 +89,7 @@ static v8::Local v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate ZEND_HASH_INC_APPLY_COUNT(myht); } - newarr->Set(index++, zval_to_v8js(data, isolate TSRMLS_CC)); + newarr->Set(index++, zval_to_v8js(data, isolate)); if (tmp_ht) { ZEND_HASH_DEC_APPLY_COUNT(myht); @@ -127,21 +127,21 @@ v8::Local zval_to_v8js(zval *value, v8::Isolate *isolate) /* {{{ */ break; case IS_ARRAY: - jsValue = v8js_hash_to_jsarr(value, isolate TSRMLS_CC); + jsValue = v8js_hash_to_jsarr(value, isolate); break; case IS_OBJECT: if (V8JSG(use_date)) { ce = php_date_get_date_ce(); - if (instanceof_function(Z_OBJCE_P(value), ce TSRMLS_CC)) { + if (instanceof_function(Z_OBJCE_P(value), ce)) { zval dtval; zend_call_method_with_0_params(value, NULL, NULL, "getTimestamp", &dtval); jsValue = V8JS_DATE(((double)Z_LVAL(dtval) * 1000.0)); zval_dtor(&dtval); } else - jsValue = v8js_hash_to_jsobj(value, isolate TSRMLS_CC); + jsValue = v8js_hash_to_jsobj(value, isolate); } else - jsValue = v8js_hash_to_jsobj(value, isolate TSRMLS_CC); + jsValue = v8js_hash_to_jsobj(value, isolate); break; case IS_STRING: @@ -186,7 +186,7 @@ v8::Local zval_to_v8js(zval *value, v8::Isolate *isolate) /* {{{ */ } /* }}} */ -int v8js_to_zval(v8::Local jsValue, zval *return_value, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ +int v8js_to_zval(v8::Local jsValue, zval *return_value, int flags, v8::Isolate *isolate) /* {{{ */ { if (jsValue->IsString()) { @@ -231,8 +231,8 @@ int v8js_to_zval(v8::Local jsValue, zval *return_value, int flags, v8 } zend_class_entry *ce = php_date_get_date_ce(); - php_date_instantiate(ce, return_value TSRMLS_CC); - if (!php_date_initialize(Z_PHPDATE_P(return_value), date_str, strlen(date_str), NULL, NULL, 0 TSRMLS_CC)) { + php_date_instantiate(ce, return_value); + if (!php_date_initialize(Z_PHPDATE_P(return_value), date_str, strlen(date_str), NULL, NULL, 0)) { efree(date_str); return FAILURE; } @@ -254,9 +254,9 @@ int v8js_to_zval(v8::Local jsValue, zval *return_value, int flags, v8 if ((flags & V8JS_FLAG_FORCE_ARRAY && !jsValue->IsFunction()) || jsValue->IsArray()) { array_init(return_value); - return v8js_get_properties_hash(jsValue, Z_ARRVAL_P(return_value), flags, isolate TSRMLS_CC); + return v8js_get_properties_hash(jsValue, Z_ARRVAL_P(return_value), flags, isolate); } else { - v8js_v8object_create(return_value, jsValue, flags, isolate TSRMLS_CC); + v8js_v8object_create(return_value, jsValue, flags, isolate); return SUCCESS; } } diff --git a/v8js_exceptions.cc b/v8js_exceptions.cc index 6d5a9a8..9e09806 100644 --- a/v8js_exceptions.cc +++ b/v8js_exceptions.cc @@ -37,7 +37,7 @@ zend_class_entry *php_ce_v8js_memory_limit_exception; /* {{{ Class: V8JsScriptException */ -void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8::TryCatch *try_catch TSRMLS_DC) /* {{{ */ +void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8::TryCatch *try_catch) /* {{{ */ { v8::String::Utf8Value exception(try_catch->Exception()); const char *exception_string = ToCString(exception); @@ -49,7 +49,7 @@ void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8:: object_init_ex(return_value, php_ce_v8js_script_exception); #define PHPV8_EXPROP(type, name, value) \ - zend_update_property##type(php_ce_v8js_script_exception, return_value, #name, sizeof(#name) - 1, value TSRMLS_CC); + zend_update_property##type(php_ce_v8js_script_exception, return_value, #name, sizeof(#name) - 1, value); if (tc_message.IsEmpty()) { spprintf(&message_string, 0, "%s", exception_string); @@ -85,7 +85,7 @@ void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8:: zend_object *php_exception = reinterpret_cast(try_catch->Exception()->ToObject()->GetAlignedPointerFromInternalField(1)); zend_class_entry *exception_ce = zend_exception_get_default(TSRMLS_C); - if (instanceof_function(php_exception->ce, exception_ce TSRMLS_CC)) { + if (instanceof_function(php_exception->ce, exception_ce)) { ++GC_REFCOUNT(php_exception); zend_exception_set_previous(Z_OBJ_P(return_value), php_exception); } @@ -98,17 +98,17 @@ void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8:: } /* }}} */ -void v8js_throw_script_exception(v8::Isolate *isolate, v8::TryCatch *try_catch TSRMLS_DC) /* {{{ */ +void v8js_throw_script_exception(v8::Isolate *isolate, v8::TryCatch *try_catch) /* {{{ */ { v8::String::Utf8Value exception(try_catch->Exception()); const char *exception_string = ToCString(exception); zval zexception; if (try_catch->Message().IsEmpty()) { - zend_throw_exception(php_ce_v8js_script_exception, (char *) exception_string, 0 TSRMLS_CC); + zend_throw_exception(php_ce_v8js_script_exception, (char *) exception_string, 0); } else { - v8js_create_script_exception(&zexception, isolate, try_catch TSRMLS_CC); - zend_throw_exception_object(&zexception TSRMLS_CC); + v8js_create_script_exception(&zexception, isolate, try_catch); + zend_throw_exception_object(&zexception); } } /* }}} */ @@ -121,7 +121,7 @@ void v8js_throw_script_exception(v8::Isolate *isolate, v8::TryCatch *try_catch T if (zend_parse_parameters_none() == FAILURE) { \ return; \ } \ - value = zend_read_property(php_ce_v8js_script_exception, getThis(), #property, sizeof(#property) - 1, 0, &rv TSRMLS_CC); \ + value = zend_read_property(php_ce_v8js_script_exception, getThis(), #property, sizeof(#property) - 1, 0, &rv); \ RETURN_ZVAL(value, 1, 0); \ } @@ -213,29 +213,29 @@ PHP_MINIT_FUNCTION(v8js_exceptions) /* {{{ */ /* V8JsException Class */ INIT_CLASS_ENTRY(ce, "V8JsException", v8js_exception_methods); - php_ce_v8js_exception = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException TSRMLS_CC); + php_ce_v8js_exception = zend_register_internal_class_ex(&ce, spl_ce_RuntimeException); /* V8JsScriptException Class */ INIT_CLASS_ENTRY(ce, "V8JsScriptException", v8js_script_exception_methods); - php_ce_v8js_script_exception = zend_register_internal_class_ex(&ce, php_ce_v8js_exception TSRMLS_CC); + php_ce_v8js_script_exception = zend_register_internal_class_ex(&ce, php_ce_v8js_exception); php_ce_v8js_script_exception->ce_flags |= ZEND_ACC_FINAL; /* Add custom JS specific properties */ - zend_declare_property_null(php_ce_v8js_script_exception, ZEND_STRL("JsFileName"), ZEND_ACC_PROTECTED TSRMLS_CC); - zend_declare_property_null(php_ce_v8js_script_exception, ZEND_STRL("JsLineNumber"), ZEND_ACC_PROTECTED TSRMLS_CC); - zend_declare_property_null(php_ce_v8js_script_exception, ZEND_STRL("JsStartColumn"), ZEND_ACC_PROTECTED TSRMLS_CC); - zend_declare_property_null(php_ce_v8js_script_exception, ZEND_STRL("JsEndColumn"), ZEND_ACC_PROTECTED TSRMLS_CC); - zend_declare_property_null(php_ce_v8js_script_exception, ZEND_STRL("JsSourceLine"), ZEND_ACC_PROTECTED TSRMLS_CC); - zend_declare_property_null(php_ce_v8js_script_exception, ZEND_STRL("JsTrace"), ZEND_ACC_PROTECTED TSRMLS_CC); + zend_declare_property_null(php_ce_v8js_script_exception, ZEND_STRL("JsFileName"), ZEND_ACC_PROTECTED); + zend_declare_property_null(php_ce_v8js_script_exception, ZEND_STRL("JsLineNumber"), ZEND_ACC_PROTECTED); + zend_declare_property_null(php_ce_v8js_script_exception, ZEND_STRL("JsStartColumn"), ZEND_ACC_PROTECTED); + zend_declare_property_null(php_ce_v8js_script_exception, ZEND_STRL("JsEndColumn"), ZEND_ACC_PROTECTED); + zend_declare_property_null(php_ce_v8js_script_exception, ZEND_STRL("JsSourceLine"), ZEND_ACC_PROTECTED); + zend_declare_property_null(php_ce_v8js_script_exception, ZEND_STRL("JsTrace"), ZEND_ACC_PROTECTED); /* V8JsTimeLimitException Class */ INIT_CLASS_ENTRY(ce, "V8JsTimeLimitException", v8js_time_limit_exception_methods); - php_ce_v8js_time_limit_exception = zend_register_internal_class_ex(&ce, php_ce_v8js_exception TSRMLS_CC); + php_ce_v8js_time_limit_exception = zend_register_internal_class_ex(&ce, php_ce_v8js_exception); php_ce_v8js_time_limit_exception->ce_flags |= ZEND_ACC_FINAL; /* V8JsMemoryLimitException Class */ INIT_CLASS_ENTRY(ce, "V8JsMemoryLimitException", v8js_memory_limit_exception_methods); - php_ce_v8js_memory_limit_exception = zend_register_internal_class_ex(&ce, php_ce_v8js_exception TSRMLS_CC); + php_ce_v8js_memory_limit_exception = zend_register_internal_class_ex(&ce, php_ce_v8js_exception); php_ce_v8js_memory_limit_exception->ce_flags |= ZEND_ACC_FINAL; return SUCCESS; diff --git a/v8js_exceptions.h b/v8js_exceptions.h index 4669cd7..25a3352 100644 --- a/v8js_exceptions.h +++ b/v8js_exceptions.h @@ -20,8 +20,8 @@ extern zend_class_entry *php_ce_v8js_script_exception; extern zend_class_entry *php_ce_v8js_time_limit_exception; extern zend_class_entry *php_ce_v8js_memory_limit_exception; -void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8::TryCatch *try_catch TSRMLS_DC); -void v8js_throw_script_exception(v8::Isolate *isolate, v8::TryCatch *try_catch TSRMLS_DC); +void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8::TryCatch *try_catch); +void v8js_throw_script_exception(v8::Isolate *isolate, v8::TryCatch *try_catch); PHP_MINIT_FUNCTION(v8js_exceptions); diff --git a/v8js_methods.cc b/v8js_methods.cc index a939d12..9378a39 100644 --- a/v8js_methods.cc +++ b/v8js_methods.cc @@ -55,7 +55,7 @@ V8JS_METHOD(print) /* {{{ */ } /* }}} */ -static void v8js_dumper(v8::Isolate *isolate, v8::Local var, int level TSRMLS_DC) /* {{{ */ +static void v8js_dumper(v8::Isolate *isolate, v8::Local var, int level) /* {{{ */ { if (level > 1) { php_printf("%*c", (level - 1) * 2, ' '); @@ -135,7 +135,7 @@ static void v8js_dumper(v8::Isolate *isolate, v8::Local var, int leve for (unsigned i = 0; i < length; i++) { php_printf("%*c[%d] =>\n", level * 2, ' ', i); - v8js_dumper(isolate, array->Get(i), level + 1 TSRMLS_CC); + v8js_dumper(isolate, array->Get(i), level + 1); } if (level > 1) { @@ -172,7 +172,7 @@ static void v8js_dumper(v8::Isolate *isolate, v8::Local var, int leve v8::Local key = keys->Get(i)->ToString(); v8::String::Utf8Value kname(key); php_printf("%*c[\"%s\"] =>\n", level * 2, ' ', ToCString(kname)); - v8js_dumper(isolate, object->Get(key), level + 1 TSRMLS_CC); + v8js_dumper(isolate, object->Get(key), level + 1); } } @@ -196,7 +196,7 @@ V8JS_METHOD(var_dump) /* {{{ */ V8JS_TSRMLS_FETCH(); for (int i = 0; i < info.Length(); i++) { - v8js_dumper(isolate, info[i], 1 TSRMLS_CC); + v8js_dumper(isolate, info[i], 1); } info.GetReturnValue().Set(V8JS_NULL); @@ -244,7 +244,7 @@ V8JS_METHOD(require) ZVAL_STRING(¶ms[1], module_id); call_result = call_user_function_ex(EG(function_table), NULL, &c->module_normaliser, - &normaliser_result, 2, params, 0, NULL TSRMLS_CC); + &normaliser_result, 2, params, 0, NULL); } isolate->Enter(); @@ -360,7 +360,7 @@ V8JS_METHOD(require) zend_try { 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); } zend_catch { v8js_terminate_execution(isolate); diff --git a/v8js_object_export.cc b/v8js_object_export.cc index 5cac0bb..ffc4602 100644 --- a/v8js_object_export.cc +++ b/v8js_object_export.cc @@ -35,7 +35,7 @@ extern "C" { static void v8js_weak_object_callback(const v8::WeakCallbackInfo &data); /* Callback for PHP methods and functions */ -static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, v8::Isolate *isolate, const v8::FunctionCallbackInfo& info TSRMLS_DC) /* {{{ */ +static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, v8::Isolate *isolate, const v8::FunctionCallbackInfo& info) /* {{{ */ { v8::Local return_value = V8JS_NULL; zend_fcall_info fci; @@ -106,7 +106,7 @@ static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, v ZVAL_OBJ(&fci.params[i], object); Z_ADDREF_P(&fci.params[i]); } else { - if (v8js_to_zval(info[i], &fci.params[i], ctx->flags, isolate TSRMLS_CC) == FAILURE) { + if (v8js_to_zval(info[i], &fci.params[i], ctx->flags, isolate) == FAILURE) { error_len = spprintf(&error, 0, "converting parameter #%d passed to %s() failed", i + 1, method_ptr->common.function_name); if (error_len > std::numeric_limits::max()) { @@ -143,7 +143,7 @@ static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, v fcc.called_scope = object->ce; fcc.object = object; - zend_call_function(&fci, &fcc TSRMLS_CC); + zend_call_function(&fci, &fcc); } zend_catch { v8js_terminate_execution(isolate); @@ -166,7 +166,7 @@ failure: if(ctx->flags & V8JS_FLAG_PROPAGATE_PHP_EXCEPTIONS) { zval tmp_zv; ZVAL_OBJ(&tmp_zv, EG(exception)); - return_value = isolate->ThrowException(zval_to_v8js(&tmp_zv, isolate TSRMLS_CC)); + return_value = isolate->ThrowException(zval_to_v8js(&tmp_zv, isolate)); zend_clear_exception(TSRMLS_C); } else { v8js_terminate_execution(isolate); @@ -175,7 +175,7 @@ failure: // special case: "return $this" return_value = info.Holder(); } else { - return_value = zval_to_v8js(&retval, isolate TSRMLS_CC); + return_value = zval_to_v8js(&retval, isolate); } zval_ptr_dtor(&retval); @@ -199,10 +199,10 @@ void v8js_php_callback(const v8::FunctionCallbackInfo& info) /* {{{ * if (!info.Data().IsEmpty() && info.Data()->IsExternal()) { method_ptr = static_cast(v8::External::Cast(*info.Data())->Value()); } else { - method_ptr = zend_get_closure_invoke_method(object TSRMLS_CC); + method_ptr = zend_get_closure_invoke_method(object); } - return v8js_call_php_func(object, method_ptr, isolate, info TSRMLS_CC); + return v8js_call_php_func(object, method_ptr, isolate, info); } /* Callback for PHP constructor calls */ @@ -257,7 +257,7 @@ static void v8js_construct_callback(const v8::FunctionCallbackInfo& i // Call __construct function if (ctor_ptr != NULL) { - v8js_call_php_func(Z_OBJ(value), ctor_ptr, isolate, info TSRMLS_CC); + v8js_call_php_func(Z_OBJ(value), ctor_ptr, isolate, info); } } @@ -438,7 +438,7 @@ static void v8js_invoke_callback(const v8::FunctionCallbackInfo& info v8::Local str = self->GetConstructorName()->ToString(); v8::String::Utf8Value str_value(str); zend_string *constructor_name = zend_string_init(ToCString(str_value), str->Utf8Length(), 0); - zend_class_entry *ce = zend_lookup_class(constructor_name TSRMLS_CC); + zend_class_entry *ce = zend_lookup_class(constructor_name); zend_string_release(constructor_name); v8::Local new_tpl; @@ -535,7 +535,7 @@ static void v8js_fake_call_impl(const v8::FunctionCallbackInfo& info) // okay, look up the method name and manually invoke it. const zend_object_handlers *h = object->handlers; - zend_function *method_ptr = h->get_method(&object, method_name, NULL TSRMLS_CC); + zend_function *method_ptr = h->get_method(&object, method_name, NULL); zend_string_release(method_name); if (method_ptr == NULL || @@ -687,12 +687,12 @@ v8::Local v8js_named_property_callback(v8::Local property if (callback_type == V8JS_PROP_GETTER) { /* Nope, not a method -- must be a (case-sensitive) property */ - zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1 TSRMLS_CC); + zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1); if(!property_info || (property_info != ZEND_WRONG_PROPERTY_INFO && property_info->flags & ZEND_ACC_PUBLIC)) { - zval *property_val = zend_read_property(NULL, &zobject, name, name_len, true, &php_value TSRMLS_CC); + zval *property_val = zend_read_property(NULL, &zobject, name, name_len, true, &php_value); // special case uninitialized_zval_ptr and return an empty value // (indicating that we don't intercept this property) if the // property doesn't exist. @@ -700,7 +700,7 @@ v8::Local v8js_named_property_callback(v8::Local property ret_value = v8::Local(); } else { // wrap it - ret_value = zval_to_v8js(property_val, isolate TSRMLS_CC); + ret_value = zval_to_v8js(property_val, isolate); /* We don't own the reference to php_value... unless the * returned refcount was 0, in which case the below code * will free it. */ @@ -713,21 +713,21 @@ v8::Local v8js_named_property_callback(v8::Local property && ((ce->__get->common.fn_flags & ZEND_ACC_PUBLIC) != 0)) { /* Okay, let's call __get. */ zend_call_method_with_1_params(&zobject, ce, &ce->__get, ZEND_GET_FUNC_NAME, &php_value, &zname); - ret_value = zval_to_v8js(&php_value, isolate TSRMLS_CC); + ret_value = zval_to_v8js(&php_value, isolate); zval_ptr_dtor(&php_value); } } else if (callback_type == V8JS_PROP_SETTER) { - if (v8js_to_zval(set_value, &php_value, ctx->flags, isolate TSRMLS_CC) != SUCCESS) { + if (v8js_to_zval(set_value, &php_value, ctx->flags, isolate) != SUCCESS) { ret_value = v8::Local(); } else { - zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1 TSRMLS_CC); + zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1); if(!property_info || (property_info != ZEND_WRONG_PROPERTY_INFO && property_info->flags & ZEND_ACC_PUBLIC)) { - zend_update_property(scope, &zobject, name, name_len, &php_value TSRMLS_CC); + zend_update_property(scope, &zobject, name, name_len, &php_value); ret_value = set_value; } else if (ce->__set @@ -736,7 +736,7 @@ v8::Local v8js_named_property_callback(v8::Local property /* Okay, let's call __set. */ zval php_ret_value; zend_call_method_with_2_params(&zobject, ce, &ce->__set, ZEND_SET_FUNC_NAME, &php_ret_value, &zname, &php_value); - ret_value = zval_to_v8js(&php_ret_value, isolate TSRMLS_CC); + ret_value = zval_to_v8js(&php_ret_value, isolate); zval_ptr_dtor(&php_ret_value); } } @@ -749,18 +749,18 @@ v8::Local v8js_named_property_callback(v8::Local property const zend_object_handlers *h = object->handlers; if (callback_type == V8JS_PROP_QUERY) { - if (h->has_property(&zobject, &zname, 0, NULL TSRMLS_CC)) { + if (h->has_property(&zobject, &zname, 0, NULL)) { ret_value = V8JS_UINT(v8::None); } else { ret_value = v8::Local(); // empty handle } } else { - zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1 TSRMLS_CC); + zend_property_info *property_info = zend_get_property_info(ce, Z_STR(zname), 1); if(!property_info || (property_info != ZEND_WRONG_PROPERTY_INFO && property_info->flags & ZEND_ACC_PUBLIC)) { - h->unset_property(&zobject, &zname, NULL TSRMLS_CC); + h->unset_property(&zobject, &zname, NULL); ret_value = V8JS_TRUE(); } else { @@ -813,7 +813,7 @@ static void v8js_named_property_deleter(v8::Local property, const v8 -static v8::Local v8js_wrap_object(v8::Isolate *isolate, zend_class_entry *ce, zval *value TSRMLS_DC) /* {{{ */ +static v8::Local v8js_wrap_object(v8::Isolate *isolate, zend_class_entry *ce, zval *value) /* {{{ */ { v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0); v8::Local new_tpl; @@ -925,7 +925,7 @@ static v8::Local v8js_wrap_object(v8::Isolate *isolate, zend_class_e /* }}} */ -static v8::Local v8js_wrap_array_to_object(v8::Isolate *isolate, zval *value TSRMLS_DC) /* {{{ */ +static v8::Local v8js_wrap_array_to_object(v8::Isolate *isolate, zval *value) /* {{{ */ { int i; zend_string *key; @@ -1003,7 +1003,7 @@ static v8::Local v8js_wrap_array_to_object(v8::Isolate *isolate, zva /* }}} */ -v8::Local v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ +v8::Local v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate) /* {{{ */ { HashTable *myht; zend_class_entry *ce = NULL; @@ -1025,7 +1025,7 @@ v8::Local v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS v8js_v8object *c = Z_V8JS_V8OBJECT_OBJ_P(value); if(isolate != c->ctx->isolate) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "V8Function object passed to wrong V8Js instance"); + php_error_docref(NULL, E_WARNING, "V8Function object passed to wrong V8Js instance"); return V8JS_NULL; } @@ -1034,7 +1034,7 @@ v8::Local v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS /* If it's a PHP object, wrap it */ if (ce) { - v8::Local wrapped_object = v8js_wrap_object(isolate, ce, value TSRMLS_CC); + v8::Local wrapped_object = v8js_wrap_object(isolate, ce, value); if (ce == zend_ce_generator) { /* Wrap PHP Generator object in a wrapper function that provides @@ -1047,7 +1047,7 @@ v8::Local v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS /* Associative PHP arrays cannot be wrapped to JS arrays, convert them to * JS objects and attach all their array keys as properties. */ - return v8js_wrap_array_to_object(isolate, value TSRMLS_CC); + return v8js_wrap_array_to_object(isolate, value); } /* }}} */ diff --git a/v8js_object_export.h b/v8js_object_export.h index bf5be2c..fda29a7 100644 --- a/v8js_object_export.h +++ b/v8js_object_export.h @@ -14,7 +14,7 @@ #ifndef V8JS_OBJECT_EXPORT_H #define V8JS_OBJECT_EXPORT_H -v8::Local v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS_DC); +v8::Local v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate); typedef enum { diff --git a/v8js_timer.cc b/v8js_timer.cc index f600d8b..ba2d8e1 100644 --- a/v8js_timer.cc +++ b/v8js_timer.cc @@ -124,7 +124,7 @@ void v8js_timer_thread(zend_v8js_globals *globals) /* {{{ */ /* }}} */ -void v8js_timer_push(long time_limit, long memory_limit, v8js_ctx *c TSRMLS_DC) /* {{{ */ +void v8js_timer_push(long time_limit, long memory_limit, v8js_ctx *c) /* {{{ */ { V8JSG(timer_mutex).lock(); diff --git a/v8js_timer.h b/v8js_timer.h index 6167176..7cf3e6e 100644 --- a/v8js_timer.h +++ b/v8js_timer.h @@ -25,7 +25,7 @@ struct v8js_timer_ctx }; void v8js_timer_thread(zend_v8js_globals *globals); -void v8js_timer_push(long time_limit, long memory_limit, v8js_ctx *c TSRMLS_DC); +void v8js_timer_push(long time_limit, long memory_limit, v8js_ctx *c); #endif /* V8JS_TIMER_H */ diff --git a/v8js_v8.cc b/v8js_v8.cc index 8ef473d..6b5faa8 100644 --- a/v8js_v8.cc +++ b/v8js_v8.cc @@ -96,7 +96,7 @@ void v8js_v8_init(TSRMLS_D) /* {{{ */ */ void v8js_v8_call(v8js_ctx *c, zval **return_value, long flags, long time_limit, long memory_limit, - std::function< v8::Local(v8::Isolate *) >& v8_call TSRMLS_DC) /* {{{ */ + std::function< v8::Local(v8::Isolate *) >& v8_call) /* {{{ */ { char *tz = NULL; @@ -138,7 +138,7 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value, /* Always pass the timer to the stack so there can be follow-up changes to * the time & memory limit. */ - v8js_timer_push(time_limit, memory_limit, c TSRMLS_CC); + v8js_timer_push(time_limit, memory_limit, c); /* Execute script */ c->in_execution++; @@ -163,7 +163,7 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value, if (c->time_limit_hit) { // Execution has been terminated due to time limit sprintf(exception_string, "Script time limit of %lu milliseconds exceeded", time_limit); - zend_throw_exception(php_ce_v8js_time_limit_exception, exception_string, 0 TSRMLS_CC); + zend_throw_exception(php_ce_v8js_time_limit_exception, exception_string, 0); return; } @@ -185,7 +185,7 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value, if (c->memory_limit_hit) { // Execution has been terminated due to memory limit sprintf(exception_string, "Script memory limit of %lu bytes exceeded", memory_limit); - zend_throw_exception(php_ce_v8js_memory_limit_exception, exception_string, 0 TSRMLS_CC); + zend_throw_exception(php_ce_v8js_memory_limit_exception, exception_string, 0); return; } @@ -196,7 +196,7 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value, /* There was pending exception left from earlier executions -> throw to PHP */ if (Z_TYPE(c->pending_exception) == IS_OBJECT) { - zend_throw_exception_object(&c->pending_exception TSRMLS_CC); + zend_throw_exception_object(&c->pending_exception); ZVAL_NULL(&c->pending_exception); } @@ -208,13 +208,13 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value, /* Report immediately if report_uncaught is true */ if (c->report_uncaught) { - v8js_throw_script_exception(c->isolate, &try_catch TSRMLS_CC); + v8js_throw_script_exception(c->isolate, &try_catch); return; } /* Exception thrown from JS, preserve it for future execution */ if (result.IsEmpty()) { - v8js_create_script_exception(&c->pending_exception, c->isolate, &try_catch TSRMLS_CC); + v8js_create_script_exception(&c->pending_exception, c->isolate, &try_catch); return; } } @@ -226,7 +226,7 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value, /* Convert V8 value to PHP value */ if (return_value && !result.IsEmpty()) { - v8js_to_zval(result, *return_value, flags, c->isolate TSRMLS_CC); + v8js_to_zval(result, *return_value, flags, c->isolate); } } } @@ -258,7 +258,7 @@ void v8js_terminate_execution(v8::Isolate *isolate) /* {{{ */ /* }}} */ -int v8js_get_properties_hash(v8::Local jsValue, HashTable *retval, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ +int v8js_get_properties_hash(v8::Local jsValue, HashTable *retval, int flags, v8::Isolate *isolate) /* {{{ */ { v8::Local jsObj = jsValue->ToObject(); @@ -288,7 +288,7 @@ int v8js_get_properties_hash(v8::Local jsValue, HashTable *retval, in Z_ADDREF_P(&value); } else { - if (v8js_to_zval(jsVal, &value, flags, isolate TSRMLS_CC) == FAILURE) { + if (v8js_to_zval(jsVal, &value, flags, isolate) == FAILURE) { zval_ptr_dtor(&value); return FAILURE; } diff --git a/v8js_v8.h b/v8js_v8.h index 310ea93..b4896fe 100644 --- a/v8js_v8.h +++ b/v8js_v8.h @@ -54,11 +54,11 @@ static inline const char * ToCString(const v8::String::Utf8Value &value) /* {{{ void v8js_v8_init(TSRMLS_D); void v8js_v8_call(v8js_ctx *c, zval **return_value, long flags, long time_limit, long memory_limit, - std::function< v8::Local(v8::Isolate *) >& v8_call TSRMLS_DC); + std::function< v8::Local(v8::Isolate *) >& v8_call); void v8js_terminate_execution(v8::Isolate *isolate); /* Fetch V8 object properties */ -int v8js_get_properties_hash(v8::Local jsValue, HashTable *retval, int flags, v8::Isolate *isolate TSRMLS_DC); +int v8js_get_properties_hash(v8::Local jsValue, HashTable *retval, int flags, v8::Isolate *isolate); #define V8JS_CTX_PROLOGUE_EX(ctx, ret) \ if (!V8JSG(v8_initialized)) { \ diff --git a/v8js_v8object_class.cc b/v8js_v8object_class.cc index fbeb101..8814bc8 100644 --- a/v8js_v8object_class.cc +++ b/v8js_v8object_class.cc @@ -46,7 +46,7 @@ static zend_object_handlers v8js_v8generator_handlers; /* V8 Object handlers */ -static int v8js_v8object_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot TSRMLS_DC) /* {{{ */ +static int v8js_v8object_has_property(zval *object, zval *member, int has_set_exists, void **cache_slot) /* {{{ */ { /* param has_set_exists: * 0 (has) whether property exists and is not NULL - isset() @@ -58,7 +58,7 @@ static int v8js_v8object_has_property(zval *object, zval *member, int has_set_ex if (!obj->ctx) { zend_throw_exception(php_ce_v8js_exception, - "Can't access V8Object after V8Js instance is destroyed!", 0 TSRMLS_CC); + "Can't access V8Object after V8Js instance is destroyed!", 0); return retval; } @@ -115,14 +115,14 @@ static int v8js_v8object_has_property(zval *object, zval *member, int has_set_ex } /* }}} */ -static zval *v8js_v8object_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv TSRMLS_DC) /* {{{ */ +static zval *v8js_v8object_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */ { zval *retval = rv; v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ_P(object); if (!obj->ctx) { zend_throw_exception(php_ce_v8js_exception, - "Can't access V8Object after V8Js instance is destroyed!", 0 TSRMLS_CC); + "Can't access V8Object after V8Js instance is destroyed!", 0); return retval; } @@ -145,7 +145,7 @@ static zval *v8js_v8object_read_property(zval *object, zval *member, int type, v if (jsObj->HasRealNamedProperty(jsKey) || jsObj->HasRealNamedCallbackProperty(jsKey)) { jsVal = jsObj->Get(jsKey); - if (v8js_to_zval(jsVal, retval, obj->flags, isolate TSRMLS_CC) == SUCCESS) { + if (v8js_to_zval(jsVal, retval, obj->flags, isolate) == SUCCESS) { return retval; } } @@ -155,13 +155,13 @@ static zval *v8js_v8object_read_property(zval *object, zval *member, int type, v } /* }}} */ -static void v8js_v8object_write_property(zval *object, zval *member, zval *value, void **cache_slot TSRMLS_DC) /* {{{ */ +static void v8js_v8object_write_property(zval *object, zval *member, zval *value, void **cache_slot ) /* {{{ */ { v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ_P(object); if (!obj->ctx) { zend_throw_exception(php_ce_v8js_exception, - "Can't access V8Object after V8Js instance is destroyed!", 0 TSRMLS_CC); + "Can't access V8Object after V8Js instance is destroyed!", 0); return; } @@ -180,13 +180,13 @@ static void v8js_v8object_write_property(zval *object, zval *member, zval *value } /* }}} */ -static void v8js_v8object_unset_property(zval *object, zval *member, void **cache_slot TSRMLS_DC) /* {{{ */ +static void v8js_v8object_unset_property(zval *object, zval *member, void **cache_slot) /* {{{ */ { v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ_P(object); if (!obj->ctx) { zend_throw_exception(php_ce_v8js_exception, - "Can't access V8Object after V8Js instance is destroyed!", 0 TSRMLS_CC); + "Can't access V8Object after V8Js instance is destroyed!", 0); return; } @@ -205,7 +205,7 @@ static void v8js_v8object_unset_property(zval *object, zval *member, void **cach } /* }}} */ -static HashTable *v8js_v8object_get_properties(zval *object TSRMLS_DC) /* {{{ */ +static HashTable *v8js_v8object_get_properties(zval *object) /* {{{ */ { v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ_P(object); @@ -230,14 +230,14 @@ static HashTable *v8js_v8object_get_properties(zval *object TSRMLS_DC) /* {{{ */ if (!obj->ctx) { zend_throw_exception(php_ce_v8js_exception, - "Can't access V8Object after V8Js instance is destroyed!", 0 TSRMLS_CC); + "Can't access V8Object after V8Js instance is destroyed!", 0); return NULL; } V8JS_CTX_PROLOGUE_EX(obj->ctx, NULL); v8::Local v8obj = v8::Local::New(isolate, obj->v8obj); - if (v8js_get_properties_hash(v8obj, obj->properties, obj->flags, isolate TSRMLS_CC) == SUCCESS) { + if (v8js_get_properties_hash(v8obj, obj->properties, obj->flags, isolate) == SUCCESS) { return obj->properties; } @@ -245,21 +245,21 @@ static HashTable *v8js_v8object_get_properties(zval *object TSRMLS_DC) /* {{{ */ } /* }}} */ -static HashTable *v8js_v8object_get_debug_info(zval *object, int *is_temp TSRMLS_DC) /* {{{ */ +static HashTable *v8js_v8object_get_debug_info(zval *object, int *is_temp) /* {{{ */ { *is_temp = 0; - return v8js_v8object_get_properties(object TSRMLS_CC); + return v8js_v8object_get_properties(object); } /* }}} */ -static zend_function *v8js_v8object_get_method(zend_object **object_ptr, zend_string *method, const zval *key TSRMLS_DC) /* {{{ */ +static zend_function *v8js_v8object_get_method(zend_object **object_ptr, zend_string *method, const zval *key) /* {{{ */ { v8js_v8object *obj = v8js_v8object_fetch_object(*object_ptr); zend_function *f; if (!obj->ctx) { zend_throw_exception(php_ce_v8js_exception, - "Can't access V8Object after V8Js instance is destroyed!", 0 TSRMLS_CC); + "Can't access V8Object after V8Js instance is destroyed!", 0); return NULL; } @@ -297,7 +297,7 @@ static int v8js_v8object_call_method(zend_string *method, zend_object *object, I if (!obj->ctx) { zend_throw_exception(php_ce_v8js_exception, - "Can't access V8Object after V8Js instance is destroyed!", 0 TSRMLS_CC); + "Can't access V8Object after V8Js instance is destroyed!", 0); return FAILURE; } @@ -319,7 +319,7 @@ static int v8js_v8object_call_method(zend_string *method, zend_object *object, I /* std::function relies on its dtor to be executed, otherwise it leaks * some memory on bailout. */ { - std::function< v8::Local(v8::Isolate *) > v8_call = [obj, method, argc, argv, object, &return_value TSRMLS_CC](v8::Isolate *isolate) { + std::function< v8::Local(v8::Isolate *) > v8_call = [obj, method, argc, argv, object, &return_value](v8::Isolate *isolate) { int i = 0; v8::Local method_name = V8JS_SYML(ZSTR_VAL(method), static_cast(ZSTR_LEN(method))); @@ -346,7 +346,7 @@ static int v8js_v8object_call_method(zend_string *method, zend_object *object, I for (i = 0; i < argc; i++) { new(&jsArgv[i]) v8::Local; - jsArgv[i] = v8::Local::New(isolate, zval_to_v8js(&argv[i], isolate TSRMLS_CC)); + jsArgv[i] = v8::Local::New(isolate, zval_to_v8js(&argv[i], isolate)); } v8::Local result = cb->Call(thisObj, argc, jsArgv); @@ -361,7 +361,7 @@ static int v8js_v8object_call_method(zend_string *method, zend_object *object, I return result; }; - v8js_v8_call(obj->ctx, &return_value, obj->flags, obj->ctx->time_limit, obj->ctx->memory_limit, v8_call TSRMLS_CC); + v8js_v8_call(obj->ctx, &return_value, obj->flags, obj->ctx->time_limit, obj->ctx->memory_limit, v8_call); } if (argc > 0) { @@ -378,14 +378,14 @@ static int v8js_v8object_call_method(zend_string *method, zend_object *object, I } /* }}} */ -static int v8js_v8object_get_closure(zval *object, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **zobj_ptr TSRMLS_DC) /* {{{ */ +static int v8js_v8object_get_closure(zval *object, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **zobj_ptr) /* {{{ */ { zend_function *invoke; v8js_v8object *obj = Z_V8JS_V8OBJECT_OBJ_P(object); if (!obj->ctx) { zend_throw_exception(php_ce_v8js_exception, - "Can't access V8Object after V8Js instance is destroyed!", 0 TSRMLS_CC); + "Can't access V8Object after V8Js instance is destroyed!", 0); return FAILURE; } @@ -412,7 +412,7 @@ static int v8js_v8object_get_closure(zval *object, zend_class_entry **ce_ptr, ze } /* }}} */ -static void v8js_v8object_free_storage(zend_object *object TSRMLS_DC) /* {{{ */ +static void v8js_v8object_free_storage(zend_object *object) /* {{{ */ { v8js_v8object *c = v8js_v8object_fetch_object(object); @@ -422,7 +422,7 @@ static void v8js_v8object_free_storage(zend_object *object TSRMLS_DC) /* {{{ */ c->properties = NULL; } - zend_object_std_dtor(&c->std TSRMLS_CC); + zend_object_std_dtor(&c->std); if(c->ctx) { c->v8obj.Reset(); @@ -431,12 +431,12 @@ static void v8js_v8object_free_storage(zend_object *object TSRMLS_DC) /* {{{ */ } /* }}} */ -static zend_object *v8js_v8object_new(zend_class_entry *ce TSRMLS_DC) /* {{{ */ +static zend_object *v8js_v8object_new(zend_class_entry *ce) /* {{{ */ { v8js_v8object *c; c = (v8js_v8object *) ecalloc(1, sizeof(v8js_v8object) + zend_object_properties_size(ce)); - zend_object_std_init(&c->std, ce TSRMLS_CC); + zend_object_std_init(&c->std, ce); c->std.handlers = &v8js_v8object_handlers; new(&c->v8obj) v8::Persistent(); @@ -454,7 +454,7 @@ static zend_object *v8js_v8object_new(zend_class_entry *ce TSRMLS_DC) /* {{{ */ PHP_METHOD(V8Object,__construct) { zend_throw_exception(php_ce_v8js_exception, - "Can't directly construct V8 objects!", 0 TSRMLS_CC); + "Can't directly construct V8 objects!", 0); RETURN_FALSE; } /* }}} */ @@ -464,7 +464,7 @@ PHP_METHOD(V8Object,__construct) PHP_METHOD(V8Object, __sleep) { zend_throw_exception(php_ce_v8js_exception, - "You cannot serialize or unserialize V8Object instances", 0 TSRMLS_CC); + "You cannot serialize or unserialize V8Object instances", 0); RETURN_FALSE; } /* }}} */ @@ -474,7 +474,7 @@ PHP_METHOD(V8Object, __sleep) PHP_METHOD(V8Object, __wakeup) { zend_throw_exception(php_ce_v8js_exception, - "You cannot serialize or unserialize V8Object instances", 0 TSRMLS_CC); + "You cannot serialize or unserialize V8Object instances", 0); RETURN_FALSE; } /* }}} */ @@ -484,7 +484,7 @@ PHP_METHOD(V8Object, __wakeup) PHP_METHOD(V8Function,__construct) { zend_throw_exception(php_ce_v8js_exception, - "Can't directly construct V8 objects!", 0 TSRMLS_CC); + "Can't directly construct V8 objects!", 0); RETURN_FALSE; } /* }}} */ @@ -494,7 +494,7 @@ PHP_METHOD(V8Function,__construct) PHP_METHOD(V8Function, __sleep) { zend_throw_exception(php_ce_v8js_exception, - "You cannot serialize or unserialize V8Function instances", 0 TSRMLS_CC); + "You cannot serialize or unserialize V8Function instances", 0); RETURN_FALSE; } /* }}} */ @@ -504,7 +504,7 @@ PHP_METHOD(V8Function, __sleep) PHP_METHOD(V8Function, __wakeup) { zend_throw_exception(php_ce_v8js_exception, - "You cannot serialize or unserialize V8Function instances", 0 TSRMLS_CC); + "You cannot serialize or unserialize V8Function instances", 0); RETURN_FALSE; } /* }}} */ @@ -601,7 +601,7 @@ static zend_function *v8js_v8generator_get_method(zend_object **object_ptr, zend PHP_METHOD(V8Generator,__construct) { zend_throw_exception(php_ce_v8js_exception, - "Can't directly construct V8 objects!", 0 TSRMLS_CC); + "Can't directly construct V8 objects!", 0); RETURN_FALSE; } /* }}} */ @@ -611,7 +611,7 @@ PHP_METHOD(V8Generator,__construct) PHP_METHOD(V8Generator, __sleep) { zend_throw_exception(php_ce_v8js_exception, - "You cannot serialize or unserialize V8Generator instances", 0 TSRMLS_CC); + "You cannot serialize or unserialize V8Generator instances", 0); RETURN_FALSE; } /* }}} */ @@ -621,7 +621,7 @@ PHP_METHOD(V8Generator, __sleep) PHP_METHOD(V8Generator, __wakeup) { zend_throw_exception(php_ce_v8js_exception, - "You cannot serialize or unserialize V8Generator instances", 0 TSRMLS_CC); + "You cannot serialize or unserialize V8Generator instances", 0); RETURN_FALSE; } /* }}} */ @@ -665,7 +665,7 @@ PHP_METHOD(V8Generator, rewind) if(g->primed) { zend_throw_exception(php_ce_v8js_exception, - "V8Generator::rewind not supported by ES6", 0 TSRMLS_CC); + "V8Generator::rewind not supported by ES6", 0); } @@ -688,7 +688,7 @@ PHP_METHOD(V8Generator, valid) /* }}} */ -void v8js_v8object_create(zval *res, v8::Local value, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ +void v8js_v8object_create(zval *res, v8::Local value, int flags, v8::Isolate *isolate) /* {{{ */ { v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0); @@ -766,19 +766,19 @@ PHP_MINIT_FUNCTION(v8js_v8object_class) /* {{{ */ /* V8Object Class */ INIT_CLASS_ENTRY(ce, "V8Object", v8js_v8object_methods); - php_ce_v8object = zend_register_internal_class(&ce TSRMLS_CC); + php_ce_v8object = zend_register_internal_class(&ce); php_ce_v8object->ce_flags |= ZEND_ACC_FINAL; php_ce_v8object->create_object = v8js_v8object_new; /* V8Function Class */ INIT_CLASS_ENTRY(ce, "V8Function", v8js_v8function_methods); - php_ce_v8function = zend_register_internal_class(&ce TSRMLS_CC); + php_ce_v8function = zend_register_internal_class(&ce); php_ce_v8function->ce_flags |= ZEND_ACC_FINAL; php_ce_v8function->create_object = v8js_v8object_new; /* V8Generator Class */ INIT_CLASS_ENTRY(ce, "V8Generator", v8js_v8generator_methods); - php_ce_v8generator = zend_register_internal_class(&ce TSRMLS_CC); + php_ce_v8generator = zend_register_internal_class(&ce); php_ce_v8generator->ce_flags |= ZEND_ACC_FINAL; php_ce_v8generator->create_object = v8js_v8generator_new; diff --git a/v8js_v8object_class.h b/v8js_v8object_class.h index 7bf0877..b342bd6 100644 --- a/v8js_v8object_class.h +++ b/v8js_v8object_class.h @@ -28,7 +28,7 @@ extern zend_class_entry *php_ce_v8object; extern zend_class_entry *php_ce_v8function; /* Create PHP V8 object */ -void v8js_v8object_create(zval *, v8::Local, int, v8::Isolate * TSRMLS_DC); +void v8js_v8object_create(zval *, v8::Local, int, v8::Isolate *); static inline v8js_v8object *v8js_v8object_fetch_object(zend_object *obj) { return (v8js_v8object *)((char *)obj - XtOffsetOf(struct v8js_v8object, std)); diff --git a/v8js_variables.cc b/v8js_variables.cc index 246af07..edd2f75 100644 --- a/v8js_variables.cc +++ b/v8js_variables.cc @@ -34,23 +34,23 @@ static void v8js_fetch_php_variable(v8::Local name, const v8::Proper V8JS_TSRMLS_FETCH(); - zend_is_auto_global(ctx->variable_name TSRMLS_CC); + zend_is_auto_global(ctx->variable_name); if ((variable = zend_hash_find(&EG(symbol_table), ctx->variable_name))) { - info.GetReturnValue().Set(zval_to_v8js(variable, isolate TSRMLS_CC)); + info.GetReturnValue().Set(zval_to_v8js(variable, isolate)); return; } } /* }}} */ -void v8js_accessor_ctx_dtor(v8js_accessor_ctx *ctx TSRMLS_DC) /* {{{ */ +void v8js_accessor_ctx_dtor(v8js_accessor_ctx *ctx) /* {{{ */ { zend_string_release(ctx->variable_name); efree(ctx); } /* }}} */ -void v8js_register_accessors(std::vector *accessor_list, v8::Local php_obj_t, zval *array, v8::Isolate *isolate TSRMLS_DC) /* {{{ */ +void v8js_register_accessors(std::vector *accessor_list, v8::Local php_obj_t, zval *array, v8::Isolate *isolate) /* {{{ */ { zend_string *property_name; zval *item; From 3e8ef5f6841a3c340951c33d51e01fe6879db783 Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Sat, 11 Mar 2017 13:43:30 +0100 Subject: [PATCH 3/4] remove V8JS_TSRMLS_FETCH --- v8js_array_access.cc | 12 ------------ v8js_class.cc | 1 - v8js_class.h | 10 ---------- v8js_methods.cc | 2 -- v8js_object_export.cc | 7 ------- v8js_variables.cc | 2 -- 6 files changed, 34 deletions(-) diff --git a/v8js_array_access.cc b/v8js_array_access.cc index ea8beb4..cabba33 100644 --- a/v8js_array_access.cc +++ b/v8js_array_access.cc @@ -65,8 +65,6 @@ void v8js_array_access_getter(uint32_t index, const v8::PropertyCallbackInfo self = info.Holder(); - V8JS_TSRMLS_FETCH(); - zend_object *object = reinterpret_cast(self->GetAlignedPointerFromInternalField(1)); zval zvalue; @@ -86,8 +84,6 @@ void v8js_array_access_setter(uint32_t index, v8::Local value, v8::Isolate *isolate = info.GetIsolate(); v8::Local self = info.Holder(); - V8JS_TSRMLS_FETCH(); - zend_object *object = reinterpret_cast(self->GetAlignedPointerFromInternalField(1)); zval zvalue; @@ -160,8 +156,6 @@ static void v8js_array_access_length(v8::Local property, const v8::P v8::Isolate *isolate = info.GetIsolate(); v8::Local self = info.Holder(); - V8JS_TSRMLS_FETCH(); - zend_object *object = reinterpret_cast(self->GetAlignedPointerFromInternalField(1)); int length = v8js_array_access_get_count_result(object); @@ -174,8 +168,6 @@ void v8js_array_access_deleter(uint32_t index, const v8::PropertyCallbackInfo self = info.Holder(); - V8JS_TSRMLS_FETCH(); - zend_object *object = reinterpret_cast(self->GetAlignedPointerFromInternalField(1)); zval zvalue; @@ -193,8 +185,6 @@ void v8js_array_access_query(uint32_t index, const v8::PropertyCallbackInfo self = info.Holder(); - V8JS_TSRMLS_FETCH(); - zend_object *object = reinterpret_cast(self->GetAlignedPointerFromInternalField(1)); /* If index is set, then return an integer encoding a v8::PropertyAttribute; @@ -211,8 +201,6 @@ void v8js_array_access_enumerator(const v8::PropertyCallbackInfo& inf v8::Isolate *isolate = info.GetIsolate(); v8::Local self = info.Holder(); - V8JS_TSRMLS_FETCH(); - zend_object *object = reinterpret_cast(self->GetAlignedPointerFromInternalField(1)); int length = v8js_array_access_get_count_result(object); diff --git a/v8js_class.cc b/v8js_class.cc index e073b66..84730e1 100644 --- a/v8js_class.cc +++ b/v8js_class.cc @@ -213,7 +213,6 @@ static zend_object* v8js_new(zend_class_entry *ce) /* {{{ */ object_properties_init(&c->std, ce); c->std.handlers = &v8js_object_handlers; - TSRMLS_SET_CTX(c->zts_ctx); new(&c->object_name) v8::Persistent(); new(&c->context) v8::Persistent(); diff --git a/v8js_class.h b/v8js_class.h index 46ec8d5..40c647c 100644 --- a/v8js_class.h +++ b/v8js_class.h @@ -74,20 +74,10 @@ struct v8js_ctx { zval zval_snapshot_blob; v8::StartupData snapshot_blob; -#ifdef ZTS - void ***zts_ctx; -#endif - zend_object std; }; /* }}} */ -#ifdef ZTS -# define V8JS_TSRMLS_FETCH() TSRMLS_FETCH_FROM_CTX(((v8js_ctx *) isolate->GetData(0))->zts_ctx); -#else -# define V8JS_TSRMLS_FETCH() -#endif - static inline struct v8js_ctx *v8js_ctx_fetch_object(zend_object *obj) { return (struct v8js_ctx *)((char *)obj - XtOffsetOf(struct v8js_ctx, std)); } diff --git a/v8js_methods.cc b/v8js_methods.cc index 9378a39..5b73954 100644 --- a/v8js_methods.cc +++ b/v8js_methods.cc @@ -193,7 +193,6 @@ static void v8js_dumper(v8::Isolate *isolate, v8::Local var, int leve V8JS_METHOD(var_dump) /* {{{ */ { v8::Isolate *isolate = info.GetIsolate(); - V8JS_TSRMLS_FETCH(); for (int i = 0; i < info.Length(); i++) { v8js_dumper(isolate, info[i], 1); @@ -206,7 +205,6 @@ V8JS_METHOD(var_dump) /* {{{ */ V8JS_METHOD(require) { v8::Isolate *isolate = info.GetIsolate(); - V8JS_TSRMLS_FETCH(); // Get the extension context v8::Local data = v8::Local::Cast(info.Data()); diff --git a/v8js_object_export.cc b/v8js_object_export.cc index ffc4602..9d3b4ee 100644 --- a/v8js_object_export.cc +++ b/v8js_object_export.cc @@ -191,7 +191,6 @@ void v8js_php_callback(const v8::FunctionCallbackInfo& info) /* {{{ * v8::Isolate *isolate = info.GetIsolate(); v8::Local self = info.Holder(); - V8JS_TSRMLS_FETCH(); zend_object *object = reinterpret_cast(self->GetAlignedPointerFromInternalField(1)); zend_function *method_ptr; @@ -243,7 +242,6 @@ static void v8js_construct_callback(const v8::FunctionCallbackInfo& i Z_ADDREF_P(&value); } else { // Object created from JavaScript context. Need to create PHP object first. - V8JS_TSRMLS_FETCH(); zend_class_entry *ce = static_cast(ext_ce->Value()); zend_function *ctor_ptr = ce->constructor; @@ -322,7 +320,6 @@ static void v8js_named_property_enumerator(const v8::PropertyCallbackInfo result = v8::Array::New(isolate, 0); uint32_t result_len = 0; - V8JS_TSRMLS_FETCH(); zend_class_entry *ce; void *ptr; HashTable *proptable; @@ -425,8 +422,6 @@ static void v8js_invoke_callback(const v8::FunctionCallbackInfo& info v8::Local *argv = static_cast *>(alloca(sizeof(v8::Local) * argc)); v8::Local result; - V8JS_TSRMLS_FETCH(); - for (i=0; i; argv[i] = info[i]; @@ -465,7 +460,6 @@ static void v8js_fake_call_impl(const v8::FunctionCallbackInfo& info) char *error; size_t error_len; - V8JS_TSRMLS_FETCH(); zend_class_entry *ce; zend_object *object = reinterpret_cast(self->GetAlignedPointerFromInternalField(1)); ce = object->ce; @@ -590,7 +584,6 @@ v8::Local v8js_named_property_callback(v8::Local property v8::Local ret_value; v8::Local cb; - V8JS_TSRMLS_FETCH(); zend_class_entry *scope, *ce; zend_function *method_ptr = NULL; zval php_value; diff --git a/v8js_variables.cc b/v8js_variables.cc index edd2f75..5d6d9d8 100644 --- a/v8js_variables.cc +++ b/v8js_variables.cc @@ -32,8 +32,6 @@ static void v8js_fetch_php_variable(v8::Local name, const v8::Proper v8::Isolate *isolate = ctx->isolate; zval *variable; - V8JS_TSRMLS_FETCH(); - zend_is_auto_global(ctx->variable_name); if ((variable = zend_hash_find(&EG(symbol_table), ctx->variable_name))) { From 745126b5cbeceaa4bbc429e9d6d3ffe02f1909fe Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Sat, 11 Mar 2017 13:45:23 +0100 Subject: [PATCH 4/4] remove left-over TSRM stuff --- v8js_class.cc | 10 +++++----- v8js_exceptions.cc | 2 +- v8js_methods.cc | 4 ++-- v8js_object_export.cc | 2 +- v8js_v8.cc | 2 +- v8js_v8.h | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/v8js_class.cc b/v8js_class.cc index 84730e1..8ad260d 100644 --- a/v8js_class.cc +++ b/v8js_class.cc @@ -344,7 +344,7 @@ static PHP_METHOD(V8Js, __construct) } /* Initialize V8 */ - v8js_v8_init(TSRMLS_C); + v8js_v8_init(); /* Throw PHP exception if uncaught exceptions exist */ c->report_uncaught = report_uncaught; @@ -1130,7 +1130,7 @@ static PHP_METHOD(V8Js, createSnapshot) } /* Initialize V8, if not already done. */ - v8js_v8_init(TSRMLS_C); + v8js_v8_init(); v8::StartupData snapshot_blob = v8::V8::CreateSnapshotDataBlob(ZSTR_VAL(script)); @@ -1320,10 +1320,10 @@ PHP_MINIT_FUNCTION(v8js_class) /* {{{ */ v8js_object_handlers.unset_property = v8js_unset_property; /* V8Js Class Constants */ - zend_declare_class_constant_string(php_ce_v8js, ZEND_STRL("V8_VERSION"), PHP_V8_VERSION TSRMLS_CC); + zend_declare_class_constant_string(php_ce_v8js, ZEND_STRL("V8_VERSION"), PHP_V8_VERSION); - zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("FLAG_NONE"), V8JS_FLAG_NONE TSRMLS_CC); - zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("FLAG_FORCE_ARRAY"), V8JS_FLAG_FORCE_ARRAY TSRMLS_CC); + zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("FLAG_NONE"), V8JS_FLAG_NONE); + zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("FLAG_FORCE_ARRAY"), V8JS_FLAG_FORCE_ARRAY); zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("FLAG_PROPAGATE_PHP_EXCEPTIONS"), V8JS_FLAG_PROPAGATE_PHP_EXCEPTIONS); le_v8js_script = zend_register_list_destructors_ex(v8js_script_dtor, NULL, PHP_V8JS_SCRIPT_RES_NAME, module_number); diff --git a/v8js_exceptions.cc b/v8js_exceptions.cc index 9e09806..1e77dcd 100644 --- a/v8js_exceptions.cc +++ b/v8js_exceptions.cc @@ -84,7 +84,7 @@ void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8:: if(try_catch->Exception()->IsObject() && try_catch->Exception()->ToObject()->InternalFieldCount() == 2) { zend_object *php_exception = reinterpret_cast(try_catch->Exception()->ToObject()->GetAlignedPointerFromInternalField(1)); - zend_class_entry *exception_ce = zend_exception_get_default(TSRMLS_C); + zend_class_entry *exception_ce = zend_exception_get_default(); if (instanceof_function(php_exception->ce, exception_ce)) { ++GC_REFCOUNT(php_exception); zend_exception_set_previous(Z_OBJ_P(return_value), php_exception); diff --git a/v8js_methods.cc b/v8js_methods.cc index 5b73954..f22aa18 100644 --- a/v8js_methods.cc +++ b/v8js_methods.cc @@ -268,7 +268,7 @@ V8JS_METHOD(require) // Check if an exception was thrown if (EG(exception)) { // Clear the PHP exception and throw it in V8 instead - zend_clear_exception(TSRMLS_C); + zend_clear_exception(); info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Module normaliser callback exception"))); return; } @@ -390,7 +390,7 @@ V8JS_METHOD(require) efree(normalised_path); // Clear the PHP exception and throw it in V8 instead - zend_clear_exception(TSRMLS_C); + zend_clear_exception(); info.GetReturnValue().Set(isolate->ThrowException(V8JS_SYM("Module loader callback exception"))); return; } diff --git a/v8js_object_export.cc b/v8js_object_export.cc index 9d3b4ee..cdf75d4 100644 --- a/v8js_object_export.cc +++ b/v8js_object_export.cc @@ -167,7 +167,7 @@ failure: zval tmp_zv; ZVAL_OBJ(&tmp_zv, EG(exception)); return_value = isolate->ThrowException(zval_to_v8js(&tmp_zv, isolate)); - zend_clear_exception(TSRMLS_C); + zend_clear_exception(); } else { v8js_terminate_execution(isolate); } diff --git a/v8js_v8.cc b/v8js_v8.cc index 6b5faa8..9f6293d 100644 --- a/v8js_v8.cc +++ b/v8js_v8.cc @@ -32,7 +32,7 @@ extern "C" { #include -void v8js_v8_init(TSRMLS_D) /* {{{ */ +void v8js_v8_init() /* {{{ */ { /* Run only once; thread-local test first */ if (V8JSG(v8_initialized)) { diff --git a/v8js_v8.h b/v8js_v8.h index b4896fe..d60b6ad 100644 --- a/v8js_v8.h +++ b/v8js_v8.h @@ -51,7 +51,7 @@ static inline const char * ToCString(const v8::String::Utf8Value &value) /* {{{ -void v8js_v8_init(TSRMLS_D); +void v8js_v8_init(); void v8js_v8_call(v8js_ctx *c, zval **return_value, long flags, long time_limit, long memory_limit, std::function< v8::Local(v8::Isolate *) >& v8_call);