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

bulk replace v8::Isolate::GetCurrent in tests

R=svenpanne@chromium.org
BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16813 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9888027e
...@@ -120,7 +120,7 @@ THREADED_TEST(GlobalVariableAccess) { ...@@ -120,7 +120,7 @@ THREADED_TEST(GlobalVariableAccess) {
foo = 0; foo = 0;
bar = -4; bar = -4;
baz = 10; baz = 10;
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(); v8::Handle<v8::FunctionTemplate> templ = v8::FunctionTemplate::New();
templ->InstanceTemplate()->SetAccessor(v8_str("foo"), templ->InstanceTemplate()->SetAccessor(v8_str("foo"),
GetIntValue, GetIntValue,
...@@ -148,7 +148,7 @@ static v8::Handle<v8::Object> x_holder; ...@@ -148,7 +148,7 @@ static v8::Handle<v8::Object> x_holder;
template<class Info> template<class Info>
static void XGetter(const Info& info, int offset) { static void XGetter(const Info& info, int offset) {
ApiTestFuzzer::Fuzz(); ApiTestFuzzer::Fuzz();
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
CHECK_EQ(isolate, info.GetIsolate()); CHECK_EQ(isolate, info.GetIsolate());
CHECK_EQ(x_receiver, info.This()); CHECK_EQ(x_receiver, info.This());
info.GetReturnValue().Set(v8_num(x_register[offset])); info.GetReturnValue().Set(v8_num(x_register[offset]));
...@@ -170,7 +170,7 @@ static void XGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { ...@@ -170,7 +170,7 @@ static void XGetter(const v8::FunctionCallbackInfo<v8::Value>& info) {
template<class Info> template<class Info>
static void XSetter(Local<Value> value, const Info& info, int offset) { static void XSetter(Local<Value> value, const Info& info, int offset) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
CHECK_EQ(isolate, info.GetIsolate()); CHECK_EQ(isolate, info.GetIsolate());
CHECK_EQ(x_holder, info.This()); CHECK_EQ(x_holder, info.This());
CHECK_EQ(x_holder, info.Holder()); CHECK_EQ(x_holder, info.Holder());
...@@ -310,15 +310,15 @@ THREADED_TEST(HandleScopePop) { ...@@ -310,15 +310,15 @@ THREADED_TEST(HandleScopePop) {
static void CheckAccessorArgsCorrect( static void CheckAccessorArgsCorrect(
Local<String> name, Local<String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) { const v8::PropertyCallbackInfo<v8::Value>& info) {
CHECK(info.GetIsolate() == v8::Isolate::GetCurrent()); CHECK(info.GetIsolate() == CcTest::isolate());
CHECK(info.This() == info.Holder()); CHECK(info.This() == info.Holder());
CHECK(info.Data()->Equals(v8::String::New("data"))); CHECK(info.Data()->Equals(v8::String::New("data")));
ApiTestFuzzer::Fuzz(); ApiTestFuzzer::Fuzz();
CHECK(info.GetIsolate() == v8::Isolate::GetCurrent()); CHECK(info.GetIsolate() == CcTest::isolate());
CHECK(info.This() == info.Holder()); CHECK(info.This() == info.Holder());
CHECK(info.Data()->Equals(v8::String::New("data"))); CHECK(info.Data()->Equals(v8::String::New("data")));
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
CHECK(info.GetIsolate() == v8::Isolate::GetCurrent()); CHECK(info.GetIsolate() == CcTest::isolate());
CHECK(info.This() == info.Holder()); CHECK(info.This() == info.Holder());
CHECK(info.Data()->Equals(v8::String::New("data"))); CHECK(info.Data()->Equals(v8::String::New("data")));
info.GetReturnValue().Set(17); info.GetReturnValue().Set(17);
...@@ -370,7 +370,7 @@ THREADED_TEST(EmptyResult) { ...@@ -370,7 +370,7 @@ THREADED_TEST(EmptyResult) {
THREADED_TEST(NoReuseRegress) { THREADED_TEST(NoReuseRegress) {
// Check that the IC generated for the one test doesn't get reused // Check that the IC generated for the one test doesn't get reused
// for the other. // for the other.
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
{ {
v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New();
obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data")); obj->SetAccessor(v8_str("xxx"), EmptyGetter, NULL, v8::String::New("data"));
......
...@@ -95,8 +95,8 @@ static Handle<Object> Test() { ...@@ -95,8 +95,8 @@ static Handle<Object> Test() {
TEST(StressHandles) { TEST(StressHandles) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Context> env = v8::Context::New(v8::Isolate::GetCurrent()); v8::Handle<v8::Context> env = v8::Context::New(CcTest::isolate());
env->Enter(); env->Enter();
Handle<Object> o = Test(); Handle<Object> o = Test();
CHECK(o->IsSmi() && Smi::cast(*o)->value() == 42); CHECK(o->IsSmi() && Smi::cast(*o)->value() == 42);
...@@ -119,8 +119,8 @@ const AccessorDescriptor kDescriptor = { ...@@ -119,8 +119,8 @@ const AccessorDescriptor kDescriptor = {
TEST(StressJS) { TEST(StressJS) {
Isolate* isolate = Isolate::Current(); Isolate* isolate = Isolate::Current();
Factory* factory = isolate->factory(); Factory* factory = isolate->factory();
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Context> env = v8::Context::New(v8::Isolate::GetCurrent()); v8::Handle<v8::Context> env = v8::Context::New(CcTest::isolate());
env->Enter(); env->Enter();
Handle<JSFunction> function = Handle<JSFunction> function =
factory->NewFunction(factory->function_string(), factory->null_value()); factory->NewFunction(factory->function_string(), factory->null_value());
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -532,7 +532,7 @@ TEST(StackAlignmentForSSE2) { ...@@ -532,7 +532,7 @@ TEST(StackAlignmentForSSE2) {
CHECK_EQ(0, OS::ActivationFrameAlignment() % 16); CHECK_EQ(0, OS::ActivationFrameAlignment() % 16);
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->Set(v8_str("do_sse2"), v8::FunctionTemplate::New(DoSSE2)); global_template->Set(v8_str("do_sse2"), v8::FunctionTemplate::New(DoSSE2));
......
...@@ -485,7 +485,7 @@ void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -485,7 +485,7 @@ void DoSSE2(const v8::FunctionCallbackInfo<v8::Value>& args) {
TEST(StackAlignmentForSSE2) { TEST(StackAlignmentForSSE2) {
CHECK_EQ(0, OS::ActivationFrameAlignment() % 16); CHECK_EQ(0, OS::ActivationFrameAlignment() % 16);
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->Set(v8_str("do_sse2"), v8::FunctionTemplate::New(DoSSE2)); global_template->Set(v8_str("do_sse2"), v8::FunctionTemplate::New(DoSSE2));
......
...@@ -142,9 +142,9 @@ class DebugLocalContext { ...@@ -142,9 +142,9 @@ class DebugLocalContext {
v8::Handle<v8::ObjectTemplate> global_template = v8::Handle<v8::ObjectTemplate> global_template =
v8::Handle<v8::ObjectTemplate>(), v8::Handle<v8::ObjectTemplate>(),
v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>()) v8::Handle<v8::Value> global_object = v8::Handle<v8::Value>())
: scope_(v8::Isolate::GetCurrent()), : scope_(CcTest::isolate()),
context_( context_(
v8::Context::New(v8::Isolate::GetCurrent(), v8::Context::New(CcTest::isolate(),
extensions, extensions,
global_template, global_template,
global_object)) { global_object)) {
...@@ -2552,7 +2552,7 @@ v8::Handle<v8::Function> checkFrameEvalFunction; ...@@ -2552,7 +2552,7 @@ v8::Handle<v8::Function> checkFrameEvalFunction;
static void CheckDebugEval(const v8::Debug::EventDetails& eventDetails) { static void CheckDebugEval(const v8::Debug::EventDetails& eventDetails) {
if (eventDetails.GetEvent() == v8::Break) { if (eventDetails.GetEvent() == v8::Break) {
++debugEventCount; ++debugEventCount;
v8::HandleScope handleScope(v8::Isolate::GetCurrent()); v8::HandleScope handleScope(CcTest::isolate());
v8::Handle<v8::Value> args[] = { eventDetails.GetExecutionState() }; v8::Handle<v8::Value> args[] = { eventDetails.GetExecutionState() };
CHECK(checkGlobalEvalFunction->Call( CHECK(checkGlobalEvalFunction->Call(
...@@ -4229,7 +4229,7 @@ static const char* kSimpleExtensionSource = ...@@ -4229,7 +4229,7 @@ static const char* kSimpleExtensionSource =
// http://crbug.com/28933 // http://crbug.com/28933
// Test that debug break is disabled when bootstrapper is active. // Test that debug break is disabled when bootstrapper is active.
TEST(NoBreakWhenBootstrapping) { TEST(NoBreakWhenBootstrapping) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
// Register a debug event listener which sets the break flag and counts. // Register a debug event listener which sets the break flag and counts.
...@@ -5149,7 +5149,7 @@ void V8Thread::Run() { ...@@ -5149,7 +5149,7 @@ void V8Thread::Run() {
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->Set(v8::String::New("ThreadedAtBarrier1"), global_template->Set(v8::String::New("ThreadedAtBarrier1"),
v8::FunctionTemplate::New(ThreadedAtBarrier1)); v8::FunctionTemplate::New(ThreadedAtBarrier1));
v8::Handle<v8::Context> context = v8::Context::New(v8::Isolate::GetCurrent(), v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(),
NULL, NULL,
global_template); global_template);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
...@@ -5502,7 +5502,7 @@ static void CheckClosure(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -5502,7 +5502,7 @@ static void CheckClosure(const v8::FunctionCallbackInfo<v8::Value>& args) {
TEST(CallFunctionInDebugger) { TEST(CallFunctionInDebugger) {
// Create and enter a context with the functions CheckFrameCount, // Create and enter a context with the functions CheckFrameCount,
// CheckSourceLine and CheckDataParameter installed. // CheckSourceLine and CheckDataParameter installed.
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->Set(v8::String::New("CheckFrameCount"), global_template->Set(v8::String::New("CheckFrameCount"),
v8::FunctionTemplate::New(CheckFrameCount)); v8::FunctionTemplate::New(CheckFrameCount));
...@@ -5512,7 +5512,7 @@ TEST(CallFunctionInDebugger) { ...@@ -5512,7 +5512,7 @@ TEST(CallFunctionInDebugger) {
v8::FunctionTemplate::New(CheckDataParameter)); v8::FunctionTemplate::New(CheckDataParameter));
global_template->Set(v8::String::New("CheckClosure"), global_template->Set(v8::String::New("CheckClosure"),
v8::FunctionTemplate::New(CheckClosure)); v8::FunctionTemplate::New(CheckClosure));
v8::Handle<v8::Context> context = v8::Context::New(v8::Isolate::GetCurrent(), v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate(),
NULL, NULL,
global_template); global_template);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
...@@ -6234,7 +6234,7 @@ static void ContextCheckMessageHandler(const v8::Debug::Message& message) { ...@@ -6234,7 +6234,7 @@ static void ContextCheckMessageHandler(const v8::Debug::Message& message) {
// Checks that this data is set correctly and that when the debug message // Checks that this data is set correctly and that when the debug message
// handler is called the expected context is the one active. // handler is called the expected context is the one active.
TEST(ContextData) { TEST(ContextData) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
// Create two contexts. // Create two contexts.
...@@ -6411,7 +6411,7 @@ static void ExecuteScriptForContextCheck( ...@@ -6411,7 +6411,7 @@ static void ExecuteScriptForContextCheck(
v8::Handle<v8::ObjectTemplate> global_template = v8::Handle<v8::ObjectTemplate> global_template =
v8::Handle<v8::ObjectTemplate>(); v8::Handle<v8::ObjectTemplate>();
context_1 = context_1 =
v8::Context::New(v8::Isolate::GetCurrent(), NULL, global_template); v8::Context::New(CcTest::isolate(), NULL, global_template);
v8::Debug::SetMessageHandler2(message_handler); v8::Debug::SetMessageHandler2(message_handler);
...@@ -6444,7 +6444,7 @@ static void ExecuteScriptForContextCheck( ...@@ -6444,7 +6444,7 @@ static void ExecuteScriptForContextCheck(
// break event in an eval statement the expected context is the one returned by // break event in an eval statement the expected context is the one returned by
// Message.GetEventContext. // Message.GetEventContext.
TEST(EvalContextData) { TEST(EvalContextData) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
ExecuteScriptForContextCheck(ContextCheckMessageHandler); ExecuteScriptForContextCheck(ContextCheckMessageHandler);
...@@ -6507,7 +6507,7 @@ static void DebugEvalContextCheckMessageHandler( ...@@ -6507,7 +6507,7 @@ static void DebugEvalContextCheckMessageHandler(
// Tests that context returned for break event is correct when the event occurs // Tests that context returned for break event is correct when the event occurs
// in 'evaluate' debugger request. // in 'evaluate' debugger request.
TEST(NestedBreakEventContextData) { TEST(NestedBreakEventContextData) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
break_count = 0; break_count = 0;
message_handler_hit_count = 0; message_handler_hit_count = 0;
...@@ -6583,7 +6583,7 @@ static void ScriptCollectedMessageHandler(const v8::Debug::Message& message) { ...@@ -6583,7 +6583,7 @@ static void ScriptCollectedMessageHandler(const v8::Debug::Message& message) {
// ScriptCollected events. // ScriptCollected events.
TEST(ScriptCollectedEventContext) { TEST(ScriptCollectedEventContext) {
i::FLAG_stress_compaction = false; i::FLAG_stress_compaction = false;
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::internal::Debug* debug = v8::internal::Debug* debug =
reinterpret_cast<v8::internal::Isolate*>(isolate)->debug(); reinterpret_cast<v8::internal::Isolate*>(isolate)->debug();
script_collected_message_count = 0; script_collected_message_count = 0;
...@@ -7079,7 +7079,7 @@ TEST(CallingContextIsNotDebugContext) { ...@@ -7079,7 +7079,7 @@ TEST(CallingContextIsNotDebugContext) {
TEST(DebugContextIsPreservedBetweenAccesses) { TEST(DebugContextIsPreservedBetweenAccesses) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Local<v8::Context> context1 = v8::Debug::GetDebugContext(); v8::Local<v8::Context> context1 = v8::Debug::GetDebugContext();
v8::Local<v8::Context> context2 = v8::Debug::GetDebugContext(); v8::Local<v8::Context> context2 = v8::Debug::GetDebugContext();
CHECK_EQ(*context1, *context2); CHECK_EQ(*context1, *context2);
...@@ -7095,7 +7095,7 @@ static void DebugEventContextChecker(const v8::Debug::EventDetails& details) { ...@@ -7095,7 +7095,7 @@ static void DebugEventContextChecker(const v8::Debug::EventDetails& details) {
// Check that event details contain context where debug event occured. // Check that event details contain context where debug event occured.
TEST(DebugEventContext) { TEST(DebugEventContext) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
expected_callback_data = v8::Int32::New(2010); expected_callback_data = v8::Int32::New(2010);
expected_context = v8::Context::New(isolate); expected_context = v8::Context::New(isolate);
...@@ -7201,7 +7201,7 @@ static void DebugEventBreakDeoptimize( ...@@ -7201,7 +7201,7 @@ static void DebugEventBreakDeoptimize(
} }
} }
v8::Debug::DebugBreak(v8::Isolate::GetCurrent()); v8::Debug::DebugBreak(CcTest::isolate());
} }
} }
......
...@@ -78,7 +78,7 @@ class DescriptorTestHelper { ...@@ -78,7 +78,7 @@ class DescriptorTestHelper {
DescriptorTestHelper() : DescriptorTestHelper() :
isolate_(NULL), array_(new AlignedArray), handle_array_(new HandleArray) { isolate_(NULL), array_(new AlignedArray), handle_array_(new HandleArray) {
v8::V8::Initialize(); v8::V8::Initialize();
isolate_ = v8::Isolate::GetCurrent(); isolate_ = CcTest::isolate();
} }
v8::Isolate* isolate_; v8::Isolate* isolate_;
// Data objects. // Data objects.
......
...@@ -230,7 +230,7 @@ static uint32_t PseudoRandom(uint32_t i, uint32_t j) { ...@@ -230,7 +230,7 @@ static uint32_t PseudoRandom(uint32_t i, uint32_t j) {
TEST(StringHash) { TEST(StringHash) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Context::Scope context_scope(v8::Context::New(isolate)); v8::Context::Scope context_scope(v8::Context::New(isolate));
...@@ -251,7 +251,7 @@ TEST(StringHash) { ...@@ -251,7 +251,7 @@ TEST(StringHash) {
TEST(NumberHash) { TEST(NumberHash) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Context::Scope context_scope(v8::Context::New(isolate)); v8::Context::Scope context_scope(v8::Context::New(isolate));
......
...@@ -413,7 +413,7 @@ TEST(HeapSnapshotSlicedString) { ...@@ -413,7 +413,7 @@ TEST(HeapSnapshotSlicedString) {
TEST(HeapSnapshotConsString) { TEST(HeapSnapshotConsString) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->SetInternalFieldCount(1); global_template->SetInternalFieldCount(1);
...@@ -456,7 +456,7 @@ TEST(HeapSnapshotConsString) { ...@@ -456,7 +456,7 @@ TEST(HeapSnapshotConsString) {
TEST(HeapSnapshotInternalReferences) { TEST(HeapSnapshotInternalReferences) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); v8::Local<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->SetInternalFieldCount(2); global_template->SetInternalFieldCount(2);
...@@ -1738,7 +1738,7 @@ bool HasWeakEdge(const v8::HeapGraphNode* node) { ...@@ -1738,7 +1738,7 @@ bool HasWeakEdge(const v8::HeapGraphNode* node) {
bool HasWeakGlobalHandle() { bool HasWeakGlobalHandle() {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler(); v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
const v8::HeapSnapshot* snapshot = const v8::HeapSnapshot* snapshot =
heap_profiler->TakeHeapSnapshot(v8_str("weaks")); heap_profiler->TakeHeapSnapshot(v8_str("weaks"));
......
...@@ -1320,7 +1320,7 @@ TEST(TestInternalWeakLists) { ...@@ -1320,7 +1320,7 @@ TEST(TestInternalWeakLists) {
// Create a number of global contests which gets linked together. // Create a number of global contests which gets linked together.
for (int i = 0; i < kNumTestContexts; i++) { for (int i = 0; i < kNumTestContexts; i++) {
ctx[i] = v8::Context::New(v8::Isolate::GetCurrent()); ctx[i] = v8::Context::New(CcTest::isolate());
// Collect garbage that might have been created by one of the // Collect garbage that might have been created by one of the
// installed extensions. // installed extensions.
...@@ -1466,7 +1466,7 @@ TEST(TestInternalWeakListsTraverseWithGC) { ...@@ -1466,7 +1466,7 @@ TEST(TestInternalWeakListsTraverseWithGC) {
// Create an number of contexts and check the length of the weak list both // Create an number of contexts and check the length of the weak list both
// with and without GCs while iterating the list. // with and without GCs while iterating the list.
for (int i = 0; i < kNumTestContexts; i++) { for (int i = 0; i < kNumTestContexts; i++) {
ctx[i] = v8::Context::New(v8::Isolate::GetCurrent()); ctx[i] = v8::Context::New(CcTest::isolate());
CHECK_EQ(i + 1, CountNativeContexts()); CHECK_EQ(i + 1, CountNativeContexts());
CHECK_EQ(i + 1, CountNativeContextsWithGC(isolate, i / 2 + 1)); CHECK_EQ(i + 1, CountNativeContextsWithGC(isolate, i / 2 + 1));
} }
...@@ -1684,7 +1684,7 @@ static int NumberOfGlobalObjects() { ...@@ -1684,7 +1684,7 @@ static int NumberOfGlobalObjects() {
// optimized code. // optimized code.
TEST(LeakNativeContextViaMap) { TEST(LeakNativeContextViaMap) {
i::FLAG_allow_natives_syntax = true; i::FLAG_allow_natives_syntax = true;
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope outer_scope(isolate); v8::HandleScope outer_scope(isolate);
v8::Persistent<v8::Context> ctx1p; v8::Persistent<v8::Context> ctx1p;
v8::Persistent<v8::Context> ctx2p; v8::Persistent<v8::Context> ctx2p;
...@@ -1730,7 +1730,7 @@ TEST(LeakNativeContextViaMap) { ...@@ -1730,7 +1730,7 @@ TEST(LeakNativeContextViaMap) {
// optimized code. // optimized code.
TEST(LeakNativeContextViaFunction) { TEST(LeakNativeContextViaFunction) {
i::FLAG_allow_natives_syntax = true; i::FLAG_allow_natives_syntax = true;
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope outer_scope(isolate); v8::HandleScope outer_scope(isolate);
v8::Persistent<v8::Context> ctx1p; v8::Persistent<v8::Context> ctx1p;
v8::Persistent<v8::Context> ctx2p; v8::Persistent<v8::Context> ctx2p;
...@@ -1774,7 +1774,7 @@ TEST(LeakNativeContextViaFunction) { ...@@ -1774,7 +1774,7 @@ TEST(LeakNativeContextViaFunction) {
TEST(LeakNativeContextViaMapKeyed) { TEST(LeakNativeContextViaMapKeyed) {
i::FLAG_allow_natives_syntax = true; i::FLAG_allow_natives_syntax = true;
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope outer_scope(isolate); v8::HandleScope outer_scope(isolate);
v8::Persistent<v8::Context> ctx1p; v8::Persistent<v8::Context> ctx1p;
v8::Persistent<v8::Context> ctx2p; v8::Persistent<v8::Context> ctx2p;
...@@ -1818,7 +1818,7 @@ TEST(LeakNativeContextViaMapKeyed) { ...@@ -1818,7 +1818,7 @@ TEST(LeakNativeContextViaMapKeyed) {
TEST(LeakNativeContextViaMapProto) { TEST(LeakNativeContextViaMapProto) {
i::FLAG_allow_natives_syntax = true; i::FLAG_allow_natives_syntax = true;
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope outer_scope(isolate); v8::HandleScope outer_scope(isolate);
v8::Persistent<v8::Context> ctx1p; v8::Persistent<v8::Context> ctx1p;
v8::Persistent<v8::Context> ctx2p; v8::Persistent<v8::Context> ctx2p;
...@@ -1873,10 +1873,10 @@ TEST(InstanceOfStubWriteBarrier) { ...@@ -1873,10 +1873,10 @@ TEST(InstanceOfStubWriteBarrier) {
CcTest::InitializeVM(); CcTest::InitializeVM();
if (!i::Isolate::Current()->use_crankshaft()) return; if (!i::Isolate::Current()->use_crankshaft()) return;
if (i::FLAG_force_marking_deque_overflows) return; if (i::FLAG_force_marking_deque_overflows) return;
v8::HandleScope outer_scope(v8::Isolate::GetCurrent()); v8::HandleScope outer_scope(CcTest::isolate());
{ {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
CompileRun( CompileRun(
"function foo () { }" "function foo () { }"
"function mkbar () { return new (new Function(\"\")) (); }" "function mkbar () { return new (new Function(\"\")) (); }"
...@@ -1908,7 +1908,7 @@ TEST(InstanceOfStubWriteBarrier) { ...@@ -1908,7 +1908,7 @@ TEST(InstanceOfStubWriteBarrier) {
CHECK(marking->IsMarking()); CHECK(marking->IsMarking());
{ {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Object> global = v8::Context::GetCurrent()->Global(); v8::Handle<v8::Object> global = v8::Context::GetCurrent()->Global();
v8::Handle<v8::Function> g = v8::Handle<v8::Function> g =
v8::Handle<v8::Function>::Cast(global->Get(v8_str("g"))); v8::Handle<v8::Function>::Cast(global->Get(v8_str("g")));
...@@ -1989,10 +1989,10 @@ TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { ...@@ -1989,10 +1989,10 @@ TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {
CcTest::InitializeVM(); CcTest::InitializeVM();
if (!i::Isolate::Current()->use_crankshaft()) return; if (!i::Isolate::Current()->use_crankshaft()) return;
v8::HandleScope outer_scope(v8::Isolate::GetCurrent()); v8::HandleScope outer_scope(CcTest::isolate());
{ {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
CompileRun( CompileRun(
"function f () {" "function f () {"
" var s = 0;" " var s = 0;"
......
...@@ -60,8 +60,8 @@ class ScopedLoggerInitializer { ...@@ -60,8 +60,8 @@ class ScopedLoggerInitializer {
temp_file_(NULL), temp_file_(NULL),
// Need to run this prior to creating the scope. // Need to run this prior to creating the scope.
trick_to_run_init_flags_(init_flags_()), trick_to_run_init_flags_(init_flags_()),
scope_(v8::Isolate::GetCurrent()), scope_(CcTest::isolate()),
env_(v8::Context::New(v8::Isolate::GetCurrent())), env_(v8::Context::New(CcTest::isolate())),
logger_(i::Isolate::Current()->logger()) { logger_(i::Isolate::Current()->logger()) {
env_->Enter(); env_->Enter();
} }
...@@ -299,8 +299,8 @@ class SimpleExternalString : public v8::String::ExternalStringResource { ...@@ -299,8 +299,8 @@ class SimpleExternalString : public v8::String::ExternalStringResource {
} // namespace } // namespace
TEST(Issue23768) { TEST(Issue23768) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::Context> env = v8::Context::New(v8::Isolate::GetCurrent()); v8::Handle<v8::Context> env = v8::Context::New(CcTest::isolate());
env->Enter(); env->Enter();
SimpleExternalString source_ext_str("(function ext() {})();"); SimpleExternalString source_ext_str("(function ext() {})();");
...@@ -330,7 +330,7 @@ UNINITIALIZED_TEST(LogCallbacks) { ...@@ -330,7 +330,7 @@ UNINITIALIZED_TEST(LogCallbacks) {
Logger* logger = initialize_logger.logger(); Logger* logger = initialize_logger.logger();
v8::Local<v8::FunctionTemplate> obj = v8::Local<v8::FunctionTemplate> obj =
v8::Local<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(), v8::Local<v8::FunctionTemplate>::New(CcTest::isolate(),
v8::FunctionTemplate::New()); v8::FunctionTemplate::New());
obj->SetClassName(v8_str("Obj")); obj->SetClassName(v8_str("Obj"));
v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate(); v8::Handle<v8::ObjectTemplate> proto = obj->PrototypeTemplate();
...@@ -379,7 +379,7 @@ UNINITIALIZED_TEST(LogAccessorCallbacks) { ...@@ -379,7 +379,7 @@ UNINITIALIZED_TEST(LogAccessorCallbacks) {
Logger* logger = initialize_logger.logger(); Logger* logger = initialize_logger.logger();
v8::Local<v8::FunctionTemplate> obj = v8::Local<v8::FunctionTemplate> obj =
v8::Local<v8::FunctionTemplate>::New(v8::Isolate::GetCurrent(), v8::Local<v8::FunctionTemplate>::New(CcTest::isolate(),
v8::FunctionTemplate::New()); v8::FunctionTemplate::New());
obj->SetClassName(v8_str("Obj")); obj->SetClassName(v8_str("Obj"));
v8::Handle<v8::ObjectTemplate> inst = obj->InstanceTemplate(); v8::Handle<v8::ObjectTemplate> inst = obj->InstanceTemplate();
......
...@@ -173,7 +173,7 @@ class ScriptResource : public v8::String::ExternalAsciiStringResource { ...@@ -173,7 +173,7 @@ class ScriptResource : public v8::String::ExternalAsciiStringResource {
TEST(Preparsing) { TEST(Preparsing) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handles(isolate); v8::HandleScope handles(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate); v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
...@@ -352,7 +352,7 @@ TEST(Regress928) { ...@@ -352,7 +352,7 @@ TEST(Regress928) {
"try { } catch (e) { var foo = function () { /* first */ } }" "try { } catch (e) { var foo = function () { /* first */ } }"
"var bar = function () { /* second */ }"; "var bar = function () { /* second */ }";
v8::HandleScope handles(v8::Isolate::GetCurrent()); v8::HandleScope handles(CcTest::isolate());
i::Handle<i::String> source( i::Handle<i::String> source(
factory->NewStringFromAscii(i::CStrVector(program))); factory->NewStringFromAscii(i::CStrVector(program)));
i::GenericStringUtf16CharacterStream stream(source, 0, source->length()); i::GenericStringUtf16CharacterStream stream(source, 0, source->length());
...@@ -544,7 +544,7 @@ void TestCharacterStream(const char* ascii_source, ...@@ -544,7 +544,7 @@ void TestCharacterStream(const char* ascii_source,
TEST(CharacterStreams) { TEST(CharacterStreams) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handles(isolate); v8::HandleScope handles(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate); v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
...@@ -993,8 +993,8 @@ TEST(ScopePositions) { ...@@ -993,8 +993,8 @@ TEST(ScopePositions) {
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
i::Factory* factory = isolate->factory(); i::Factory* factory = isolate->factory();
v8::HandleScope handles(v8::Isolate::GetCurrent()); v8::HandleScope handles(CcTest::isolate());
v8::Handle<v8::Context> context = v8::Context::New(v8::Isolate::GetCurrent()); v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
int marker; int marker;
...@@ -1267,8 +1267,8 @@ TEST(ParserSync) { ...@@ -1267,8 +1267,8 @@ TEST(ParserSync) {
i::Isolate* isolate = i::Isolate::Current(); i::Isolate* isolate = i::Isolate::Current();
i::Factory* factory = isolate->factory(); i::Factory* factory = isolate->factory();
v8::HandleScope handles(v8::Isolate::GetCurrent()); v8::HandleScope handles(CcTest::isolate());
v8::Handle<v8::Context> context = v8::Context::New(v8::Isolate::GetCurrent()); v8::Handle<v8::Context> context = v8::Context::New(CcTest::isolate());
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
int marker; int marker;
...@@ -1308,9 +1308,9 @@ TEST(PreparserStrictOctal) { ...@@ -1308,9 +1308,9 @@ TEST(PreparserStrictOctal) {
// such (issue 2220). // such (issue 2220).
v8::internal::FLAG_min_preparse_length = 1; // Force preparsing. v8::internal::FLAG_min_preparse_length = 1; // Force preparsing.
v8::V8::Initialize(); v8::V8::Initialize();
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Context::Scope context_scope( v8::Context::Scope context_scope(
v8::Context::New(v8::Isolate::GetCurrent())); v8::Context::New(CcTest::isolate()));
v8::TryCatch try_catch; v8::TryCatch try_catch;
const char* script = const char* script =
"\"use strict\"; \n" "\"use strict\"; \n"
......
...@@ -70,7 +70,7 @@ void GetStackPointer(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -70,7 +70,7 @@ void GetStackPointer(const v8::FunctionCallbackInfo<v8::Value>& args) {
TEST(StackAlignment) { TEST(StackAlignment) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global_template = v8::ObjectTemplate::New();
global_template->Set(v8_str("get_stack_pointer"), global_template->Set(v8_str("get_stack_pointer"),
......
...@@ -605,7 +605,7 @@ TEST(RecordStackTraceAtStartProfiling) { ...@@ -605,7 +605,7 @@ TEST(RecordStackTraceAtStartProfiling) {
// don't appear in the stack trace. // don't appear in the stack trace.
i::FLAG_use_inlining = false; i::FLAG_use_inlining = false;
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
const char* extensions[] = { "v8/profiler" }; const char* extensions[] = { "v8/profiler" };
v8::ExtensionConfiguration config(1, extensions); v8::ExtensionConfiguration config(1, extensions);
......
...@@ -70,7 +70,7 @@ TEST(CrankshaftRandom) { ...@@ -70,7 +70,7 @@ TEST(CrankshaftRandom) {
v8::V8::Initialize(); v8::V8::Initialize();
// Skip test if crankshaft is disabled. // Skip test if crankshaft is disabled.
if (!Isolate::Current()->use_crankshaft()) return; if (!Isolate::Current()->use_crankshaft()) return;
v8::Isolate* v8_isolate = v8::Isolate::GetCurrent(); v8::Isolate* v8_isolate = CcTest::isolate();
v8::HandleScope scope(v8_isolate); v8::HandleScope scope(v8_isolate);
v8::Context::Scope context_scope(v8::Context::New(v8_isolate)); v8::Context::Scope context_scope(v8::Context::New(v8_isolate));
......
...@@ -71,7 +71,7 @@ using namespace v8::internal; ...@@ -71,7 +71,7 @@ using namespace v8::internal;
static bool CheckParse(const char* input) { static bool CheckParse(const char* input) {
V8::Initialize(NULL); V8::Initialize(NULL);
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
Zone zone(Isolate::Current()); Zone zone(Isolate::Current());
FlatStringReader reader(Isolate::Current(), CStrVector(input)); FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result; RegExpCompileData result;
...@@ -82,7 +82,7 @@ static bool CheckParse(const char* input) { ...@@ -82,7 +82,7 @@ static bool CheckParse(const char* input) {
static SmartArrayPointer<const char> Parse(const char* input) { static SmartArrayPointer<const char> Parse(const char* input) {
V8::Initialize(NULL); V8::Initialize(NULL);
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
Zone zone(Isolate::Current()); Zone zone(Isolate::Current());
FlatStringReader reader(Isolate::Current(), CStrVector(input)); FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result; RegExpCompileData result;
...@@ -97,7 +97,7 @@ static SmartArrayPointer<const char> Parse(const char* input) { ...@@ -97,7 +97,7 @@ static SmartArrayPointer<const char> Parse(const char* input) {
static bool CheckSimple(const char* input) { static bool CheckSimple(const char* input) {
V8::Initialize(NULL); V8::Initialize(NULL);
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
Zone zone(Isolate::Current()); Zone zone(Isolate::Current());
FlatStringReader reader(Isolate::Current(), CStrVector(input)); FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result; RegExpCompileData result;
...@@ -116,7 +116,7 @@ struct MinMaxPair { ...@@ -116,7 +116,7 @@ struct MinMaxPair {
static MinMaxPair CheckMinMaxMatch(const char* input) { static MinMaxPair CheckMinMaxMatch(const char* input) {
V8::Initialize(NULL); V8::Initialize(NULL);
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
Zone zone(Isolate::Current()); Zone zone(Isolate::Current());
FlatStringReader reader(Isolate::Current(), CStrVector(input)); FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result; RegExpCompileData result;
...@@ -390,7 +390,7 @@ TEST(ParserRegression) { ...@@ -390,7 +390,7 @@ TEST(ParserRegression) {
static void ExpectError(const char* input, static void ExpectError(const char* input,
const char* expected) { const char* expected) {
V8::Initialize(NULL); V8::Initialize(NULL);
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
Zone zone(Isolate::Current()); Zone zone(Isolate::Current());
FlatStringReader reader(Isolate::Current(), CStrVector(input)); FlatStringReader reader(Isolate::Current(), CStrVector(input));
RegExpCompileData result; RegExpCompileData result;
...@@ -533,7 +533,7 @@ static void Execute(const char* input, ...@@ -533,7 +533,7 @@ static void Execute(const char* input,
bool multiline, bool multiline,
bool is_ascii, bool is_ascii,
bool dot_output = false) { bool dot_output = false) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
Zone zone(Isolate::Current()); Zone zone(Isolate::Current());
RegExpNode* node = Compile(input, multiline, is_ascii, &zone); RegExpNode* node = Compile(input, multiline, is_ascii, &zone);
USE(node); USE(node);
...@@ -710,8 +710,8 @@ typedef RegExpMacroAssemblerMIPS ArchRegExpMacroAssembler; ...@@ -710,8 +710,8 @@ typedef RegExpMacroAssemblerMIPS ArchRegExpMacroAssembler;
class ContextInitializer { class ContextInitializer {
public: public:
ContextInitializer() ContextInitializer()
: scope_(v8::Isolate::GetCurrent()), : scope_(CcTest::isolate()),
env_(v8::Context::New(v8::Isolate::GetCurrent())) { env_(v8::Context::New(CcTest::isolate())) {
env_->Enter(); env_->Enter();
} }
~ContextInitializer() { ~ContextInitializer() {
......
...@@ -251,7 +251,7 @@ static void Serialize() { ...@@ -251,7 +251,7 @@ static void Serialize() {
// can be loaded from v8natives.js and their addresses can be processed. This // can be loaded from v8natives.js and their addresses can be processed. This
// will clear the pending fixups array, which would otherwise contain GC roots // will clear the pending fixups array, which would otherwise contain GC roots
// that would confuse the serialization/deserialization process. // that would confuse the serialization/deserialization process.
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
{ {
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
v8::Context::New(isolate); v8::Context::New(isolate);
...@@ -292,7 +292,7 @@ static void Deserialize() { ...@@ -292,7 +292,7 @@ static void Deserialize() {
static void SanityCheck() { static void SanityCheck() {
Isolate* isolate = Isolate::Current(); Isolate* isolate = Isolate::Current();
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
HEAP->Verify(); HEAP->Verify();
#endif #endif
...@@ -309,7 +309,7 @@ DEPENDENT_TEST(Deserialize, Serialize) { ...@@ -309,7 +309,7 @@ DEPENDENT_TEST(Deserialize, Serialize) {
// serialization. That doesn't matter. We don't need to be able to // serialization. That doesn't matter. We don't need to be able to
// serialize a snapshot in a VM that is booted from a snapshot. // serialize a snapshot in a VM that is booted from a snapshot.
if (!Snapshot::HaveASnapshotToStartFrom()) { if (!Snapshot::HaveASnapshotToStartFrom()) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
Deserialize(); Deserialize();
...@@ -323,7 +323,7 @@ DEPENDENT_TEST(Deserialize, Serialize) { ...@@ -323,7 +323,7 @@ DEPENDENT_TEST(Deserialize, Serialize) {
DEPENDENT_TEST(DeserializeFromSecondSerialization, SerializeTwice) { DEPENDENT_TEST(DeserializeFromSecondSerialization, SerializeTwice) {
if (!Snapshot::HaveASnapshotToStartFrom()) { if (!Snapshot::HaveASnapshotToStartFrom()) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
Deserialize(); Deserialize();
...@@ -337,7 +337,7 @@ DEPENDENT_TEST(DeserializeFromSecondSerialization, SerializeTwice) { ...@@ -337,7 +337,7 @@ DEPENDENT_TEST(DeserializeFromSecondSerialization, SerializeTwice) {
DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) { DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) {
if (!Snapshot::HaveASnapshotToStartFrom()) { if (!Snapshot::HaveASnapshotToStartFrom()) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
Deserialize(); Deserialize();
...@@ -355,7 +355,7 @@ DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) { ...@@ -355,7 +355,7 @@ DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) {
DEPENDENT_TEST(DeserializeFromSecondSerializationAndRunScript2, DEPENDENT_TEST(DeserializeFromSecondSerializationAndRunScript2,
SerializeTwice) { SerializeTwice) {
if (!Snapshot::HaveASnapshotToStartFrom()) { if (!Snapshot::HaveASnapshotToStartFrom()) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
Deserialize(); Deserialize();
......
...@@ -1227,7 +1227,7 @@ TEST(AsciiArrayJoin) { ...@@ -1227,7 +1227,7 @@ TEST(AsciiArrayJoin) {
"for (var i = 1; i <= two_14; i++) a.push(s);" "for (var i = 1; i <= two_14; i++) a.push(s);"
"a.join("");"; "a.join("");";
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
LocalContext context; LocalContext context;
v8::V8::IgnoreOutOfMemoryException(); v8::V8::IgnoreOutOfMemoryException();
v8::Local<v8::Script> script = v8::Local<v8::Script> script =
......
...@@ -115,11 +115,11 @@ v8::Handle<v8::ObjectTemplate> CreateGlobalTemplate( ...@@ -115,11 +115,11 @@ v8::Handle<v8::ObjectTemplate> CreateGlobalTemplate(
// Test that a single thread of JavaScript execution can terminate // Test that a single thread of JavaScript execution can terminate
// itself. // itself.
TEST(TerminateOnlyV8ThreadFromThreadItself) { TEST(TerminateOnlyV8ThreadFromThreadItself) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::ObjectTemplate> global = v8::Handle<v8::ObjectTemplate> global =
CreateGlobalTemplate(TerminateCurrentThread, DoLoop); CreateGlobalTemplate(TerminateCurrentThread, DoLoop);
v8::Handle<v8::Context> context = v8::Handle<v8::Context> context =
v8::Context::New(v8::Isolate::GetCurrent(), NULL, global); v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
// Run a loop that will be infinite if thread termination does not work. // Run a loop that will be infinite if thread termination does not work.
...@@ -135,11 +135,11 @@ TEST(TerminateOnlyV8ThreadFromThreadItself) { ...@@ -135,11 +135,11 @@ TEST(TerminateOnlyV8ThreadFromThreadItself) {
// Test that a single thread of JavaScript execution can terminate // Test that a single thread of JavaScript execution can terminate
// itself in a loop that performs no calls. // itself in a loop that performs no calls.
TEST(TerminateOnlyV8ThreadFromThreadItselfNoLoop) { TEST(TerminateOnlyV8ThreadFromThreadItselfNoLoop) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::ObjectTemplate> global = v8::Handle<v8::ObjectTemplate> global =
CreateGlobalTemplate(TerminateCurrentThread, DoLoopNoCall); CreateGlobalTemplate(TerminateCurrentThread, DoLoopNoCall);
v8::Handle<v8::Context> context = v8::Handle<v8::Context> context =
v8::Context::New(v8::Isolate::GetCurrent(), NULL, global); v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
// Run a loop that will be infinite if thread termination does not work. // Run a loop that will be infinite if thread termination does not work.
...@@ -175,10 +175,10 @@ TEST(TerminateOnlyV8ThreadFromOtherThread) { ...@@ -175,10 +175,10 @@ TEST(TerminateOnlyV8ThreadFromOtherThread) {
TerminatorThread thread(i::Isolate::Current()); TerminatorThread thread(i::Isolate::Current());
thread.Start(); thread.Start();
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate(Signal, DoLoop); v8::Handle<v8::ObjectTemplate> global = CreateGlobalTemplate(Signal, DoLoop);
v8::Handle<v8::Context> context = v8::Handle<v8::Context> context =
v8::Context::New(v8::Isolate::GetCurrent(), NULL, global); v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
// Run a loop that will be infinite if thread termination does not work. // Run a loop that will be infinite if thread termination does not work.
...@@ -232,7 +232,7 @@ void LoopGetProperty(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -232,7 +232,7 @@ void LoopGetProperty(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Test that we correctly handle termination exceptions if they are // Test that we correctly handle termination exceptions if they are
// triggered by the creation of error objects in connection with ICs. // triggered by the creation of error objects in connection with ICs.
UNINITIALIZED_TEST(TerminateLoadICException) { UNINITIALIZED_TEST(TerminateLoadICException) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
global->Set(v8::String::New("terminate_or_return_object"), global->Set(v8::String::New("terminate_or_return_object"),
v8::FunctionTemplate::New(TerminateOrReturnObject)); v8::FunctionTemplate::New(TerminateOrReturnObject));
...@@ -241,7 +241,7 @@ UNINITIALIZED_TEST(TerminateLoadICException) { ...@@ -241,7 +241,7 @@ UNINITIALIZED_TEST(TerminateLoadICException) {
v8::FunctionTemplate::New(LoopGetProperty)); v8::FunctionTemplate::New(LoopGetProperty));
v8::Handle<v8::Context> context = v8::Handle<v8::Context> context =
v8::Context::New(v8::Isolate::GetCurrent(), NULL, global); v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
// Run a loop that will be infinite if thread termination does not work. // Run a loop that will be infinite if thread termination does not work.
...@@ -284,11 +284,11 @@ void ReenterAfterTermination(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -284,11 +284,11 @@ void ReenterAfterTermination(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Test that reentry into V8 while the termination exception is still pending // Test that reentry into V8 while the termination exception is still pending
// (has not yet unwound the 0-level JS frame) does not crash. // (has not yet unwound the 0-level JS frame) does not crash.
TEST(TerminateAndReenterFromThreadItself) { TEST(TerminateAndReenterFromThreadItself) {
v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::HandleScope scope(CcTest::isolate());
v8::Handle<v8::ObjectTemplate> global = v8::Handle<v8::ObjectTemplate> global =
CreateGlobalTemplate(TerminateCurrentThread, ReenterAfterTermination); CreateGlobalTemplate(TerminateCurrentThread, ReenterAfterTermination);
v8::Handle<v8::Context> context = v8::Handle<v8::Context> context =
v8::Context::New(v8::Isolate::GetCurrent(), NULL, global); v8::Context::New(CcTest::isolate(), NULL, global);
v8::Context::Scope context_scope(context); v8::Context::Scope context_scope(context);
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
v8::Handle<v8::String> source = v8::Handle<v8::String> source =
...@@ -316,7 +316,7 @@ void DoLoopCancelTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -316,7 +316,7 @@ void DoLoopCancelTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(!try_catch.CanContinue()); CHECK(!try_catch.CanContinue());
CHECK(v8::V8::IsExecutionTerminating()); CHECK(v8::V8::IsExecutionTerminating());
CHECK(try_catch.HasTerminated()); CHECK(try_catch.HasTerminated());
v8::V8::CancelTerminateExecution(v8::Isolate::GetCurrent()); v8::V8::CancelTerminateExecution(CcTest::isolate());
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
} }
...@@ -324,7 +324,7 @@ void DoLoopCancelTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) { ...@@ -324,7 +324,7 @@ void DoLoopCancelTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Test that a single thread of JavaScript execution can terminate // Test that a single thread of JavaScript execution can terminate
// itself and then resume execution. // itself and then resume execution.
TEST(TerminateCancelTerminateFromThreadItself) { TEST(TerminateCancelTerminateFromThreadItself) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
v8::Handle<v8::ObjectTemplate> global = v8::Handle<v8::ObjectTemplate> global =
CreateGlobalTemplate(TerminateCurrentThread, DoLoopCancelTerminate); CreateGlobalTemplate(TerminateCurrentThread, DoLoopCancelTerminate);
......
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