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
This commit is contained in:
svenpanne@chromium.org 2014-01-08 06:53:31 +00:00
parent ffafe7b9e3
commit 005c0d8178
16 changed files with 504 additions and 372 deletions

View File

@ -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"),

View File

@ -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.

View File

@ -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));

View File

@ -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

View File

@ -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

View File

@ -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(

View File

@ -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());

File diff suppressed because it is too large Load Diff

View File

@ -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));

View File

@ -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));

View File

@ -4355,33 +4355,34 @@ static void IndexedGetter(uint32_t index,
TEST(InterceptorPropertyMirror) {
// Create a V8 environment with debug access.
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
env.ExposeDebug();
// Create object with named interceptor.
v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New(isolate);
named->SetNamedPropertyHandler(NamedGetter, NULL, NULL, NULL, NamedEnum);
env->Global()->Set(
v8::String::NewFromUtf8(env->GetIsolate(), "intercepted_named"),
v8::String::NewFromUtf8(isolate, "intercepted_named"),
named->NewInstance());
// Create object with indexed interceptor.
v8::Handle<v8::ObjectTemplate> indexed = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> indexed = v8::ObjectTemplate::New(isolate);
indexed->SetIndexedPropertyHandler(IndexedGetter,
NULL,
NULL,
NULL,
IndexedEnum);
env->Global()->Set(
v8::String::NewFromUtf8(env->GetIsolate(), "intercepted_indexed"),
v8::String::NewFromUtf8(isolate, "intercepted_indexed"),
indexed->NewInstance());
// Create object with both named and indexed interceptor.
v8::Handle<v8::ObjectTemplate> both = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> both = v8::ObjectTemplate::New(isolate);
both->SetNamedPropertyHandler(NamedGetter, NULL, NULL, NULL, NamedEnum);
both->SetIndexedPropertyHandler(IndexedGetter, NULL, NULL, NULL, IndexedEnum);
env->Global()->Set(
v8::String::NewFromUtf8(env->GetIsolate(), "intercepted_both"),
v8::String::NewFromUtf8(isolate, "intercepted_both"),
both->NewInstance());
// Get mirrors for the three objects with interceptor.
@ -4597,17 +4598,18 @@ static void ProtperyXNativeGetter(
TEST(NativeGetterPropertyMirror) {
// Create a V8 environment with debug access.
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
env.ExposeDebug();
v8::Handle<v8::String> name = v8::String::NewFromUtf8(env->GetIsolate(), "x");
v8::Handle<v8::String> name = v8::String::NewFromUtf8(isolate, "x");
// Create object with named accessor.
v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New(isolate);
named->SetAccessor(name, &ProtperyXNativeGetter, NULL,
v8::Handle<v8::Value>(), v8::DEFAULT, v8::None);
// Create object with named property getter.
env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "instance"),
env->Global()->Set(v8::String::NewFromUtf8(isolate, "instance"),
named->NewInstance());
CHECK_EQ(10, CompileRun("instance.x")->Int32Value());
@ -4636,17 +4638,18 @@ static void ProtperyXNativeGetterThrowingError(
TEST(NativeGetterThrowingErrorPropertyMirror) {
// Create a V8 environment with debug access.
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
env.ExposeDebug();
v8::Handle<v8::String> name = v8::String::NewFromUtf8(env->GetIsolate(), "x");
v8::Handle<v8::String> name = v8::String::NewFromUtf8(isolate, "x");
// Create object with named accessor.
v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New(isolate);
named->SetAccessor(name, &ProtperyXNativeGetterThrowingError, NULL,
v8::Handle<v8::Value>(), v8::DEFAULT, v8::None);
// Create object with named property getter.
env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "instance"),
env->Global()->Set(v8::String::NewFromUtf8(isolate, "instance"),
named->NewInstance());
// Get mirror for the object with property getter.
@ -5216,15 +5219,17 @@ void V8Thread::Run() {
"\n"
"foo();\n";
v8::Isolate::Scope isolate_scope(CcTest::isolate());
v8::Isolate* isolate = CcTest::isolate();
v8::Isolate::Scope isolate_scope(isolate);
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Debug::SetMessageHandler2(&ThreadedMessageHandler);
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
v8::Handle<v8::ObjectTemplate> global_template =
v8::ObjectTemplate::New(env->GetIsolate());
global_template->Set(
v8::String::NewFromUtf8(env->GetIsolate(), "ThreadedAtBarrier1"),
v8::FunctionTemplate::New(CcTest::isolate(), ThreadedAtBarrier1));
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(),
v8::FunctionTemplate::New(isolate, ThreadedAtBarrier1));
v8::Handle<v8::Context> context = v8::Context::New(isolate,
NULL,
global_template);
v8::Context::Scope context_scope(context);
@ -5580,68 +5585,70 @@ static void CheckClosure(const v8::FunctionCallbackInfo<v8::Value>& args) {
TEST(CallFunctionInDebugger) {
// Create and enter a context with the functions CheckFrameCount,
// CheckSourceLine and CheckDataParameter installed.
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> global_template =
v8::ObjectTemplate::New(isolate);
global_template->Set(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckFrameCount"),
v8::FunctionTemplate::New(CcTest::isolate(), CheckFrameCount));
v8::String::NewFromUtf8(isolate, "CheckFrameCount"),
v8::FunctionTemplate::New(isolate, CheckFrameCount));
global_template->Set(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckSourceLine"),
v8::FunctionTemplate::New(CcTest::isolate(), CheckSourceLine));
v8::String::NewFromUtf8(isolate, "CheckSourceLine"),
v8::FunctionTemplate::New(isolate, CheckSourceLine));
global_template->Set(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckDataParameter"),
v8::FunctionTemplate::New(CcTest::isolate(), CheckDataParameter));
v8::String::NewFromUtf8(isolate, "CheckDataParameter"),
v8::FunctionTemplate::New(isolate, CheckDataParameter));
global_template->Set(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckClosure"),
v8::FunctionTemplate::New(CcTest::isolate(), CheckClosure));
v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(),
v8::String::NewFromUtf8(isolate, "CheckClosure"),
v8::FunctionTemplate::New(isolate, CheckClosure));
v8::Handle<v8::Context> context = v8::Context::New(isolate,
NULL,
global_template);
v8::Context::Scope context_scope(context);
// Compile a function for checking the number of JavaScript frames.
v8::Script::Compile(
v8::String::NewFromUtf8(CcTest::isolate(), frame_count_source))->Run();
v8::String::NewFromUtf8(isolate, frame_count_source))->Run();
frame_count = v8::Local<v8::Function>::Cast(context->Global()->Get(
v8::String::NewFromUtf8(CcTest::isolate(), "frame_count")));
v8::String::NewFromUtf8(isolate, "frame_count")));
// Compile a function for returning the source line for the top frame.
v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(),
v8::Script::Compile(v8::String::NewFromUtf8(isolate,
frame_source_line_source))->Run();
frame_source_line = v8::Local<v8::Function>::Cast(context->Global()->Get(
v8::String::NewFromUtf8(CcTest::isolate(), "frame_source_line")));
v8::String::NewFromUtf8(isolate, "frame_source_line")));
// Compile a function returning the data parameter.
v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(),
v8::Script::Compile(v8::String::NewFromUtf8(isolate,
debugger_call_with_data_source))
->Run();
debugger_call_with_data = v8::Local<v8::Function>::Cast(
context->Global()->Get(v8::String::NewFromUtf8(
CcTest::isolate(), "debugger_call_with_data")));
isolate, "debugger_call_with_data")));
// Compile a function capturing closure.
debugger_call_with_closure =
v8::Local<v8::Function>::Cast(v8::Script::Compile(
v8::String::NewFromUtf8(CcTest::isolate(),
v8::String::NewFromUtf8(isolate,
debugger_call_with_closure_source))->Run());
// Calling a function through the debugger returns 0 frames if there are
// no JavaScript frames.
CHECK_EQ(v8::Integer::New(CcTest::isolate(), 0),
CHECK_EQ(v8::Integer::New(isolate, 0),
v8::Debug::Call(frame_count));
// Test that the number of frames can be retrieved.
v8::Script::Compile(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckFrameCount(1)"))->Run();
v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(),
v8::String::NewFromUtf8(isolate, "CheckFrameCount(1)"))->Run();
v8::Script::Compile(v8::String::NewFromUtf8(isolate,
"function f() {"
" CheckFrameCount(2);"
"}; f()"))->Run();
// Test that the source line can be retrieved.
v8::Script::Compile(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckSourceLine(0)"))->Run();
v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(),
v8::String::NewFromUtf8(isolate, "CheckSourceLine(0)"))->Run();
v8::Script::Compile(v8::String::NewFromUtf8(isolate,
"function f() {\n"
" CheckSourceLine(1)\n"
" CheckSourceLine(2)\n"
@ -5649,20 +5656,20 @@ TEST(CallFunctionInDebugger) {
"}; f()"))->Run();
// Test that a parameter can be passed to a function called in the debugger.
v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(),
v8::Script::Compile(v8::String::NewFromUtf8(isolate,
"CheckDataParameter()"))->Run();
// Test that a function with closure can be run in the debugger.
v8::Script::Compile(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckClosure()"))->Run();
v8::String::NewFromUtf8(isolate, "CheckClosure()"))->Run();
// Test that the source line is correct when there is a line offset.
v8::ScriptOrigin origin(v8::String::NewFromUtf8(CcTest::isolate(), "test"),
v8::Integer::New(CcTest::isolate(), 7));
v8::ScriptOrigin origin(v8::String::NewFromUtf8(isolate, "test"),
v8::Integer::New(isolate, 7));
v8::Script::Compile(
v8::String::NewFromUtf8(CcTest::isolate(), "CheckSourceLine(7)"), &origin)
v8::String::NewFromUtf8(isolate, "CheckSourceLine(7)"), &origin)
->Run();
v8::Script::Compile(v8::String::NewFromUtf8(CcTest::isolate(),
v8::Script::Compile(v8::String::NewFromUtf8(isolate,
"function f() {\n"
" CheckSourceLine(8)\n"
" CheckSourceLine(9)\n"
@ -7167,7 +7174,8 @@ TEST(CallingContextIsNotDebugContext) {
v8::internal::Debug* debug = CcTest::i_isolate()->debug();
// Create and enter a debugee context.
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
env.ExposeDebug();
// Save handles to the debugger and debugee contexts to be used in
@ -7176,10 +7184,10 @@ TEST(CallingContextIsNotDebugContext) {
debugger_context = v8::Utils::ToLocal(debug->debug_context());
// Create object with 'a' property accessor.
v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New();
named->SetAccessor(v8::String::NewFromUtf8(env->GetIsolate(), "a"),
v8::Handle<v8::ObjectTemplate> named = v8::ObjectTemplate::New(isolate);
named->SetAccessor(v8::String::NewFromUtf8(isolate, "a"),
NamedGetterWithCallingContextCheck);
env->Global()->Set(v8::String::NewFromUtf8(env->GetIsolate(), "obj"),
env->Global()->Set(v8::String::NewFromUtf8(isolate, "obj"),
named->NewInstance());
// Register the debug event listener

View File

@ -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();

View File

@ -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();

View File

@ -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));

View File

@ -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));

View File

@ -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());
{