From 88910423c24ae0d2f5c76f2f8f06d2d254fd5496 Mon Sep 17 00:00:00 2001 From: "dcarney@chromium.org" Date: Thu, 5 Sep 2013 08:48:34 +0000 Subject: [PATCH] add isolate parameter for Execution::Call R=svenpanne@chromium.org BUG= Review URL: https://codereview.chromium.org/23661004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16545 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/api.cc | 20 ++++++++--------- src/bootstrapper.cc | 2 +- src/builtins.cc | 3 ++- src/debug.cc | 1 + src/execution.cc | 16 +++++++++----- src/execution.h | 3 ++- src/handles.cc | 8 +++++-- src/ic.cc | 3 ++- src/json-stringifier.h | 4 ++-- src/objects.cc | 34 +++++++++++++++++------------ src/runtime.cc | 25 ++++++++++++++------- test/cctest/cctest.h | 4 ++++ test/cctest/test-compiler.cc | 52 ++++++++++++++++++++++++-------------------- test/cctest/test-parsing.cc | 4 ++-- test/cctest/test-random.cc | 19 ++++++++-------- 15 files changed, 117 insertions(+), 81 deletions(-) diff --git a/src/api.cc b/src/api.cc index c95def1..44a8d47 100644 --- a/src/api.cc +++ b/src/api.cc @@ -1877,8 +1877,8 @@ Local Script::Run() { EXCEPTION_PREAMBLE(isolate); i::Handle receiver( isolate->context()->global_proxy(), isolate); - i::Handle result = - i::Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); + i::Handle result = i::Execution::Call( + isolate, fun, receiver, 0, NULL, &has_pending_exception); EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local()); raw_result = *result; } @@ -2177,8 +2177,8 @@ static i::Handle CallV8HeapFunction(const char* name, isolate->js_builtins_object()->GetPropertyNoExceptionThrown(*fmt_str); i::Handle fun = i::Handle(i::JSFunction::cast(object_fun)); - i::Handle value = - i::Execution::Call(fun, recv, argc, argv, has_pending_exception); + i::Handle value = i::Execution::Call( + isolate, fun, recv, argc, argv, has_pending_exception); return value; } @@ -4143,8 +4143,8 @@ Local Object::CallAsFunction(v8::Handle recv, recv_obj = obj; } EXCEPTION_PREAMBLE(isolate); - i::Handle returned = - i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); + i::Handle returned = i::Execution::Call( + isolate, fun, recv_obj, argc, args, &has_pending_exception); EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local()); return Utils::ToLocal(scope.CloseAndEscape(returned)); } @@ -4179,8 +4179,8 @@ Local Object::CallAsConstructor(int argc, if (!delegate->IsUndefined()) { i::Handle fun = i::Handle::cast(delegate); EXCEPTION_PREAMBLE(isolate); - i::Handle returned = - i::Execution::Call(fun, obj, argc, args, &has_pending_exception); + i::Handle returned = i::Execution::Call( + isolate, fun, obj, argc, args, &has_pending_exception); EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local()); ASSERT(!delegate->IsUndefined()); return Utils::ToLocal(scope.CloseAndEscape(returned)); @@ -4231,8 +4231,8 @@ Local Function::Call(v8::Handle recv, int argc, STATIC_ASSERT(sizeof(v8::Handle) == sizeof(i::Object**)); i::Handle* args = reinterpret_cast*>(argv); EXCEPTION_PREAMBLE(isolate); - i::Handle returned = - i::Execution::Call(fun, recv_obj, argc, args, &has_pending_exception); + i::Handle returned = i::Execution::Call( + isolate, fun, recv_obj, argc, args, &has_pending_exception); EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, Local()); raw_result = *returned; } diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc index b7991d3..92ff269 100644 --- a/src/bootstrapper.cc +++ b/src/bootstrapper.cc @@ -1552,7 +1552,7 @@ bool Genesis::CompileScriptCached(Isolate* isolate, : top_context->global_object(), isolate); bool has_pending_exception; - Execution::Call(fun, receiver, 0, NULL, &has_pending_exception); + Execution::Call(isolate, fun, receiver, 0, NULL, &has_pending_exception); if (has_pending_exception) return false; return true; } diff --git a/src/builtins.cc b/src/builtins.cc index b481483..e488178 100644 --- a/src/builtins.cc +++ b/src/builtins.cc @@ -448,7 +448,8 @@ MUST_USE_RESULT static MaybeObject* CallJsBuiltin( argv[i] = args.at(i + 1); } bool pending_exception; - Handle result = Execution::Call(function, + Handle result = Execution::Call(isolate, + function, args.receiver(), argc, argv.start(), diff --git a/src/debug.cc b/src/debug.cc index c3d737e..d89dc29 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -3404,6 +3404,7 @@ Handle Debugger::Call(Handle fun, Handle argv[] = { exec_state, data }; Handle result = Execution::Call( + isolate_, fun, Handle(isolate_->debug()->debug_context_->global_proxy(), isolate_), diff --git a/src/execution.cc b/src/execution.cc index 048e6e0..91d340e 100644 --- a/src/execution.cc +++ b/src/execution.cc @@ -148,7 +148,8 @@ static Handle Invoke(bool is_construct, } -Handle Execution::Call(Handle callable, +Handle Execution::Call(Isolate* isolate, + Handle callable, Handle receiver, int argc, Handle argv[], @@ -156,7 +157,6 @@ Handle Execution::Call(Handle callable, bool convert_receiver) { *pending_exception = false; - Isolate* isolate = Isolate::Current(); if (!callable->IsJSFunction()) { callable = TryGetFunctionDelegate(isolate, callable, pending_exception); if (*pending_exception) return callable; @@ -599,7 +599,8 @@ void StackGuard::InitThread(const ExecutionAccess& lock) { do { \ Handle argv[] = args; \ ASSERT(has_pending_exception != NULL); \ - return Call(isolate->name##_fun(), \ + return Call(isolate, \ + isolate->name##_fun(), \ isolate->js_builtins_object(), \ ARRAY_SIZE(argv), argv, \ has_pending_exception); \ @@ -712,7 +713,8 @@ Handle Execution::InstantiateFunction( if (elm->IsJSFunction()) return Handle(JSFunction::cast(elm)); // The function has not yet been instantiated in this context; do it. Handle args[] = { data }; - Handle result = Call(isolate->instantiate_fun(), + Handle result = Call(isolate, + isolate->instantiate_fun(), isolate->js_builtins_object(), ARRAY_SIZE(args), args, @@ -744,7 +746,8 @@ Handle Execution::InstantiateObject(Handle data, return Handle(JSObject::cast(result)); } else { Handle args[] = { data }; - Handle result = Call(isolate->instantiate_fun(), + Handle result = Call(isolate, + isolate->instantiate_fun(), isolate->js_builtins_object(), ARRAY_SIZE(args), args, @@ -760,7 +763,8 @@ void Execution::ConfigureInstance(Isolate* isolate, Handle instance_template, bool* exc) { Handle args[] = { instance, instance_template }; - Execution::Call(isolate->configure_instance_fun(), + Execution::Call(isolate, + isolate->configure_instance_fun(), isolate->js_builtins_object(), ARRAY_SIZE(args), args, diff --git a/src/execution.h b/src/execution.h index 1a9a66c..0c1bf94 100644 --- a/src/execution.h +++ b/src/execution.h @@ -62,7 +62,8 @@ class Execution : public AllStatic { // and the function called is not in strict mode, receiver is converted to // an object. // - static Handle Call(Handle callable, + static Handle Call(Isolate* isolate, + Handle callable, Handle receiver, int argc, Handle argv[], diff --git a/src/handles.cc b/src/handles.cc index 1ac77cc..b3704df 100644 --- a/src/handles.cc +++ b/src/handles.cc @@ -615,8 +615,12 @@ Handle GetKeysInFixedArrayFor(Handle object, if (p->IsJSProxy()) { Handle proxy(JSProxy::cast(*p), isolate); Handle args[] = { proxy }; - Handle names = Execution::Call( - isolate->proxy_enumerate(), object, ARRAY_SIZE(args), args, threw); + Handle names = Execution::Call(isolate, + isolate->proxy_enumerate(), + object, + ARRAY_SIZE(args), + args, + threw); if (*threw) return content; content = AddKeysFromJSArray(content, Handle::cast(names)); break; diff --git a/src/ic.cc b/src/ic.cc index 44e13e1..d88ab4a 100644 --- a/src/ic.cc +++ b/src/ic.cc @@ -2792,7 +2792,8 @@ RUNTIME_FUNCTION(MaybeObject*, BinaryOp_Patch) { bool caught_exception; Handle builtin_args[] = { right }; - Handle result = Execution::Call(builtin_function, + Handle result = Execution::Call(isolate, + builtin_function, left, ARRAY_SIZE(builtin_args), builtin_args, diff --git a/src/json-stringifier.h b/src/json-stringifier.h index c6ea288..155ae5f 100644 --- a/src/json-stringifier.h +++ b/src/json-stringifier.h @@ -367,7 +367,7 @@ Handle BasicJsonStringifier::ApplyToJsonFunction( Handle argv[] = { key }; bool has_exception = false; HandleScope scope(isolate_); - object = Execution::Call(fun, object, 1, argv, &has_exception); + object = Execution::Call(isolate_, fun, object, 1, argv, &has_exception); // Return empty handle to signal an exception. if (has_exception) return Handle::null(); return scope.CloseAndEscape(object); @@ -470,7 +470,7 @@ BasicJsonStringifier::Result BasicJsonStringifier::SerializeGeneric( Handle argv[] = { key, object }; bool has_exception = false; Handle result = - Execution::Call(builtin, object, 2, argv, &has_exception); + Execution::Call(isolate_, builtin, object, 2, argv, &has_exception); if (has_exception) return EXCEPTION; if (result->IsUndefined()) return UNCHANGED; if (deferred_key) { diff --git a/src/objects.cc b/src/objects.cc index 9cb077b..aaf6483 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -485,8 +485,8 @@ MaybeObject* Object::GetPropertyWithDefinedGetter(Object* receiver, #endif bool has_pending_exception; - Handle result = - Execution::Call(fun, self, 0, NULL, &has_pending_exception, true); + Handle result = Execution::Call( + isolate, fun, self, 0, NULL, &has_pending_exception, true); // Check for pending exception and return the result. if (has_pending_exception) return Failure::Exception(); return *result; @@ -2089,7 +2089,8 @@ void JSObject::EnqueueChangeRecord(Handle object, } Handle args[] = { type, object, name, old_value }; bool threw; - Execution::Call(Handle(isolate->observers_notify_change()), + Execution::Call(isolate, + Handle(isolate->observers_notify_change()), isolate->factory()->undefined_value(), old_value->IsTheHole() ? 3 : 4, args, &threw); @@ -2101,6 +2102,7 @@ void JSObject::DeliverChangeRecords(Isolate* isolate) { ASSERT(isolate->observer_delivery_pending()); bool threw = false; Execution::Call( + isolate, isolate->observers_deliver_changes(), isolate->factory()->undefined_value(), 0, @@ -2877,7 +2879,8 @@ MaybeObject* JSReceiver::SetPropertyWithDefinedSetter(JSReceiver* setter, #endif bool has_pending_exception; Handle argv[] = { value_handle }; - Execution::Call(fun, self, ARRAY_SIZE(argv), argv, &has_pending_exception); + Execution::Call( + isolate, fun, self, ARRAY_SIZE(argv), argv, &has_pending_exception); // Check for pending exception and return the result. if (has_pending_exception) return Failure::Exception(); return *value_handle; @@ -3492,9 +3495,9 @@ MUST_USE_RESULT MaybeObject* JSProxy::SetPropertyViaPrototypesWithHandler( // Emulate [[GetProperty]] semantics for proxies. bool has_pending_exception; Handle argv[] = { result }; - Handle desc = - Execution::Call(isolate->to_complete_property_descriptor(), result, - ARRAY_SIZE(argv), argv, &has_pending_exception); + Handle desc = Execution::Call( + isolate, isolate->to_complete_property_descriptor(), result, + ARRAY_SIZE(argv), argv, &has_pending_exception); if (has_pending_exception) return Failure::Exception(); // [[GetProperty]] requires to check that all properties are configurable. @@ -3617,9 +3620,9 @@ MUST_USE_RESULT PropertyAttributes JSProxy::GetPropertyAttributeWithHandler( bool has_pending_exception; Handle argv[] = { result }; - Handle desc = - Execution::Call(isolate->to_complete_property_descriptor(), result, - ARRAY_SIZE(argv), argv, &has_pending_exception); + Handle desc = Execution::Call( + isolate, isolate->to_complete_property_descriptor(), result, + ARRAY_SIZE(argv), argv, &has_pending_exception); if (has_pending_exception) return NONE; // Convert result to PropertyAttributes. @@ -3717,7 +3720,7 @@ MUST_USE_RESULT Handle JSProxy::CallTrap(const char* name, } bool threw; - return Execution::Call(trap, handler, argc, argv, &threw); + return Execution::Call(isolate, trap, handler, argc, argv, &threw); } @@ -11045,7 +11048,8 @@ static void EnqueueSpliceRecord(Handle object, { object, index_object, deleted, add_count_object }; bool threw; - Execution::Call(Handle(isolate->observers_enqueue_splice()), + Execution::Call(isolate, + Handle(isolate->observers_enqueue_splice()), isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, &threw); ASSERT(!threw); @@ -11058,7 +11062,8 @@ static void BeginPerformSplice(Handle object) { Handle args[] = { object }; bool threw; - Execution::Call(Handle(isolate->observers_begin_perform_splice()), + Execution::Call(isolate, + Handle(isolate->observers_begin_perform_splice()), isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, &threw); ASSERT(!threw); @@ -11071,7 +11076,8 @@ static void EndPerformSplice(Handle object) { Handle args[] = { object }; bool threw; - Execution::Call(Handle(isolate->observers_end_perform_splice()), + Execution::Call(isolate, + Handle(isolate->observers_end_perform_splice()), isolate->factory()->undefined_value(), ARRAY_SIZE(args), args, &threw); ASSERT(!threw); diff --git a/src/runtime.cc b/src/runtime.cc index 5c6bf39..350b9ef 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -8667,8 +8667,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Call) { bool threw; Handle hfun(fun); Handle hreceiver(receiver, isolate); - Handle result = - Execution::Call(hfun, hreceiver, argc, argv, &threw, true); + Handle result = Execution::Call( + isolate, hfun, hreceiver, argc, argv, &threw, true); if (threw) return Failure::Exception(); return *result; @@ -8702,8 +8702,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_Apply) { } bool threw; - Handle result = - Execution::Call(fun, receiver, argc, argv, &threw, true); + Handle result = Execution::Call( + isolate, fun, receiver, argc, argv, &threw, true); if (threw) return Failure::Exception(); return *result; @@ -12582,7 +12582,7 @@ static MaybeObject* DebugEvaluate(Isolate* isolate, shared, context, NOT_TENURED); bool pending_exception; Handle result = Execution::Call( - eval_fun, receiver, 0, NULL, &pending_exception); + isolate, eval_fun, receiver, 0, NULL, &pending_exception); if (pending_exception) return Failure::Exception(); @@ -13353,11 +13353,19 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ExecuteInDebugContext) { bool pending_exception; { if (without_debugger) { - result = Execution::Call(function, isolate->global_object(), 0, NULL, + result = Execution::Call(isolate, + function, + isolate->global_object(), + 0, + NULL, &pending_exception); } else { EnterDebugger enter_debugger(isolate); - result = Execution::Call(function, isolate->global_object(), 0, NULL, + result = Execution::Call(isolate, + function, + isolate->global_object(), + 0, + NULL, &pending_exception); } } @@ -14224,7 +14232,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFromCache) { // This handle is nor shared, nor used later, so it's safe. Handle argv[] = { key_handle }; bool pending_exception; - value = Execution::Call(factory, + value = Execution::Call(isolate, + factory, receiver, ARRAY_SIZE(argv), argv, diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h index 7fb25e8..3365493 100644 --- a/test/cctest/cctest.h +++ b/test/cctest/cctest.h @@ -91,6 +91,10 @@ class CcTest { static v8::Isolate* isolate() { return default_isolate_; } + static i::Isolate* i_isolate() { + return reinterpret_cast(default_isolate_); + } + // Helper function to initialize the VM. static void InitializeVM(CcTestExtensionFlags extensions = NO_EXTENSIONS); diff --git a/test/cctest/test-compiler.cc b/test/cctest/test-compiler.cc index b5ba46c..7e87e10 100644 --- a/test/cctest/test-compiler.cc +++ b/test/cctest/test-compiler.cc @@ -116,7 +116,7 @@ static Handle Compile(const char* source) { } -static double Inc(int x) { +static double Inc(Isolate* isolate, int x) { const char* source = "result = %d + 1;"; EmbeddedVector buffer; OS::SNPrintF(buffer, source, x); @@ -125,8 +125,8 @@ static double Inc(int x) { if (fun.is_null()) return -1; bool has_pending_exception; - Handle global(Isolate::Current()->context()->global_object()); - Execution::Call(fun, global, 0, NULL, &has_pending_exception); + Handle global(isolate->context()->global_object()); + Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception); CHECK(!has_pending_exception); return GetGlobalProperty("result")->ToObjectChecked()->Number(); } @@ -135,19 +135,19 @@ static double Inc(int x) { TEST(Inc) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); - CHECK_EQ(4.0, Inc(3)); + CHECK_EQ(4.0, Inc(CcTest::i_isolate(), 3)); } -static double Add(int x, int y) { +static double Add(Isolate* isolate, int x, int y) { Handle fun = Compile("result = x + y;"); if (fun.is_null()) return -1; SetGlobalProperty("x", Smi::FromInt(x)); SetGlobalProperty("y", Smi::FromInt(y)); bool has_pending_exception; - Handle global(Isolate::Current()->context()->global_object()); - Execution::Call(fun, global, 0, NULL, &has_pending_exception); + Handle global(isolate->context()->global_object()); + Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception); CHECK(!has_pending_exception); return GetGlobalProperty("result")->ToObjectChecked()->Number(); } @@ -156,18 +156,18 @@ static double Add(int x, int y) { TEST(Add) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); - CHECK_EQ(5.0, Add(2, 3)); + CHECK_EQ(5.0, Add(CcTest::i_isolate(), 2, 3)); } -static double Abs(int x) { +static double Abs(Isolate* isolate, int x) { Handle fun = Compile("if (x < 0) result = -x; else result = x;"); if (fun.is_null()) return -1; SetGlobalProperty("x", Smi::FromInt(x)); bool has_pending_exception; - Handle global(Isolate::Current()->context()->global_object()); - Execution::Call(fun, global, 0, NULL, &has_pending_exception); + Handle global(isolate->context()->global_object()); + Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception); CHECK(!has_pending_exception); return GetGlobalProperty("result")->ToObjectChecked()->Number(); } @@ -176,19 +176,19 @@ static double Abs(int x) { TEST(Abs) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); - CHECK_EQ(3.0, Abs(-3)); + CHECK_EQ(3.0, Abs(CcTest::i_isolate(), -3)); } -static double Sum(int n) { +static double Sum(Isolate* isolate, int n) { Handle fun = Compile("s = 0; while (n > 0) { s += n; n -= 1; }; result = s;"); if (fun.is_null()) return -1; SetGlobalProperty("n", Smi::FromInt(n)); bool has_pending_exception; - Handle global(Isolate::Current()->context()->global_object()); - Execution::Call(fun, global, 0, NULL, &has_pending_exception); + Handle global(isolate->context()->global_object()); + Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception); CHECK(!has_pending_exception); return GetGlobalProperty("result")->ToObjectChecked()->Number(); } @@ -197,7 +197,7 @@ static double Sum(int n) { TEST(Sum) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); - CHECK_EQ(5050.0, Sum(100)); + CHECK_EQ(5050.0, Sum(CcTest::i_isolate(), 100)); } @@ -208,8 +208,9 @@ TEST(Print) { Handle fun = Compile(source); if (fun.is_null()) return; bool has_pending_exception; - Handle global(Isolate::Current()->context()->global_object()); - Execution::Call(fun, global, 0, NULL, &has_pending_exception); + Handle global(CcTest::i_isolate()->context()->global_object()); + Execution::Call( + CcTest::i_isolate(), fun, global, 0, NULL, &has_pending_exception); CHECK(!has_pending_exception); } @@ -241,8 +242,9 @@ TEST(Stuff) { Handle fun = Compile(source); CHECK(!fun.is_null()); bool has_pending_exception; - Handle global(Isolate::Current()->context()->global_object()); - Execution::Call(fun, global, 0, NULL, &has_pending_exception); + Handle global(CcTest::i_isolate()->context()->global_object()); + Execution::Call( + CcTest::i_isolate(), fun, global, 0, NULL, &has_pending_exception); CHECK(!has_pending_exception); CHECK_EQ(511.0, GetGlobalProperty("r")->ToObjectChecked()->Number()); } @@ -258,7 +260,7 @@ TEST(UncaughtThrow) { bool has_pending_exception; Isolate* isolate = fun->GetIsolate(); Handle global(isolate->context()->global_object()); - Execution::Call(fun, global, 0, NULL, &has_pending_exception); + Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception); CHECK(has_pending_exception); CHECK_EQ(42.0, isolate->pending_exception()->ToObjectChecked()->Number()); } @@ -282,8 +284,9 @@ TEST(C2JSFrames) { // Run the generated code to populate the global object with 'foo'. bool has_pending_exception; - Handle global(Isolate::Current()->context()->global_object()); - Execution::Call(fun0, global, 0, NULL, &has_pending_exception); + Handle global(isolate->context()->global_object()); + Execution::Call( + isolate, fun0, global, 0, NULL, &has_pending_exception); CHECK(!has_pending_exception); Object* foo_string = isolate->factory()->InternalizeOneByteString( @@ -295,7 +298,8 @@ TEST(C2JSFrames) { Handle argv[] = { isolate->factory()->InternalizeOneByteString( STATIC_ASCII_VECTOR("hello")) }; - Execution::Call(Handle::cast(fun1), + Execution::Call(isolate, + Handle::cast(fun1), global, ARRAY_SIZE(argv), argv, diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc index 99c3970..80b276c 100644 --- a/test/cctest/test-parsing.cc +++ b/test/cctest/test-parsing.cc @@ -1067,8 +1067,8 @@ i::Handle FormatMessage(i::ScriptDataImpl* data) { i::GetProperty(builtins, "FormatMessage"); i::Handle arg_handles[] = { format, args_array }; bool has_exception = false; - i::Handle result = - i::Execution::Call(format_fun, builtins, 2, arg_handles, &has_exception); + i::Handle result = i::Execution::Call( + isolate, format_fun, builtins, 2, arg_handles, &has_exception); CHECK(!has_exception); CHECK(result->IsString()); for (int i = 0; i < args.length(); i++) { diff --git a/test/cctest/test-random.cc b/test/cctest/test-random.cc index 2f7ab7d..804546a 100644 --- a/test/cctest/test-random.cc +++ b/test/cctest/test-random.cc @@ -53,8 +53,8 @@ void TestSeeds(Handle fun, Handle seeds(context->random_seed()); SetSeeds(seeds, state0, state1); - Handle value = - Execution::Call(fun, global, 0, NULL, &has_pending_exception); + Handle value = Execution::Call( + context->GetIsolate(), fun, global, 0, NULL, &has_pending_exception); CHECK(value->IsHeapNumber()); CHECK(fun->IsOptimized()); double crankshaft_value = HeapNumber::cast(*value)->value(); @@ -70,11 +70,12 @@ TEST(CrankshaftRandom) { v8::V8::Initialize(); // Skip test if crankshaft is disabled. if (!Isolate::Current()->use_crankshaft()) return; - v8::Isolate* isolate = v8::Isolate::GetCurrent(); - v8::HandleScope scope(isolate); - v8::Context::Scope context_scope(v8::Context::New(isolate)); + v8::Isolate* v8_isolate = v8::Isolate::GetCurrent(); + v8::HandleScope scope(v8_isolate); + v8::Context::Scope context_scope(v8::Context::New(v8_isolate)); - Handle context(Isolate::Current()->context()); + i::Isolate* isolate = reinterpret_cast(v8_isolate); + Handle context(isolate->context()); Handle global(context->global_object()); Handle seeds(context->random_seed()); bool has_pending_exception; @@ -88,8 +89,8 @@ TEST(CrankshaftRandom) { Handle fun(JSFunction::cast(fun_object->ToObjectChecked())); // Optimize function. - Execution::Call(fun, global, 0, NULL, &has_pending_exception); - Execution::Call(fun, global, 0, NULL, &has_pending_exception); + Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception); + Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception); if (!fun->IsOptimized()) fun->MarkForLazyRecompilation(); // Test with some random values. @@ -100,7 +101,7 @@ TEST(CrankshaftRandom) { // Test that we bail out to runtime when seeds are uninitialized (zeros). SetSeeds(seeds, 0, 0); Handle value = - Execution::Call(fun, global, 0, NULL, &has_pending_exception); + Execution::Call(isolate, fun, global, 0, NULL, &has_pending_exception); CHECK(value->IsHeapNumber()); CHECK(fun->IsOptimized()); double crankshaft_value = HeapNumber::cast(*value)->value(); -- 2.7.4