Revision: 17638
Author: [email protected]
Date: Tue Nov 12 11:44:58 2013 UTC
Log: Add explicit Isolate parameter to External::New
We can't deprecate the non-Isolate version yet but soon will.
[email protected], [email protected]
BUG=266838
Review URL: https://codereview.chromium.org/70163002
http://code.google.com/p/v8/source/detail?r=17638
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/samples/process.cc
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/test/cctest/test-accessors.cc
/branches/bleeding_edge/test/cctest/test-api.cc
/branches/bleeding_edge/test/cctest/test-cpu-profiler.cc
/branches/bleeding_edge/test/cctest/test-decls.cc
=======================================
--- /branches/bleeding_edge/include/v8.h Wed Nov 6 17:05:50 2013 UTC
+++ /branches/bleeding_edge/include/v8.h Tue Nov 12 11:44:58 2013 UTC
@@ -3042,6 +3042,8 @@
*/
class V8_EXPORT External : public Value {
public:
+ static Local<External> New(Isolate* isolate, void* value);
+ // Deprecated, do not use.
static Local<External> New(void* value);
V8_INLINE static External* Cast(Value* obj);
void* Value() const;
=======================================
--- /branches/bleeding_edge/samples/process.cc Tue Sep 3 07:34:34 2013 UTC
+++ /branches/bleeding_edge/samples/process.cc Tue Nov 12 11:44:58 2013 UTC
@@ -324,7 +324,7 @@
// Wrap the raw C++ pointer in an External so it can be referenced
// from within JavaScript.
- Handle<External> map_ptr = External::New(obj);
+ Handle<External> map_ptr = External::New(GetIsolate(), obj);
// Store the map pointer in the JavaScript wrapper.
result->SetInternalField(0, map_ptr);
@@ -432,7 +432,7 @@
// Wrap the raw C++ pointer in an External so it can be referenced
// from within JavaScript.
- Handle<External> request_ptr = External::New(request);
+ Handle<External> request_ptr = External::New(GetIsolate(), request);
// Store the request pointer in the JavaScript wrapper.
result->SetInternalField(0, request_ptr);
=======================================
--- /branches/bleeding_edge/src/api.cc Thu Nov 7 12:35:57 2013 UTC
+++ /branches/bleeding_edge/src/api.cc Tue Nov 12 11:44:58 2013 UTC
@@ -5369,15 +5369,20 @@
}
-Local<External> v8::External::New(void* value) {
+Local<External> v8::External::New(Isolate* isolate, void* value) {
STATIC_ASSERT(sizeof(value) == sizeof(i::Address));
- i::Isolate* isolate = i::Isolate::Current();
- EnsureInitializedForIsolate(isolate, "v8::External::New()");
- LOG_API(isolate, "External::New");
- ENTER_V8(isolate);
- i::Handle<i::JSObject> external = isolate->factory()->NewExternal(value);
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ EnsureInitializedForIsolate(i_isolate, "v8::External::New()");
+ LOG_API(i_isolate, "External::New");
+ ENTER_V8(i_isolate);
+ i::Handle<i::JSObject> external =
i_isolate->factory()->NewExternal(value);
return Utils::ExternalToLocal(external);
}
+
+
+Local<External> v8::External::New(void* value) {
+ return v8::External::New(Isolate::GetCurrent(), value);
+}
void* External::Value() const {
=======================================
--- /branches/bleeding_edge/test/cctest/test-accessors.cc Fri Sep 27
07:04:02 2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-accessors.cc Tue Nov 12
11:44:58 2013 UTC
@@ -122,18 +122,15 @@
baz = 10;
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New();
- templ->InstanceTemplate()->SetAccessor(v8_str("foo"),
- GetIntValue,
- SetIntValue,
- v8::External::New(&foo));
- templ->InstanceTemplate()->SetAccessor(v8_str("bar"),
- GetIntValue,
- SetIntValue,
- v8::External::New(&bar));
- templ->InstanceTemplate()->SetAccessor(v8_str("baz"),
- GetIntValue,
- SetIntValue,
- v8::External::New(&baz));
+ templ->InstanceTemplate()->SetAccessor(
+ v8_str("foo"), GetIntValue, SetIntValue,
+ v8::External::New(CcTest::isolate(), &foo));
+ templ->InstanceTemplate()->SetAccessor(
+ v8_str("bar"), GetIntValue, SetIntValue,
+ v8::External::New(CcTest::isolate(), &bar));
+ templ->InstanceTemplate()->SetAccessor(
+ v8_str("baz"), GetIntValue, SetIntValue,
+ v8::External::New(CcTest::isolate(), &baz));
LocalContext env(0, templ->InstanceTemplate());
v8_compile("foo = (++bar) + baz")->Run();
CHECK_EQ(bar, -3);
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Tue Nov 5 09:54:59
2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-api.cc Tue Nov 12 11:44:58
2013 UTC
@@ -1306,7 +1306,8 @@
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
- v8::Handle<v8::Value> data = v8::External::New(expected_ptr);
+ v8::Handle<v8::Value> data =
+ v8::External::New(env->GetIsolate(), expected_ptr);
v8::Handle<v8::Object> obj = v8::Object::New();
obj->Set(v8_str("func"),
@@ -3119,7 +3120,7 @@
THREADED_TEST(External) {
v8::HandleScope scope(CcTest::isolate());
int x = 3;
- Local<v8::External> ext = v8::External::New(&x);
+ Local<v8::External> ext = v8::External::New(CcTest::isolate(), &x);
LocalContext env;
env->Global()->Set(v8_str("ext"), ext);
Local<Value> reext_obj = Script::Compile(v8_str("this.ext"))->Run();
@@ -3131,10 +3132,10 @@
// Make sure unaligned pointers are wrapped properly.
char* data = i::StrDup("0123456789");
- Local<v8::Value> zero = v8::External::New(&data[0]);
- Local<v8::Value> one = v8::External::New(&data[1]);
- Local<v8::Value> two = v8::External::New(&data[2]);
- Local<v8::Value> three = v8::External::New(&data[3]);
+ Local<v8::Value> zero = v8::External::New(CcTest::isolate(), &data[0]);
+ Local<v8::Value> one = v8::External::New(CcTest::isolate(), &data[1]);
+ Local<v8::Value> two = v8::External::New(CcTest::isolate(), &data[2]);
+ Local<v8::Value> three = v8::External::New(CcTest::isolate(), &data[3]);
char* char_ptr =
reinterpret_cast<char*>(v8::External::Cast(*zero)->Value());
CHECK_EQ('0', *char_ptr);
@@ -6874,7 +6875,7 @@
Whammy* whammy = new Whammy(CcTest::isolate());
templ->SetNamedPropertyHandler(WhammyPropertyGetter,
0, 0, 0, 0,
- v8::External::New(whammy));
+ v8::External::New(CcTest::isolate(),
whammy));
const char* extension_list[] = { "v8/gc" };
v8::ExtensionConfiguration extensions(1, extension_list);
v8::Handle<Context> context =
@@ -11569,9 +11570,9 @@
v8::Handle<v8::ObjectTemplate> proto_templ =
fun_templ->PrototypeTemplate();
proto_templ->Set(v8_str("method"), method_templ);
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
- NULL, NULL, NULL, NULL,
-
v8::External::New(&interceptor_call_count));
+ templ->SetNamedPropertyHandler(
+ InterceptorCallICFastApi, NULL, NULL, NULL, NULL,
+ v8::External::New(CcTest::isolate(), &interceptor_call_count));
LocalContext context;
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
@@ -11598,9 +11599,9 @@
proto_templ->Set(v8_str("method"), method_templ);
fun_templ->SetHiddenPrototype(true);
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
- NULL, NULL, NULL, NULL,
-
v8::External::New(&interceptor_call_count));
+ templ->SetNamedPropertyHandler(
+ InterceptorCallICFastApi, NULL, NULL, NULL, NULL,
+ v8::External::New(CcTest::isolate(), &interceptor_call_count));
LocalContext context;
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
@@ -11630,9 +11631,9 @@
proto_templ->Set(v8_str("method"), method_templ);
fun_templ->SetHiddenPrototype(true);
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
- NULL, NULL, NULL, NULL,
-
v8::External::New(&interceptor_call_count));
+ templ->SetNamedPropertyHandler(
+ InterceptorCallICFastApi, NULL, NULL, NULL, NULL,
+ v8::External::New(CcTest::isolate(), &interceptor_call_count));
LocalContext context;
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
@@ -11668,9 +11669,9 @@
proto_templ->Set(v8_str("method"), method_templ);
fun_templ->SetHiddenPrototype(true);
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
- NULL, NULL, NULL, NULL,
-
v8::External::New(&interceptor_call_count));
+ templ->SetNamedPropertyHandler(
+ InterceptorCallICFastApi, NULL, NULL, NULL, NULL,
+ v8::External::New(CcTest::isolate(), &interceptor_call_count));
LocalContext context;
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
@@ -11706,9 +11707,9 @@
proto_templ->Set(v8_str("method"), method_templ);
fun_templ->SetHiddenPrototype(true);
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
- NULL, NULL, NULL, NULL,
-
v8::External::New(&interceptor_call_count));
+ templ->SetNamedPropertyHandler(
+ InterceptorCallICFastApi, NULL, NULL, NULL, NULL,
+ v8::External::New(CcTest::isolate(), &interceptor_call_count));
LocalContext context;
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
@@ -11747,9 +11748,9 @@
proto_templ->Set(v8_str("method"), method_templ);
fun_templ->SetHiddenPrototype(true);
v8::Handle<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetNamedPropertyHandler(InterceptorCallICFastApi,
- NULL, NULL, NULL, NULL,
-
v8::External::New(&interceptor_call_count));
+ templ->SetNamedPropertyHandler(
+ InterceptorCallICFastApi, NULL, NULL, NULL, NULL,
+ v8::External::New(CcTest::isolate(), &interceptor_call_count));
LocalContext context;
v8::Handle<v8::Function> fun = fun_templ->GetFunction();
GenerateSomeGarbage();
=======================================
--- /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Wed Oct 16
08:15:06 2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-cpu-profiler.cc Tue Nov 12
11:44:58 2013 UTC
@@ -718,7 +718,8 @@
func_template->InstanceTemplate();
TestApiCallbacks accessors(100);
- v8::Local<v8::External> data = v8::External::New(&accessors);
+ v8::Local<v8::External> data =
+ v8::External::New(env->GetIsolate(), &accessors);
instance_template->SetAccessor(
v8::String::New("foo"), &TestApiCallbacks::Getter,
&TestApiCallbacks::Setter, data);
@@ -758,7 +759,8 @@
func_template->InstanceTemplate();
TestApiCallbacks accessors(1);
- v8::Local<v8::External> data = v8::External::New(&accessors);
+ v8::Local<v8::External> data =
+ v8::External::New(env->GetIsolate(), &accessors);
instance_template->SetAccessor(
v8::String::New("foo"), &TestApiCallbacks::Getter,
&TestApiCallbacks::Setter, data);
@@ -807,7 +809,8 @@
v8::HandleScope scope(env->GetIsolate());
TestApiCallbacks callbacks(100);
- v8::Local<v8::External> data = v8::External::New(&callbacks);
+ v8::Local<v8::External> data =
+ v8::External::New(env->GetIsolate(), &callbacks);
v8::Local<v8::FunctionTemplate> func_template =
v8::FunctionTemplate::New();
func_template->SetClassName(v8::String::New("Test_InstanceCostructor"));
@@ -844,7 +847,8 @@
v8::HandleScope scope(env->GetIsolate());
TestApiCallbacks callbacks(1);
- v8::Local<v8::External> data = v8::External::New(&callbacks);
+ v8::Local<v8::External> data =
+ v8::External::New(env->GetIsolate(), &callbacks);
v8::Local<v8::FunctionTemplate> func_template =
v8::FunctionTemplate::New();
func_template->SetClassName(v8::String::New("Test_InstanceCostructor"));
=======================================
--- /branches/bleeding_edge/test/cctest/test-decls.cc Thu Sep 26 08:47:59
2013 UTC
+++ /branches/bleeding_edge/test/cctest/test-decls.cc Tue Nov 12 11:44:58
2013 UTC
@@ -119,7 +119,7 @@
Isolate* isolate = CcTest::isolate();
HandleScope scope(isolate);
Local<FunctionTemplate> function = FunctionTemplate::New();
- Local<Value> data = External::New(this);
+ Local<Value> data = External::New(CcTest::isolate(), this);
GetHolder(function)->SetNamedPropertyHandler(&HandleGet,
&HandleSet,
&HandleQuery,
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.