From 80575beeccb0dcd4969fe505f9e8b49fe6e441e7 Mon Sep 17 00:00:00 2001 From: Stefan Siegl Date: Sat, 9 Jan 2016 14:05:19 +0100 Subject: [PATCH] Don't create v8::HandleScope in v8js_wrap_generator --- v8js_generator_export.cc | 5 ++--- v8js_generator_export.h | 2 +- v8js_object_export.cc | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/v8js_generator_export.cc b/v8js_generator_export.cc index 19bc1cb..4aea008 100644 --- a/v8js_generator_export.cc +++ b/v8js_generator_export.cc @@ -17,16 +17,15 @@ #include #include "php_v8js_macros.h" -v8::Local v8js_wrap_generator(v8js_ctx *ctx, v8::Local wrapped_object) /* {{{ */ +v8::Local v8js_wrap_generator(v8::Isolate *isolate, v8::Local wrapped_object) /* {{{ */ { v8::Local result; - V8JS_CTX_PROLOGUE_EX(ctx, result); assert(!wrapped_object.IsEmpty()); assert(wrapped_object->IsObject()); v8::TryCatch try_catch; - v8::Local source = v8::String::NewFromUtf8(ctx->isolate, "(\ + v8::Local source = v8::String::NewFromUtf8(isolate, "(\ function(wrapped_object) { \ return (function*() { \ for(;;) { \ diff --git a/v8js_generator_export.h b/v8js_generator_export.h index 13e6d09..f19f3a6 100644 --- a/v8js_generator_export.h +++ b/v8js_generator_export.h @@ -13,7 +13,7 @@ #ifndef V8JS_GENERATOR_EXPORT_H #define V8JS_GENERATOR_EXPORT_H -v8::Local v8js_wrap_generator(v8js_ctx *ctx, v8::Local wrapped_object); +v8::Local v8js_wrap_generator(v8::Isolate *isolate, v8::Local wrapped_object); #endif /* V8JS_GENERATOR_EXPORT_H */ diff --git a/v8js_object_export.cc b/v8js_object_export.cc index b21dc91..e9bc632 100644 --- a/v8js_object_export.cc +++ b/v8js_object_export.cc @@ -962,8 +962,7 @@ v8::Handle v8js_hash_to_jsobj(zval *value, v8::Isolate *isolate TSRML if (ce == zend_ce_generator) { /* Wrap PHP Generator object in a wrapper function that provides * ES6 style behaviour. */ - v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0); - wrapped_object = v8js_wrap_generator(ctx, wrapped_object); + wrapped_object = v8js_wrap_generator(isolate, wrapped_object); } return wrapped_object;