Commit 54572833 authored by dcarney@chromium.org's avatar dcarney@chromium.org

remove remaining uses of default isolate in tests

R=svenpanne@chromium.org
BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16858 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6fce4960
......@@ -31,6 +31,7 @@
enum InitializationState {kUnset, kUnintialized, kInitialized};
static InitializationState initialization_state_ = kUnset;
static bool disable_automatic_dispose_ = false;
CcTest* CcTest::last_ = NULL;
bool CcTest::initialize_called_ = false;
......@@ -66,14 +67,10 @@ void CcTest::Run() {
if (!initialize_) {
CHECK(initialization_state_ != kInitialized);
initialization_state_ = kUnintialized;
// TODO(dcarney): Remove this when default isolate is gone.
if (isolate_ == NULL) {
isolate_ = v8::Isolate::GetCurrent();
}
CHECK(CcTest::isolate_ == NULL);
} else {
CHECK(initialization_state_ != kUnintialized);
initialization_state_ = kInitialized;
i::Isolate::SetCrashIfDefaultIsolateInitialized();
if (isolate_ == NULL) {
isolate_ = v8::Isolate::New();
}
......@@ -101,6 +98,12 @@ v8::Local<v8::Context> CcTest::NewContext(CcTestExtensionFlags extensions,
}
void CcTest::DisableAutomaticDispose() {
CHECK_EQ(kUnintialized, initialization_state_);
disable_automatic_dispose_ = true;
}
static void PrintTestList(CcTest* current) {
if (current == NULL) return;
PrintTestList(current->prev());
......@@ -131,6 +134,7 @@ static void SuggestTestHarness(int tests) {
int main(int argc, char* argv[]) {
v8::V8::InitializeICU();
i::Isolate::SetCrashIfDefaultIsolateInitialized();
v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true);
......@@ -184,7 +188,7 @@ int main(int argc, char* argv[]) {
}
if (print_run_count && tests_run != 1)
printf("Ran %i tests.\n", tests_run);
v8::V8::Dispose();
if (!disable_automatic_dispose_) v8::V8::Dispose();
return 0;
}
......
......@@ -93,6 +93,7 @@ class CcTest {
bool enabled() { return enabled_; }
static v8::Isolate* isolate() {
CHECK(isolate_ != NULL);
isolate_used_ = true;
return isolate_;
}
......@@ -115,6 +116,9 @@ class CcTest {
v8::Context::New(CcTest::isolate())->Enter();
}
// Only for UNINITIALIZED_TESTs
static void DisableAutomaticDispose();
// Helper function to configure a context.
// Must be in a HandleScope.
static v8::Local<v8::Context> NewContext(
......
......@@ -12446,28 +12446,28 @@ void ApiTestFuzzer::TearDown() {
// Lets not be needlessly self-referential.
UNINITIALIZED_TEST(Threading1) {
TEST(Threading1) {
ApiTestFuzzer::SetUp(ApiTestFuzzer::FIRST_PART);
ApiTestFuzzer::RunAllTests();
ApiTestFuzzer::TearDown();
}
UNINITIALIZED_TEST(Threading2) {
TEST(Threading2) {
ApiTestFuzzer::SetUp(ApiTestFuzzer::SECOND_PART);
ApiTestFuzzer::RunAllTests();
ApiTestFuzzer::TearDown();
}
UNINITIALIZED_TEST(Threading3) {
TEST(Threading3) {
ApiTestFuzzer::SetUp(ApiTestFuzzer::THIRD_PART);
ApiTestFuzzer::RunAllTests();
ApiTestFuzzer::TearDown();
}
UNINITIALIZED_TEST(Threading4) {
TEST(Threading4) {
ApiTestFuzzer::SetUp(ApiTestFuzzer::FOURTH_PART);
ApiTestFuzzer::RunAllTests();
ApiTestFuzzer::TearDown();
......@@ -12475,6 +12475,7 @@ UNINITIALIZED_TEST(Threading4) {
void ApiTestFuzzer::CallTest() {
v8::Isolate::Scope scope(CcTest::isolate());
if (kLogThreading)
printf("Start test %d\n", test_number_);
CallTestNumber(test_number_);
......@@ -14257,6 +14258,7 @@ class RegExpInterruptTest {
while (gc_during_regexp_ < kRequiredGCs) {
{
v8::Locker lock(CcTest::isolate());
v8::Isolate::Scope isolate_scope(CcTest::isolate());
// TODO(lrn): Perhaps create some garbage before collecting.
CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
gc_count_++;
......@@ -14315,9 +14317,8 @@ class RegExpInterruptTest {
// Test that a regular expression execution can be interrupted and
// survive a garbage collection.
UNINITIALIZED_TEST(RegExpInterruption) {
TEST(RegExpInterruption) {
v8::Locker lock(CcTest::isolate());
v8::V8::Initialize();
v8::HandleScope scope(CcTest::isolate());
Local<Context> local_env;
{
......@@ -14379,6 +14380,7 @@ class ApplyInterruptTest {
while (gc_during_apply_ < kRequiredGCs) {
{
v8::Locker lock(CcTest::isolate());
v8::Isolate::Scope isolate_scope(CcTest::isolate());
CcTest::heap()->CollectAllGarbage(i::Heap::kNoGCFlags);
gc_count_++;
}
......@@ -14423,7 +14425,7 @@ class ApplyInterruptTest {
// Test that nothing bad happens if we get a preemption just when we were
// about to do an apply().
UNINITIALIZED_TEST(ApplyInterruption) {
TEST(ApplyInterruption) {
v8::Locker lock(CcTest::isolate());
v8::V8::Initialize();
v8::HandleScope scope(CcTest::isolate());
......@@ -14694,6 +14696,7 @@ class RegExpStringModificationTest {
morphs_ < kMaxModifications) {
{
v8::Locker lock(CcTest::isolate());
v8::Isolate::Scope isolate_scope(CcTest::isolate());
// Swap string between ascii and two-byte representation.
i::String* string = *input_;
MorphAString(string, &ascii_resource_, &uc16_resource_);
......@@ -14740,9 +14743,8 @@ class RegExpStringModificationTest {
// Test that a regular expression execution can be interrupted and
// the string changed without failing.
UNINITIALIZED_TEST(RegExpStringModification) {
TEST(RegExpStringModification) {
v8::Locker lock(CcTest::isolate());
v8::V8::Initialize();
v8::HandleScope scope(CcTest::isolate());
Local<Context> local_env;
{
......@@ -19738,7 +19740,9 @@ TEST(StaticGetters) {
UNINITIALIZED_TEST(IsolateEmbedderData) {
v8::Isolate* isolate = CcTest::isolate();
CcTest::DisableAutomaticDispose();
v8::Isolate* isolate = v8::Isolate::New();
isolate->Enter();
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
CHECK_EQ(NULL, isolate->GetData());
CHECK_EQ(NULL, i_isolate->GetData());
......
......@@ -5142,7 +5142,7 @@ void V8Thread::Run() {
"\n"
"foo();\n";
v8::V8::Initialize();
v8::Isolate::Scope isolate_scope(CcTest::isolate());
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::Debug::SetMessageHandler2(&ThreadedMessageHandler);
......@@ -5179,7 +5179,7 @@ void DebuggerThread::Run() {
}
UNINITIALIZED_TEST(ThreadedDebugging) {
TEST(ThreadedDebugging) {
DebuggerThread debugger_thread;
V8Thread v8_thread;
......@@ -5258,9 +5258,10 @@ void BreakpointsV8Thread::Run() {
const char* source_2 = "cat(17);\n"
"cat(19);\n";
v8::V8::Initialize();
v8::Isolate* isolate = CcTest::isolate();
v8::Isolate::Scope isolate_scope(isolate);
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
v8::HandleScope scope(isolate);
v8::Debug::SetMessageHandler2(&BreakpointsMessageHandler);
CompileRun(source_1);
......@@ -5333,6 +5334,7 @@ void BreakpointsDebuggerThread::Run() {
v8::Isolate* isolate = CcTest::isolate();
v8::Isolate::Scope isolate_scope(isolate);
// v8 thread initializes, runs source_1
breakpoints_barriers->barrier_1.Wait();
// 1:Set breakpoint in cat() (will get id 1).
......@@ -5403,12 +5405,12 @@ void TestRecursiveBreakpointsGeneric(bool global_evaluate) {
}
UNINITIALIZED_TEST(RecursiveBreakpoints) {
TEST(RecursiveBreakpoints) {
TestRecursiveBreakpointsGeneric(false);
}
UNINITIALIZED_TEST(RecursiveBreakpointsGlobal) {
TEST(RecursiveBreakpointsGlobal) {
TestRecursiveBreakpointsGeneric(true);
}
......@@ -5789,7 +5791,7 @@ void HostDispatchV8Thread::Run() {
"\n";
const char* source_2 = "cat(17);\n";
v8::V8::Initialize();
v8::Isolate::Scope isolate_scope(CcTest::isolate());
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
......@@ -5832,7 +5834,7 @@ void HostDispatchDebuggerThread::Run() {
}
UNINITIALIZED_TEST(DebuggerHostDispatch) {
TEST(DebuggerHostDispatch) {
HostDispatchDebuggerThread host_dispatch_debugger_thread;
HostDispatchV8Thread host_dispatch_v8_thread;
i::FLAG_debugger_auto_break = true;
......@@ -5877,7 +5879,7 @@ static void DebugMessageHandler() {
void DebugMessageDispatchV8Thread::Run() {
v8::V8::Initialize();
v8::Isolate::Scope isolate_scope(CcTest::isolate());
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
......@@ -5898,7 +5900,7 @@ void DebugMessageDispatchDebuggerThread::Run() {
}
UNINITIALIZED_TEST(DebuggerDebugMessageDispatch) {
TEST(DebuggerDebugMessageDispatch) {
DebugMessageDispatchDebuggerThread debug_message_dispatch_debugger_thread;
DebugMessageDispatchV8Thread debug_message_dispatch_v8_thread;
......@@ -6363,13 +6365,13 @@ static void DebugEventDebugBreak(
// Keep forcing breaks.
if (break_point_hit_count < 20) {
v8::Debug::DebugBreak();
v8::Debug::DebugBreak(CcTest::isolate());
}
}
}
UNINITIALIZED_TEST(RegExpDebugBreak) {
TEST(RegExpDebugBreak) {
// This test only applies to native regexps.
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
......@@ -6805,7 +6807,7 @@ static void BreakMessageHandler(const v8::Debug::Message& message) {
// Test that if DebugBreak is forced it is ignored when code from
// debug-delay.js is executed.
UNINITIALIZED_TEST(NoDebugBreakInAfterCompileMessageHandler) {
TEST(NoDebugBreakInAfterCompileMessageHandler) {
DebugLocalContext env;
v8::HandleScope scope(env->GetIsolate());
......@@ -6813,7 +6815,7 @@ UNINITIALIZED_TEST(NoDebugBreakInAfterCompileMessageHandler) {
v8::Debug::SetMessageHandler2(BreakMessageHandler);
// Set the debug break flag.
v8::Debug::DebugBreak();
v8::Debug::DebugBreak(env->GetIsolate());
// Create a function for testing stepping.
const char* src = "function f() { eval('var x = 10;'); } ";
......
......@@ -610,6 +610,7 @@ class LockUnlockLockDefaultIsolateThread : public JoinableThread {
virtual void Run() {
v8::Locker lock1(CcTest::isolate());
{
v8::Isolate::Scope isolate_scope(CcTest::isolate());
v8::HandleScope handle_scope(CcTest::isolate());
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(CcTest::isolate(), context_);
......@@ -620,6 +621,7 @@ class LockUnlockLockDefaultIsolateThread : public JoinableThread {
v8::Unlocker unlock1(CcTest::isolate());
{
v8::Locker lock2(CcTest::isolate());
v8::Isolate::Scope isolate_scope(CcTest::isolate());
v8::HandleScope handle_scope(CcTest::isolate());
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(CcTest::isolate(), context_);
......@@ -635,7 +637,7 @@ class LockUnlockLockDefaultIsolateThread : public JoinableThread {
// Locker inside an Unlocker inside a Locker for default isolate.
UNINITIALIZED_TEST(LockUnlockLockDefaultIsolateMultithreaded) {
TEST(LockUnlockLockDefaultIsolateMultithreaded) {
#if V8_TARGET_ARCH_MIPS
const int kNThreads = 50;
#else
......@@ -645,6 +647,7 @@ UNINITIALIZED_TEST(LockUnlockLockDefaultIsolateMultithreaded) {
i::List<JoinableThread*> threads(kNThreads);
{
v8::Locker locker_(CcTest::isolate());
v8::Isolate::Scope isolate_scope(CcTest::isolate());
v8::HandleScope handle_scope(CcTest::isolate());
context = v8::Context::New(CcTest::isolate());
for (int i = 0; i < kNThreads; i++) {
......
......@@ -326,7 +326,7 @@ static void ObjMethod1(const v8::FunctionCallbackInfo<v8::Value>& args) {
}
UNINITIALIZED_TEST(LogCallbacks) {
TEST(LogCallbacks) {
ScopedLoggerInitializer initialize_logger;
Logger* logger = initialize_logger.logger();
......@@ -375,7 +375,7 @@ static void Prop2Getter(v8::Local<v8::String> property,
}
UNINITIALIZED_TEST(LogAccessorCallbacks) {
TEST(LogAccessorCallbacks) {
ScopedLoggerInitializer initialize_logger;
Logger* logger = initialize_logger.logger();
......@@ -422,7 +422,7 @@ typedef i::NativesCollection<i::TEST> TestSources;
// Test that logging of code create / move events is equivalent to traversal of
// a resulting heap.
UNINITIALIZED_TEST(EquivalenceOfLoggingAndTraversal) {
TEST(EquivalenceOfLoggingAndTraversal) {
// This test needs to be run on a "clean" V8 to ensure that snapshot log
// is loaded. This is always true when running using tools/test.py because
// it launches a new cctest instance for every test. To be sure that launching
......
......@@ -403,8 +403,7 @@ static void ExpectError(const char* input,
}
UNINITIALIZED_TEST(Errors) {
V8::Initialize(NULL);
TEST(Errors) {
const char* kEndBackslash = "\\ at end of pattern";
ExpectError("\\", kEndBackslash);
const char* kUnterminatedGroup = "Unterminated group";
......
......@@ -264,7 +264,7 @@ static void Serialize() {
// Test that the whole heap can be serialized.
UNINITIALIZED_TEST(Serialize) {
TEST(Serialize) {
if (!Snapshot::HaveASnapshotToStartFrom()) {
Serializer::Enable(CcTest::i_isolate());
v8::V8::Initialize();
......@@ -274,7 +274,7 @@ UNINITIALIZED_TEST(Serialize) {
// Test that heap serialization is non-destructive.
UNINITIALIZED_TEST(SerializeTwice) {
TEST(SerializeTwice) {
if (!Snapshot::HaveASnapshotToStartFrom()) {
Serializer::Enable(CcTest::i_isolate());
v8::V8::Initialize();
......@@ -372,7 +372,7 @@ DEPENDENT_TEST(DeserializeFromSecondSerializationAndRunScript2,
}
UNINITIALIZED_TEST(PartialSerialization) {
TEST(PartialSerialization) {
if (!Snapshot::HaveASnapshotToStartFrom()) {
Isolate* isolate = CcTest::i_isolate();
Serializer::Enable(isolate);
......@@ -523,7 +523,7 @@ DEPENDENT_TEST(PartialDeserialization, PartialSerialization) {
}
UNINITIALIZED_TEST(ContextSerialization) {
TEST(ContextSerialization) {
if (!Snapshot::HaveASnapshotToStartFrom()) {
Isolate* isolate = CcTest::i_isolate();
Serializer::Enable(isolate);
......
......@@ -39,7 +39,7 @@ void Signal(const v8::FunctionCallbackInfo<v8::Value>& args) {
void TerminateCurrentThread(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
v8::V8::TerminateExecution(args.GetIsolate());
}
......@@ -50,18 +50,18 @@ void Fail(const v8::FunctionCallbackInfo<v8::Value>& args) {
void Loop(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
v8::Handle<v8::String> source =
v8::String::New("try { doloop(); fail(); } catch(e) { fail(); }");
v8::Handle<v8::Value> result = v8::Script::Compile(source)->Run();
CHECK(result.IsEmpty());
CHECK(v8::V8::IsExecutionTerminating());
CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate()));
}
void DoLoop(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
v8::Script::Compile(v8::String::New("function f() {"
" var term = true;"
" try {"
......@@ -79,13 +79,13 @@ void DoLoop(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(try_catch.Exception()->IsNull());
CHECK(try_catch.Message().IsEmpty());
CHECK(!try_catch.CanContinue());
CHECK(v8::V8::IsExecutionTerminating());
CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate()));
}
void DoLoopNoCall(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
v8::Script::Compile(v8::String::New("var term = true;"
"while(true) {"
" if (term) terminate();"
......@@ -95,7 +95,7 @@ void DoLoopNoCall(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(try_catch.Exception()->IsNull());
CHECK(try_catch.Message().IsEmpty());
CHECK(!try_catch.CanContinue());
CHECK(v8::V8::IsExecutionTerminating());
CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate()));
}
......@@ -121,13 +121,13 @@ TEST(TerminateOnlyV8ThreadFromThreadItself) {
v8::Handle<v8::Context> context =
v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
// Run a loop that will be infinite if thread termination does not work.
v8::Handle<v8::String> source =
v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
v8::Script::Compile(source)->Run();
// Test that we can run the code again after thread termination.
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
v8::Script::Compile(source)->Run();
}
......@@ -141,12 +141,12 @@ TEST(TerminateOnlyV8ThreadFromThreadItselfNoLoop) {
v8::Handle<v8::Context> context =
v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
// Run a loop that will be infinite if thread termination does not work.
v8::Handle<v8::String> source =
v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
v8::Script::Compile(source)->Run();
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
// Test that we can run the code again after thread termination.
v8::Script::Compile(source)->Run();
}
......@@ -180,7 +180,7 @@ TEST(TerminateOnlyV8ThreadFromOtherThread) {
v8::Handle<v8::Context> context =
v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
// Run a loop that will be infinite if thread termination does not work.
v8::Handle<v8::String> source =
v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
......@@ -197,8 +197,8 @@ int call_count = 0;
void TerminateOrReturnObject(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (++call_count == 10) {
CHECK(!v8::V8::IsExecutionTerminating());
v8::V8::TerminateExecution();
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
v8::V8::TerminateExecution(args.GetIsolate());
return;
}
v8::Local<v8::Object> result = v8::Object::New();
......@@ -209,7 +209,7 @@ void TerminateOrReturnObject(const v8::FunctionCallbackInfo<v8::Value>& args) {
void LoopGetProperty(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
v8::Script::Compile(v8::String::New("function f() {"
" try {"
" while(true) {"
......@@ -225,13 +225,13 @@ void LoopGetProperty(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(try_catch.Exception()->IsNull());
CHECK(try_catch.Message().IsEmpty());
CHECK(!try_catch.CanContinue());
CHECK(v8::V8::IsExecutionTerminating());
CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate()));
}
// Test that we correctly handle termination exceptions if they are
// triggered by the creation of error objects in connection with ICs.
UNINITIALIZED_TEST(TerminateLoadICException) {
TEST(TerminateLoadICException) {
v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
global->Set(v8::String::New("terminate_or_return_object"),
......@@ -243,14 +243,14 @@ UNINITIALIZED_TEST(TerminateLoadICException) {
v8::Handle<v8::Context> context =
v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
// Run a loop that will be infinite if thread termination does not work.
v8::Handle<v8::String> source =
v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
call_count = 0;
v8::Script::Compile(source)->Run();
// Test that we can run the code again after thread termination.
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
call_count = 0;
v8::Script::Compile(source)->Run();
}
......@@ -258,7 +258,7 @@ UNINITIALIZED_TEST(TerminateLoadICException) {
void ReenterAfterTermination(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(args.GetIsolate()));
v8::Script::Compile(v8::String::New("function f() {"
" var term = true;"
" try {"
......@@ -276,7 +276,7 @@ void ReenterAfterTermination(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(try_catch.Exception()->IsNull());
CHECK(try_catch.Message().IsEmpty());
CHECK(!try_catch.CanContinue());
CHECK(v8::V8::IsExecutionTerminating());
CHECK(v8::V8::IsExecutionTerminating(args.GetIsolate()));
v8::Script::Compile(v8::String::New("function f() { fail(); } f()"))->Run();
}
......@@ -294,7 +294,7 @@ TEST(TerminateAndReenterFromThreadItself) {
v8::Handle<v8::String> source =
v8::String::New("try { loop(); fail(); } catch(e) { fail(); }");
v8::Script::Compile(source)->Run();
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
// Check we can run JS again after termination.
CHECK(v8::Script::Compile(v8::String::New("function f() { return true; }"
"f()"))->Run()->IsTrue());
......@@ -330,7 +330,7 @@ TEST(TerminateCancelTerminateFromThreadItself) {
CreateGlobalTemplate(TerminateCurrentThread, DoLoopCancelTerminate);
v8::Handle<v8::Context> context = v8::Context::New(isolate, NULL, global);
v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating());
CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate()));
v8::Handle<v8::String> source =
v8::String::New("try { doloop(); } catch(e) { fail(); } 'completed';");
// Check that execution completed with correct return value.
......
......@@ -71,6 +71,7 @@ class ThreadA : public v8::internal::Thread {
void Run() {
v8::Isolate* isolate = CcTest::isolate();
v8::Locker locker(isolate);
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope scope(isolate);
v8::Handle<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context);
......@@ -111,6 +112,7 @@ class ThreadB : public v8::internal::Thread {
{
v8::Isolate* isolate = CcTest::isolate();
v8::Locker locker(isolate);
v8::Isolate::Scope isolate_scope(isolate);
if (turn == CLEAN_CACHE) {
v8::HandleScope scope(isolate);
v8::Handle<v8::Context> context = v8::Context::New(isolate);
......@@ -129,9 +131,7 @@ class ThreadB : public v8::internal::Thread {
};
UNINITIALIZED_TEST(JSFunctionResultCachesInTwoThreads) {
v8::V8::Initialize();
TEST(JSFunctionResultCachesInTwoThreads) {
ThreadA threadA;
ThreadB threadB;
......
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