Skip to content

Commit 880d0b2

Browse files
authored
Merge pull request #297 from stesie/remove-tsrm-fluff
Remove TSRM fluff
2 parents cbe865c + 745126b commit 880d0b2

17 files changed

+226
-260
lines changed

php_v8js_macros.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,24 @@ extern "C" {
7979

8080

8181
/* Convert zval into V8 value */
82-
v8::Handle<v8::Value> zval_to_v8js(zval *, v8::Isolate *);
82+
v8::Local<v8::Value> zval_to_v8js(zval *, v8::Isolate *);
8383

8484
/* Convert zend_long into V8 value */
85-
v8::Handle<v8::Value> zend_long_to_v8js(zend_long, v8::Isolate *);
85+
v8::Local<v8::Value> zend_long_to_v8js(zend_long, v8::Isolate *);
8686

8787
/* Convert V8 value into zval */
88-
int v8js_to_zval(v8::Handle<v8::Value>, zval *, int, v8::Isolate * TSRMLS_DC);
88+
int v8js_to_zval(v8::Local<v8::Value>, zval *, int, v8::Isolate *);
8989

9090
struct v8js_accessor_ctx
9191
{
9292
zend_string *variable_name;
9393
v8::Isolate *isolate;
9494
};
9595

96-
void v8js_accessor_ctx_dtor(v8js_accessor_ctx * TSRMLS_DC);
96+
void v8js_accessor_ctx_dtor(v8js_accessor_ctx *);
9797

9898
/* Register accessors into passed object */
99-
void v8js_register_accessors(std::vector<v8js_accessor_ctx*> *accessor_list, v8::Local<v8::FunctionTemplate>, zval *, v8::Isolate * TSRMLS_DC);
99+
void v8js_register_accessors(std::vector<v8js_accessor_ctx*> *accessor_list, v8::Local<v8::FunctionTemplate>, zval *, v8::Isolate *);
100100

101101

102102
/* Forward declarations */
@@ -159,7 +159,7 @@ struct _v8js_process_globals {
159159
extern struct _v8js_process_globals v8js_process_globals;
160160

161161
/* Register builtin methods into passed object */
162-
void v8js_register_methods(v8::Handle<v8::ObjectTemplate>, v8js_ctx *c);
162+
void v8js_register_methods(v8::Local<v8::ObjectTemplate>, v8js_ctx *c);
163163

164164
#endif /* PHP_V8JS_MACROS_H */
165165

v8js_array_access.cc

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern "C" {
2929
}
3030

3131
static zval v8js_array_access_dispatch(zend_object *object, const char *method_name, int param_count,
32-
uint32_t index, zval zvalue TSRMLS_DC) /* {{{ */
32+
uint32_t index, zval zvalue) /* {{{ */
3333
{
3434
zend_fcall_info fci;
3535
zval php_value;
@@ -52,7 +52,7 @@ static zval v8js_array_access_dispatch(zend_object *object, const char *method_n
5252
fci.object = object;
5353
fci.no_separation = 0;
5454

55-
zend_call_function(&fci, NULL TSRMLS_CC);
55+
zend_call_function(&fci, NULL);
5656
zval_dtor(&fci.function_name);
5757
return php_value;
5858
}
@@ -65,15 +65,13 @@ void v8js_array_access_getter(uint32_t index, const v8::PropertyCallbackInfo<v8:
6565
v8::Isolate *isolate = info.GetIsolate();
6666
v8::Local<v8::Object> self = info.Holder();
6767

68-
V8JS_TSRMLS_FETCH();
69-
7068
zend_object *object = reinterpret_cast<zend_object *>(self->GetAlignedPointerFromInternalField(1));
7169

7270
zval zvalue;
7371
ZVAL_UNDEF(&zvalue);
7472

75-
zval php_value = v8js_array_access_dispatch(object, "offsetGet", 1, index, zvalue TSRMLS_CC);
76-
v8::Local<v8::Value> ret_value = zval_to_v8js(&php_value, isolate TSRMLS_CC);
73+
zval php_value = v8js_array_access_dispatch(object, "offsetGet", 1, index, zvalue);
74+
v8::Local<v8::Value> ret_value = zval_to_v8js(&php_value, isolate);
7775
zval_ptr_dtor(&php_value);
7876

7977
info.GetReturnValue().Set(ret_value);
@@ -86,19 +84,17 @@ void v8js_array_access_setter(uint32_t index, v8::Local<v8::Value> value,
8684
v8::Isolate *isolate = info.GetIsolate();
8785
v8::Local<v8::Object> self = info.Holder();
8886

89-
V8JS_TSRMLS_FETCH();
90-
9187
zend_object *object = reinterpret_cast<zend_object *>(self->GetAlignedPointerFromInternalField(1));
9288

9389
zval zvalue;
9490
ZVAL_UNDEF(&zvalue);
9591

96-
if (v8js_to_zval(value, &zvalue, 0, isolate TSRMLS_CC) != SUCCESS) {
97-
info.GetReturnValue().Set(v8::Handle<v8::Value>());
92+
if (v8js_to_zval(value, &zvalue, 0, isolate) != SUCCESS) {
93+
info.GetReturnValue().Set(v8::Local<v8::Value>());
9894
return;
9995
}
10096

101-
zval php_value = v8js_array_access_dispatch(object, "offsetSet", 2, index, zvalue TSRMLS_CC);
97+
zval php_value = v8js_array_access_dispatch(object, "offsetSet", 2, index, zvalue);
10298
zval_ptr_dtor(&php_value);
10399

104100
/* simply pass back the value to tell we intercepted the call
@@ -112,15 +108,15 @@ void v8js_array_access_setter(uint32_t index, v8::Local<v8::Value> value,
112108
/* }}} */
113109

114110

115-
static int v8js_array_access_get_count_result(zend_object *object TSRMLS_DC) /* {{{ */
111+
static int v8js_array_access_get_count_result(zend_object *object) /* {{{ */
116112
{
117113
zval zvalue;
118114
ZVAL_UNDEF(&zvalue);
119115

120-
zval php_value = v8js_array_access_dispatch(object, "count", 0, 0, zvalue TSRMLS_CC);
116+
zval php_value = v8js_array_access_dispatch(object, "count", 0, 0, zvalue);
121117

122118
if(Z_TYPE(php_value) != IS_LONG) {
123-
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Non-numeric return value from count() method");
119+
php_error_docref(NULL, E_WARNING, "Non-numeric return value from count() method");
124120
zval_ptr_dtor(&php_value);
125121
return 0;
126122
}
@@ -137,15 +133,15 @@ static int v8js_array_access_get_count_result(zend_object *object TSRMLS_DC) /*
137133
}
138134
/* }}} */
139135

140-
static bool v8js_array_access_isset_p(zend_object *object, int index TSRMLS_DC) /* {{{ */
136+
static bool v8js_array_access_isset_p(zend_object *object, int index) /* {{{ */
141137
{
142138
zval zvalue;
143139
ZVAL_UNDEF(&zvalue);
144140

145-
zval php_value = v8js_array_access_dispatch(object, "offsetExists", 1, index, zvalue TSRMLS_CC);
141+
zval php_value = v8js_array_access_dispatch(object, "offsetExists", 1, index, zvalue);
146142

147143
if(Z_TYPE(php_value) != IS_TRUE && Z_TYPE(php_value) != IS_FALSE) {
148-
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Non-boolean return value from offsetExists() method");
144+
php_error_docref(NULL, E_WARNING, "Non-boolean return value from offsetExists() method");
149145
zval_ptr_dtor(&php_value);
150146
return false;
151147
}
@@ -160,11 +156,9 @@ static void v8js_array_access_length(v8::Local<v8::String> property, const v8::P
160156
v8::Isolate *isolate = info.GetIsolate();
161157
v8::Local<v8::Object> self = info.Holder();
162158

163-
V8JS_TSRMLS_FETCH();
164-
165159
zend_object *object = reinterpret_cast<zend_object *>(self->GetAlignedPointerFromInternalField(1));
166160

167-
int length = v8js_array_access_get_count_result(object TSRMLS_CC);
161+
int length = v8js_array_access_get_count_result(object);
168162
info.GetReturnValue().Set(V8JS_INT(length));
169163
}
170164
/* }}} */
@@ -174,14 +168,12 @@ void v8js_array_access_deleter(uint32_t index, const v8::PropertyCallbackInfo<v8
174168
v8::Isolate *isolate = info.GetIsolate();
175169
v8::Local<v8::Object> self = info.Holder();
176170

177-
V8JS_TSRMLS_FETCH();
178-
179171
zend_object *object = reinterpret_cast<zend_object *>(self->GetAlignedPointerFromInternalField(1));
180172

181173
zval zvalue;
182174
ZVAL_UNDEF(&zvalue);
183175

184-
zval php_value = v8js_array_access_dispatch(object, "offsetUnset", 1, index, zvalue TSRMLS_CC);
176+
zval php_value = v8js_array_access_dispatch(object, "offsetUnset", 1, index, zvalue);
185177
zval_ptr_dtor(&php_value);
186178

187179
info.GetReturnValue().Set(V8JS_BOOL(true));
@@ -193,13 +185,11 @@ void v8js_array_access_query(uint32_t index, const v8::PropertyCallbackInfo<v8::
193185
v8::Isolate *isolate = info.GetIsolate();
194186
v8::Local<v8::Object> self = info.Holder();
195187

196-
V8JS_TSRMLS_FETCH();
197-
198188
zend_object *object = reinterpret_cast<zend_object *>(self->GetAlignedPointerFromInternalField(1));
199189

200190
/* If index is set, then return an integer encoding a v8::PropertyAttribute;
201191
* otherwise we're expected to return an empty handle. */
202-
if(v8js_array_access_isset_p(object, index TSRMLS_CC)) {
192+
if(v8js_array_access_isset_p(object, index)) {
203193
info.GetReturnValue().Set(V8JS_UINT(v8::PropertyAttribute::None));
204194
}
205195
}
@@ -211,17 +201,15 @@ void v8js_array_access_enumerator(const v8::PropertyCallbackInfo<v8::Array>& inf
211201
v8::Isolate *isolate = info.GetIsolate();
212202
v8::Local<v8::Object> self = info.Holder();
213203

214-
V8JS_TSRMLS_FETCH();
215-
216204
zend_object *object = reinterpret_cast<zend_object *>(self->GetAlignedPointerFromInternalField(1));
217205

218-
int length = v8js_array_access_get_count_result(object TSRMLS_CC);
206+
int length = v8js_array_access_get_count_result(object);
219207
v8::Local<v8::Array> result = v8::Array::New(isolate, length);
220208

221209
int i = 0;
222210

223211
for(int j = 0; j < length; j ++) {
224-
if(v8js_array_access_isset_p(object, j TSRMLS_CC)) {
212+
if(v8js_array_access_isset_p(object, j)) {
225213
result->Set(i ++, V8JS_INT(j));
226214
}
227215
}

0 commit comments

Comments
 (0)