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