mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-09 16:28:41 +00:00
v8::Handle -> v8::Local
This commit is contained in:
parent
cbe865c116
commit
d97832d9fb
@ -79,13 +79,13 @@ extern "C" {
|
|||||||
|
|
||||||
|
|
||||||
/* Convert zval into V8 value */
|
/* Convert zval into V8 value */
|
||||||
v8::Handle<v8::Value> zval_to_v8js(zval *, v8::Isolate *);
|
v8::Local<v8::Value> zval_to_v8js(zval *, v8::Isolate *);
|
||||||
|
|
||||||
/* Convert zend_long into V8 value */
|
/* Convert zend_long into V8 value */
|
||||||
v8::Handle<v8::Value> zend_long_to_v8js(zend_long, v8::Isolate *);
|
v8::Local<v8::Value> zend_long_to_v8js(zend_long, v8::Isolate *);
|
||||||
|
|
||||||
/* Convert V8 value into zval */
|
/* Convert V8 value into zval */
|
||||||
int v8js_to_zval(v8::Handle<v8::Value>, zval *, int, v8::Isolate * TSRMLS_DC);
|
int v8js_to_zval(v8::Local<v8::Value>, zval *, int, v8::Isolate * TSRMLS_DC);
|
||||||
|
|
||||||
struct v8js_accessor_ctx
|
struct v8js_accessor_ctx
|
||||||
{
|
{
|
||||||
@ -159,7 +159,7 @@ struct _v8js_process_globals {
|
|||||||
extern struct _v8js_process_globals v8js_process_globals;
|
extern struct _v8js_process_globals v8js_process_globals;
|
||||||
|
|
||||||
/* Register builtin methods into passed object */
|
/* Register builtin methods into passed object */
|
||||||
void v8js_register_methods(v8::Handle<v8::ObjectTemplate>, v8js_ctx *c);
|
void v8js_register_methods(v8::Local<v8::ObjectTemplate>, v8js_ctx *c);
|
||||||
|
|
||||||
#endif /* PHP_V8JS_MACROS_H */
|
#endif /* PHP_V8JS_MACROS_H */
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ void v8js_array_access_setter(uint32_t index, v8::Local<v8::Value> value,
|
|||||||
ZVAL_UNDEF(&zvalue);
|
ZVAL_UNDEF(&zvalue);
|
||||||
|
|
||||||
if (v8js_to_zval(value, &zvalue, 0, isolate TSRMLS_CC) != SUCCESS) {
|
if (v8js_to_zval(value, &zvalue, 0, isolate TSRMLS_CC) != SUCCESS) {
|
||||||
info.GetReturnValue().Set(v8::Handle<v8::Value>());
|
info.GetReturnValue().Set(v8::Local<v8::Value>());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ static int v8js_is_assoc_array(HashTable *myht TSRMLS_DC) /* {{{ */
|
|||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
static v8::Handle<v8::Value> v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
|
static v8::Local<v8::Value> v8js_hash_to_jsarr(zval *value, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
HashTable *myht = HASH_OF(value);
|
HashTable *myht = HASH_OF(value);
|
||||||
int i = myht ? zend_hash_num_elements(myht) : 0;
|
int i = myht ? zend_hash_num_elements(myht) : 0;
|
||||||
@ -100,7 +100,7 @@ static v8::Handle<v8::Value> v8js_hash_to_jsarr(zval *value, v8::Isolate *isolat
|
|||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
v8::Handle<v8::Value> zend_long_to_v8js(zend_long v, v8::Isolate *isolate) /* {{{ */
|
v8::Local<v8::Value> zend_long_to_v8js(zend_long v, v8::Isolate *isolate) /* {{{ */
|
||||||
{
|
{
|
||||||
if (v < - std::numeric_limits<int32_t>::min() || v > std::numeric_limits<int32_t>::max()) {
|
if (v < - std::numeric_limits<int32_t>::min() || v > std::numeric_limits<int32_t>::max()) {
|
||||||
return V8JS_FLOAT(static_cast<double>(v));
|
return V8JS_FLOAT(static_cast<double>(v));
|
||||||
@ -110,9 +110,9 @@ v8::Handle<v8::Value> zend_long_to_v8js(zend_long v, v8::Isolate *isolate) /* {{
|
|||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
v8::Handle<v8::Value> zval_to_v8js(zval *value, v8::Isolate *isolate) /* {{{ */
|
v8::Local<v8::Value> zval_to_v8js(zval *value, v8::Isolate *isolate) /* {{{ */
|
||||||
{
|
{
|
||||||
v8::Handle<v8::Value> jsValue;
|
v8::Local<v8::Value> jsValue;
|
||||||
zend_string *value_str;
|
zend_string *value_str;
|
||||||
zend_class_entry *ce;
|
zend_class_entry *ce;
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ v8::Handle<v8::Value> zval_to_v8js(zval *value, v8::Isolate *isolate) /* {{{ */
|
|||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
int v8js_to_zval(v8::Handle<v8::Value> jsValue, zval *return_value, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
|
int v8js_to_zval(v8::Local<v8::Value> jsValue, zval *return_value, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
if (jsValue->IsString())
|
if (jsValue->IsString())
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ void v8js_create_script_exception(zval *return_value, v8::Isolate *isolate, v8::
|
|||||||
{
|
{
|
||||||
v8::String::Utf8Value exception(try_catch->Exception());
|
v8::String::Utf8Value exception(try_catch->Exception());
|
||||||
const char *exception_string = ToCString(exception);
|
const char *exception_string = ToCString(exception);
|
||||||
v8::Handle<v8::Message> tc_message = try_catch->Message();
|
v8::Local<v8::Message> tc_message = try_catch->Message();
|
||||||
const char *filename_string, *sourceline_string;
|
const char *filename_string, *sourceline_string;
|
||||||
char *message_string;
|
char *message_string;
|
||||||
int linenum, start_col, end_col;
|
int linenum, start_col, end_col;
|
||||||
|
@ -502,7 +502,7 @@ V8JS_METHOD(require)
|
|||||||
info.GetReturnValue().Set(newobj);
|
info.GetReturnValue().Set(newobj);
|
||||||
}
|
}
|
||||||
|
|
||||||
void v8js_register_methods(v8::Handle<v8::ObjectTemplate> global, v8js_ctx *c) /* {{{ */
|
void v8js_register_methods(v8::Local<v8::ObjectTemplate> global, v8js_ctx *c) /* {{{ */
|
||||||
{
|
{
|
||||||
v8::Isolate *isolate = c->isolate;
|
v8::Isolate *isolate = c->isolate;
|
||||||
global->Set(V8JS_SYM("exit"), v8::FunctionTemplate::New(isolate, V8JS_MN(exit)), v8::ReadOnly);
|
global->Set(V8JS_SYM("exit"), v8::FunctionTemplate::New(isolate, V8JS_MN(exit)), v8::ReadOnly);
|
||||||
|
@ -37,7 +37,7 @@ static void v8js_weak_object_callback(const v8::WeakCallbackInfo<zend_object> &d
|
|||||||
/* Callback for PHP methods and functions */
|
/* 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<v8::Value>& info TSRMLS_DC) /* {{{ */
|
static void v8js_call_php_func(zend_object *object, zend_function *method_ptr, v8::Isolate *isolate, const v8::FunctionCallbackInfo<v8::Value>& info TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
v8::Handle<v8::Value> return_value = V8JS_NULL;
|
v8::Local<v8::Value> return_value = V8JS_NULL;
|
||||||
zend_fcall_info fci;
|
zend_fcall_info fci;
|
||||||
zend_fcall_info_cache fcc;
|
zend_fcall_info_cache fcc;
|
||||||
zval fname, retval;
|
zval fname, retval;
|
||||||
@ -211,7 +211,7 @@ static void v8js_construct_callback(const v8::FunctionCallbackInfo<v8::Value>& i
|
|||||||
v8::Isolate *isolate = info.GetIsolate();
|
v8::Isolate *isolate = info.GetIsolate();
|
||||||
info.GetReturnValue().Set(V8JS_UNDEFINED);
|
info.GetReturnValue().Set(V8JS_UNDEFINED);
|
||||||
|
|
||||||
v8::Handle<v8::Object> newobj = info.This();
|
v8::Local<v8::Object> newobj = info.This();
|
||||||
zval value;
|
zval value;
|
||||||
|
|
||||||
if (!info.IsConstructCall()) {
|
if (!info.IsConstructCall()) {
|
||||||
@ -460,7 +460,7 @@ static void v8js_fake_call_impl(const v8::FunctionCallbackInfo<v8::Value>& info)
|
|||||||
{
|
{
|
||||||
v8::Isolate *isolate = info.GetIsolate();
|
v8::Isolate *isolate = info.GetIsolate();
|
||||||
v8::Local<v8::Object> self = info.Holder();
|
v8::Local<v8::Object> self = info.Holder();
|
||||||
v8::Handle<v8::Value> return_value = V8JS_NULL;
|
v8::Local<v8::Value> return_value = V8JS_NULL;
|
||||||
|
|
||||||
char *error;
|
char *error;
|
||||||
size_t error_len;
|
size_t error_len;
|
||||||
@ -674,7 +674,7 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::String> property
|
|||||||
ret_value = V8JS_BOOL(false);
|
ret_value = V8JS_BOOL(false);
|
||||||
} else {
|
} else {
|
||||||
/* shouldn't reach here! but bail safely */
|
/* shouldn't reach here! but bail safely */
|
||||||
ret_value = v8::Handle<v8::Value>();
|
ret_value = v8::Local<v8::Value>();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (name[0]=='$') {
|
if (name[0]=='$') {
|
||||||
@ -697,7 +697,7 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::String> property
|
|||||||
// (indicating that we don't intercept this property) if the
|
// (indicating that we don't intercept this property) if the
|
||||||
// property doesn't exist.
|
// property doesn't exist.
|
||||||
if (property_val == &EG(uninitialized_zval)) {
|
if (property_val == &EG(uninitialized_zval)) {
|
||||||
ret_value = v8::Handle<v8::Value>();
|
ret_value = v8::Local<v8::Value>();
|
||||||
} else {
|
} else {
|
||||||
// wrap it
|
// wrap it
|
||||||
ret_value = zval_to_v8js(property_val, isolate TSRMLS_CC);
|
ret_value = zval_to_v8js(property_val, isolate TSRMLS_CC);
|
||||||
@ -719,7 +719,7 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::String> property
|
|||||||
|
|
||||||
} else if (callback_type == V8JS_PROP_SETTER) {
|
} 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 TSRMLS_CC) != SUCCESS) {
|
||||||
ret_value = v8::Handle<v8::Value>();
|
ret_value = v8::Local<v8::Value>();
|
||||||
}
|
}
|
||||||
else {
|
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 TSRMLS_CC);
|
||||||
@ -752,7 +752,7 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::String> property
|
|||||||
if (h->has_property(&zobject, &zname, 0, NULL TSRMLS_CC)) {
|
if (h->has_property(&zobject, &zname, 0, NULL TSRMLS_CC)) {
|
||||||
ret_value = V8JS_UINT(v8::None);
|
ret_value = V8JS_UINT(v8::None);
|
||||||
} else {
|
} else {
|
||||||
ret_value = v8::Handle<v8::Value>(); // empty handle
|
ret_value = v8::Local<v8::Value>(); // empty handle
|
||||||
}
|
}
|
||||||
} else {
|
} 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 TSRMLS_CC);
|
||||||
@ -764,12 +764,12 @@ v8::Local<v8::Value> v8js_named_property_callback(v8::Local<v8::String> property
|
|||||||
ret_value = V8JS_TRUE();
|
ret_value = V8JS_TRUE();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ret_value = v8::Handle<v8::Value>(); // empty handle
|
ret_value = v8::Local<v8::Value>(); // empty handle
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* shouldn't reach here! but bail safely */
|
/* shouldn't reach here! but bail safely */
|
||||||
ret_value = v8::Handle<v8::Value>();
|
ret_value = v8::Local<v8::Value>();
|
||||||
}
|
}
|
||||||
|
|
||||||
zval_ptr_dtor(&zname);
|
zval_ptr_dtor(&zname);
|
||||||
@ -813,7 +813,7 @@ static void v8js_named_property_deleter(v8::Local<v8::String> property, const v8
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static v8::Handle<v8::Object> v8js_wrap_object(v8::Isolate *isolate, zend_class_entry *ce, zval *value TSRMLS_DC) /* {{{ */
|
static v8::Local<v8::Object> v8js_wrap_object(v8::Isolate *isolate, zend_class_entry *ce, zval *value TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
|
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
|
||||||
v8::Local<v8::FunctionTemplate> new_tpl;
|
v8::Local<v8::FunctionTemplate> new_tpl;
|
||||||
@ -911,8 +911,8 @@ static v8::Handle<v8::Object> v8js_wrap_object(v8::Isolate *isolate, zend_class_
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create v8 wrapper object
|
// Create v8 wrapper object
|
||||||
v8::Handle<v8::Value> external = v8::External::New(isolate, Z_OBJ_P(value));
|
v8::Local<v8::Value> external = v8::External::New(isolate, Z_OBJ_P(value));
|
||||||
v8::Handle<v8::Object> newobj = new_tpl->GetFunction()->NewInstance(1, &external);
|
v8::Local<v8::Object> newobj = new_tpl->GetFunction()->NewInstance(1, &external);
|
||||||
|
|
||||||
if (ce == zend_ce_closure) {
|
if (ce == zend_ce_closure) {
|
||||||
// free uncached function template when object is freed
|
// free uncached function template when object is freed
|
||||||
@ -925,7 +925,7 @@ static v8::Handle<v8::Object> v8js_wrap_object(v8::Isolate *isolate, zend_class_
|
|||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
static v8::Handle<v8::Object> v8js_wrap_array_to_object(v8::Isolate *isolate, zval *value TSRMLS_DC) /* {{{ */
|
static v8::Local<v8::Object> v8js_wrap_array_to_object(v8::Isolate *isolate, zval *value TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
zend_string *key;
|
zend_string *key;
|
||||||
@ -948,7 +948,7 @@ static v8::Handle<v8::Object> v8js_wrap_array_to_object(v8::Isolate *isolate, zv
|
|||||||
new_tpl = v8::Local<v8::FunctionTemplate>::New(isolate, ctx->array_tmpl);
|
new_tpl = v8::Local<v8::FunctionTemplate>::New(isolate, ctx->array_tmpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
v8::Handle<v8::Object> newobj = new_tpl->InstanceTemplate()->NewInstance();
|
v8::Local<v8::Object> newobj = new_tpl->InstanceTemplate()->NewInstance();
|
||||||
|
|
||||||
HashTable *myht = HASH_OF(value);
|
HashTable *myht = HASH_OF(value);
|
||||||
i = myht ? zend_hash_num_elements(myht) : 0;
|
i = myht ? zend_hash_num_elements(myht) : 0;
|
||||||
@ -1003,7 +1003,7 @@ static v8::Handle<v8::Object> v8js_wrap_array_to_object(v8::Isolate *isolate, zv
|
|||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
v8::Handle<v8::Value> v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
|
v8::Local<v8::Value> v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
HashTable *myht;
|
HashTable *myht;
|
||||||
zend_class_entry *ce = NULL;
|
zend_class_entry *ce = NULL;
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#ifndef V8JS_OBJECT_EXPORT_H
|
#ifndef V8JS_OBJECT_EXPORT_H
|
||||||
#define V8JS_OBJECT_EXPORT_H
|
#define V8JS_OBJECT_EXPORT_H
|
||||||
|
|
||||||
v8::Handle<v8::Value> v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS_DC);
|
v8::Local<v8::Value> v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRMLS_DC);
|
||||||
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -258,7 +258,7 @@ void v8js_terminate_execution(v8::Isolate *isolate) /* {{{ */
|
|||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
int v8js_get_properties_hash(v8::Handle<v8::Value> jsValue, HashTable *retval, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
|
int v8js_get_properties_hash(v8::Local<v8::Value> jsValue, HashTable *retval, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
v8::Local<v8::Object> jsObj = jsValue->ToObject();
|
v8::Local<v8::Object> jsObj = jsValue->ToObject();
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ void v8js_v8_call(v8js_ctx *c, zval **return_value,
|
|||||||
void v8js_terminate_execution(v8::Isolate *isolate);
|
void v8js_terminate_execution(v8::Isolate *isolate);
|
||||||
|
|
||||||
/* Fetch V8 object properties */
|
/* Fetch V8 object properties */
|
||||||
int v8js_get_properties_hash(v8::Handle<v8::Value> jsValue, HashTable *retval, int flags, v8::Isolate *isolate TSRMLS_DC);
|
int v8js_get_properties_hash(v8::Local<v8::Value> jsValue, HashTable *retval, int flags, v8::Isolate *isolate TSRMLS_DC);
|
||||||
|
|
||||||
#define V8JS_CTX_PROLOGUE_EX(ctx, ret) \
|
#define V8JS_CTX_PROLOGUE_EX(ctx, ret) \
|
||||||
if (!V8JSG(v8_initialized)) { \
|
if (!V8JSG(v8_initialized)) { \
|
||||||
|
@ -688,7 +688,7 @@ PHP_METHOD(V8Generator, valid)
|
|||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
|
||||||
void v8js_v8object_create(zval *res, v8::Handle<v8::Value> value, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
|
void v8js_v8object_create(zval *res, v8::Local<v8::Value> value, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
|
||||||
{
|
{
|
||||||
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
|
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ extern zend_class_entry *php_ce_v8object;
|
|||||||
extern zend_class_entry *php_ce_v8function;
|
extern zend_class_entry *php_ce_v8function;
|
||||||
|
|
||||||
/* Create PHP V8 object */
|
/* Create PHP V8 object */
|
||||||
void v8js_v8object_create(zval *, v8::Handle<v8::Value>, int, v8::Isolate * TSRMLS_DC);
|
void v8js_v8object_create(zval *, v8::Local<v8::Value>, int, v8::Isolate * TSRMLS_DC);
|
||||||
|
|
||||||
static inline v8js_v8object *v8js_v8object_fetch_object(zend_object *obj) {
|
static inline v8js_v8object *v8js_v8object_fetch_object(zend_object *obj) {
|
||||||
return (v8js_v8object *)((char *)obj - XtOffsetOf(struct v8js_v8object, std));
|
return (v8js_v8object *)((char *)obj - XtOffsetOf(struct v8js_v8object, std));
|
||||||
|
@ -27,7 +27,7 @@ extern "C" {
|
|||||||
|
|
||||||
static void v8js_fetch_php_variable(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) /* {{{ */
|
static void v8js_fetch_php_variable(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) /* {{{ */
|
||||||
{
|
{
|
||||||
v8::Handle<v8::External> data = v8::Handle<v8::External>::Cast(info.Data());
|
v8::Local<v8::External> data = v8::Local<v8::External>::Cast(info.Data());
|
||||||
v8js_accessor_ctx *ctx = static_cast<v8js_accessor_ctx *>(data->Value());
|
v8js_accessor_ctx *ctx = static_cast<v8js_accessor_ctx *>(data->Value());
|
||||||
v8::Isolate *isolate = ctx->isolate;
|
v8::Isolate *isolate = ctx->isolate;
|
||||||
zval *variable;
|
zval *variable;
|
||||||
|
Loading…
Reference in New Issue
Block a user