Prepare removal of ObjectTemplate::New without Isolate parameter.

LOG=y
BUG=324225
R=ulan@chromium.org

Review URL: https://codereview.chromium.org/124943004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18478 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ffafe7b9
......@@ -200,7 +200,7 @@ int RunMain(int argc, char* argv[]) {
}
// Create a template for the global object.
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate);
// Bind the global 'print' function to the C++ Print callback.
global->Set(v8::String::NewFromUtf8(isolate, "print"),
......
......@@ -160,7 +160,7 @@ bool JsHttpRequestProcessor::Initialize(map<string, string>* opts,
// Create a template for the global object where we set the
// built-in global functions.
Handle<ObjectTemplate> global = ObjectTemplate::New();
Handle<ObjectTemplate> global = ObjectTemplate::New(GetIsolate());
global->Set(String::NewFromUtf8(GetIsolate(), "log"),
FunctionTemplate::New(GetIsolate(), LogCallback));
......@@ -401,7 +401,7 @@ Handle<ObjectTemplate> JsHttpRequestProcessor::MakeMapTemplate(
Isolate* isolate) {
EscapableHandleScope handle_scope(isolate);
Local<ObjectTemplate> result = ObjectTemplate::New();
Local<ObjectTemplate> result = ObjectTemplate::New(isolate);
result->SetInternalFieldCount(1);
result->SetNamedPropertyHandler(MapGet, MapSet);
......@@ -511,7 +511,7 @@ Handle<ObjectTemplate> JsHttpRequestProcessor::MakeRequestTemplate(
Isolate* isolate) {
EscapableHandleScope handle_scope(isolate);
Local<ObjectTemplate> result = ObjectTemplate::New();
Local<ObjectTemplate> result = ObjectTemplate::New(isolate);
result->SetInternalFieldCount(1);
// Add accessors for each of the fields of the request.
......
......@@ -98,7 +98,7 @@ const char* ToCString(const v8::String::Utf8Value& value) {
// functions.
v8::Handle<v8::Context> CreateShellContext(v8::Isolate* isolate) {
// Create a template for the global object.
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate);
// Bind the global 'print' function to the C++ Print callback.
global->Set(v8::String::NewFromUtf8(isolate, "print"),
v8::FunctionTemplate::New(isolate, Print));
......
......@@ -943,12 +943,13 @@ static void InitializeFunctionTemplate(
Local<ObjectTemplate> FunctionTemplate::PrototypeTemplate() {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
i::Isolate* i_isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(i_isolate);
i::Handle<i::Object> result(Utils::OpenHandle(this)->prototype_template(),
isolate);
i_isolate);
if (result->IsUndefined()) {
result = Utils::OpenHandle(*ObjectTemplate::New());
v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(i_isolate);
result = Utils::OpenHandle(*ObjectTemplate::New(isolate));
Utils::OpenHandle(this)->set_prototype_template(*result);
}
return ToApiHandle<ObjectTemplate>(result);
......@@ -5148,7 +5149,8 @@ static i::Handle<i::Context> CreateEnvironment(
global_constructor = EnsureConstructor(isolate, *global_template);
// Create a fresh template for the global proxy object.
proxy_template = ObjectTemplate::New();
proxy_template = ObjectTemplate::New(
reinterpret_cast<v8::Isolate*>(isolate));
proxy_constructor = EnsureConstructor(isolate, *proxy_template);
// Set the global template to be the prototype template of
......
......@@ -858,7 +858,7 @@ class BZip2Decompressor : public v8::StartupDataDecompressor {
Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
Handle<ObjectTemplate> global_template = ObjectTemplate::New();
Handle<ObjectTemplate> global_template = ObjectTemplate::New(isolate);
global_template->Set(String::NewFromUtf8(isolate, "print"),
FunctionTemplate::New(isolate, Print));
global_template->Set(String::NewFromUtf8(isolate, "write"),
......@@ -877,7 +877,7 @@ Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
FunctionTemplate::New(isolate, Version));
// Bind the Realm object.
Handle<ObjectTemplate> realm_template = ObjectTemplate::New();
Handle<ObjectTemplate> realm_template = ObjectTemplate::New(isolate);
realm_template->Set(String::NewFromUtf8(isolate, "current"),
FunctionTemplate::New(isolate, RealmCurrent));
realm_template->Set(String::NewFromUtf8(isolate, "owner"),
......@@ -897,7 +897,7 @@ Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
global_template->Set(String::NewFromUtf8(isolate, "Realm"), realm_template);
#ifndef V8_SHARED
Handle<ObjectTemplate> performance_template = ObjectTemplate::New();
Handle<ObjectTemplate> performance_template = ObjectTemplate::New(isolate);
performance_template->Set(String::NewFromUtf8(isolate, "now"),
FunctionTemplate::New(isolate, PerformanceNow));
global_template->Set(String::NewFromUtf8(isolate, "performance"),
......@@ -905,7 +905,7 @@ Handle<ObjectTemplate> Shell::CreateGlobalTemplate(Isolate* isolate) {
#endif // V8_SHARED
#if !defined(V8_SHARED) && !defined(_WIN32) && !defined(_WIN64)
Handle<ObjectTemplate> os_templ = ObjectTemplate::New();
Handle<ObjectTemplate> os_templ = ObjectTemplate::New(isolate);
AddOSMethods(isolate, os_templ);
global_template->Set(String::NewFromUtf8(isolate, "os"), os_templ);
#endif // V8_SHARED
......
......@@ -257,7 +257,8 @@ Handle<ObjectTemplateInfo> GetEternal(Isolate* isolate) {
return Handle<ObjectTemplateInfo>::cast(
isolate->eternal_handles()->GetSingleton(field));
}
v8::Local<v8::ObjectTemplate> raw_template(v8::ObjectTemplate::New());
v8::Local<v8::ObjectTemplate> raw_template =
v8::ObjectTemplate::New(reinterpret_cast<v8::Isolate*>(isolate));
raw_template->SetInternalFieldCount(internal_fields);
return Handle<ObjectTemplateInfo>::cast(
isolate->eternal_handles()->CreateSingleton(
......
......@@ -194,7 +194,7 @@ THREADED_TEST(AccessorIC) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
obj->SetAccessor(v8_str("x0"), XGetter, XSetter);
obj->SetAccessorProperty(v8_str("x1"),
v8::FunctionTemplate::New(isolate, XGetter),
......@@ -238,8 +238,9 @@ static void AccessorProhibitsOverwritingGetter(
THREADED_TEST(AccessorProhibitsOverwriting) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
Local<ObjectTemplate> templ = ObjectTemplate::New();
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
templ->SetAccessor(v8_str("x"),
AccessorProhibitsOverwritingGetter,
0,
......@@ -288,24 +289,25 @@ static void HandleAllocatingGetter(
THREADED_TEST(HandleScopePop) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
obj->SetAccessor(v8_str("one"), HandleAllocatingGetter<1>);
obj->SetAccessor(v8_str("many"), HandleAllocatingGetter<1024>);
v8::Handle<v8::Object> inst = obj->NewInstance();
context->Global()->Set(v8::String::NewFromUtf8(context->GetIsolate(), "obj"),
inst);
i::Isolate* isolate = CcTest::i_isolate();
int count_before = i::HandleScope::NumberOfHandles(isolate);
context->Global()->Set(v8::String::NewFromUtf8(isolate, "obj"), inst);
int count_before =
i::HandleScope::NumberOfHandles(reinterpret_cast<i::Isolate*>(isolate));
{
v8::HandleScope scope(context->GetIsolate());
v8::HandleScope scope(isolate);
CompileRun(
"for (var i = 0; i < 1000; i++) {"
" obj.one;"
" obj.many;"
"}");
}
int count_after = i::HandleScope::NumberOfHandles(isolate);
int count_after =
i::HandleScope::NumberOfHandles(reinterpret_cast<i::Isolate*>(isolate));
CHECK_EQ(count_before, count_after);
}
......@@ -332,17 +334,18 @@ static void CheckAccessorArgsCorrect(
THREADED_TEST(DirectCall) {
LocalContext context;
v8::HandleScope scope(context->GetIsolate());
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
obj->SetAccessor(v8_str("xxx"),
CheckAccessorArgsCorrect,
NULL,
v8::String::NewFromUtf8(context->GetIsolate(), "data"));
v8::String::NewFromUtf8(isolate, "data"));
v8::Handle<v8::Object> inst = obj->NewInstance();
context->Global()->Set(v8::String::NewFromUtf8(context->GetIsolate(), "obj"),
context->Global()->Set(v8::String::NewFromUtf8(isolate, "obj"),
inst);
Local<Script> scr = v8::Script::Compile(
v8::String::NewFromUtf8(context->GetIsolate(), "obj.xxx"));
v8::String::NewFromUtf8(isolate, "obj.xxx"));
for (int i = 0; i < 10; i++) {
Local<Value> result = scr->Run();
CHECK(!result.IsEmpty());
......@@ -363,7 +366,7 @@ THREADED_TEST(EmptyResult) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL,
v8::String::NewFromUtf8(isolate, "data"));
v8::Handle<v8::Object> inst = obj->NewInstance();
......@@ -383,7 +386,7 @@ THREADED_TEST(NoReuseRegress) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
{
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL,
v8::String::NewFromUtf8(isolate, "data"));
LocalContext context;
......@@ -397,7 +400,7 @@ THREADED_TEST(NoReuseRegress) {
}
}
{
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
obj->SetAccessor(v8_str("xxx"),
CheckAccessorArgsCorrect,
NULL,
......@@ -432,8 +435,9 @@ static void ThrowingSetAccessor(Local<String> name,
THREADED_TEST(Regress1054726) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
obj->SetAccessor(v8_str("x"),
ThrowingGetAccessor,
ThrowingSetAccessor,
......@@ -452,7 +456,7 @@ THREADED_TEST(Regress1054726) {
CHECK_EQ(v8_str("ggggg"), result);
result = Script::Compile(String::NewFromUtf8(
env->GetIsolate(),
isolate,
"var result = '';"
"for (var i = 0; i < 5; i++) {"
" try { obj.x = i; } catch (e) { result += e; }"
......@@ -470,12 +474,13 @@ static void AllocGetter(Local<String> name,
THREADED_TEST(Gc) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
obj->SetAccessor(v8_str("xxx"), AllocGetter);
env->Global()->Set(v8_str("obj"), obj->NewInstance());
Script::Compile(String::NewFromUtf8(
env->GetIsolate(),
isolate,
"var last = [];"
"for (var i = 0; i < 2048; i++) {"
" var result = obj.xxx;"
......@@ -502,14 +507,15 @@ static void StackCheck(Local<String> name,
THREADED_TEST(StackIteration) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(env->GetIsolate());
i::StringStream::ClearMentionedObjectCache(isolate);
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
i::StringStream::ClearMentionedObjectCache(
reinterpret_cast<i::Isolate*>(isolate));
obj->SetAccessor(v8_str("xxx"), StackCheck);
env->Global()->Set(v8_str("obj"), obj->NewInstance());
Script::Compile(String::NewFromUtf8(
env->GetIsolate(),
isolate,
"function foo() {"
" return obj.xxx;"
"}"
......@@ -532,12 +538,13 @@ THREADED_TEST(HandleScopeSegment) {
// Check that we can return values past popping of handle scope
// segments.
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
obj->SetAccessor(v8_str("xxx"), AllocateHandles);
env->Global()->Set(v8_str("obj"), obj->NewInstance());
v8::Handle<v8::Value> result = Script::Compile(String::NewFromUtf8(
env->GetIsolate(),
isolate,
"var result;"
"for (var i = 0; i < 4; i++)"
" result = obj.xxx;"
......@@ -561,9 +568,10 @@ void JSONStringifyGetter(Local<String> name,
THREADED_TEST(JSONStringifyNamedInterceptorObject) {
LocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(isolate);
obj->SetNamedPropertyHandler(
JSONStringifyGetter, NULL, NULL, NULL, JSONStringifyEnumerator);
env->Global()->Set(v8_str("obj"), obj->NewInstance());
......
This diff is collapsed.
......@@ -534,7 +534,8 @@ TEST(StackAlignmentForSSE2) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> global_template =
v8::ObjectTemplate::New(isolate);
global_template->Set(v8_str("do_sse2"),
v8::FunctionTemplate::New(isolate, DoSSE2));
......
......@@ -614,7 +614,8 @@ TEST(StackAlignmentForSSE2) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> global_template =
v8::ObjectTemplate::New(isolate);
global_template->Set(v8_str("do_sse2"),
v8::FunctionTemplate::New(isolate, DoSSE2));
......
This diff is collapsed.
......@@ -423,7 +423,8 @@ TEST(HeapSnapshotSlicedString) {
TEST(HeapSnapshotConsString) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
v8::Local<v8::ObjectTemplate> global_template =
v8::ObjectTemplate::New(isolate);
global_template->SetInternalFieldCount(1);
LocalContext env(NULL, global_template);
v8::Handle<v8::Object> global_proxy = env->Global();
......@@ -466,7 +467,8 @@ TEST(HeapSnapshotConsString) {
TEST(HeapSnapshotInternalReferences) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
v8::Local<v8::ObjectTemplate> global_template =
v8::ObjectTemplate::New(isolate);
global_template->SetInternalFieldCount(2);
LocalContext env(NULL, global_template);
v8::Handle<v8::Object> global_proxy = env->Global();
......
......@@ -517,7 +517,7 @@ static Handle<Object> CreateAccessCheckedObject(
NamedSecurityCallback namedCallback,
IndexedSecurityCallback indexedCallback,
Handle<Value> data = Handle<Value>()) {
Handle<ObjectTemplate> tmpl = ObjectTemplate::New();
Handle<ObjectTemplate> tmpl = ObjectTemplate::New(isolate);
tmpl->SetAccessCheckCallbacks(namedCallback, indexedCallback, data);
Handle<Object> instance = tmpl->NewInstance();
Handle<Object> global = instance->CreationContext()->Global();
......
......@@ -72,7 +72,8 @@ void GetStackPointer(const v8::FunctionCallbackInfo<v8::Value>& args) {
TEST(StackAlignment) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> global_template =
v8::ObjectTemplate::New(isolate);
global_template->Set(v8_str("get_stack_pointer"),
v8::FunctionTemplate::New(isolate, GetStackPointer));
......
......@@ -105,7 +105,7 @@ v8::Handle<v8::ObjectTemplate> CreateGlobalTemplate(
v8::Isolate* isolate,
v8::FunctionCallback terminate,
v8::FunctionCallback doloop) {
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate);
global->Set(v8::String::NewFromUtf8(isolate, "terminate"),
v8::FunctionTemplate::New(isolate, terminate));
global->Set(v8::String::NewFromUtf8(isolate, "fail"),
......@@ -244,7 +244,7 @@ void LoopGetProperty(const v8::FunctionCallbackInfo<v8::Value>& args) {
TEST(TerminateLoadICException) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate);
global->Set(
v8::String::NewFromUtf8(isolate, "terminate_or_return_object"),
v8::FunctionTemplate::New(isolate, TerminateOrReturnObject));
......
......@@ -245,7 +245,7 @@ int main(int argc, char* argv[]) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
{
v8::HandleScope handle_scope(isolate);
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global);
ASSERT(!context.IsEmpty());
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment