Index: test/cctest/test-func-name-inference.cc |
diff --git a/test/cctest/test-func-name-inference.cc b/test/cctest/test-func-name-inference.cc |
index 364a4f6a69c02593a81b14ecfa952c931b02e6d6..5b8293fa4859d1bf842a2fd9ec21941e05416ac6 100644 |
--- a/test/cctest/test-func-name-inference.cc |
+++ b/test/cctest/test-func-name-inference.cc |
@@ -47,17 +47,6 @@ using ::v8::internal::SharedFunctionInfo; |
using ::v8::internal::String; |
-static v8::Persistent<v8::Context> env; |
- |
- |
-static void InitializeVM() { |
- if (env.IsEmpty()) { |
- env = v8::Context::New(); |
- } |
- env->Enter(); |
-} |
- |
- |
static void CheckFunctionName(v8::Handle<v8::Script> script, |
const char* func_pos_src, |
const char* ref_inferred_name) { |
@@ -108,8 +97,8 @@ static v8::Handle<v8::Script> Compile(const char* src) { |
TEST(GlobalProperty) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"fun1 = function() { return 1; }\n" |
@@ -120,8 +109,8 @@ TEST(GlobalProperty) { |
TEST(GlobalVar) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"var fun1 = function() { return 1; }\n" |
@@ -132,8 +121,8 @@ TEST(GlobalVar) { |
TEST(LocalVar) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function outer() {\n" |
@@ -146,8 +135,8 @@ TEST(LocalVar) { |
TEST(InConstructor) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function MyClass() {\n" |
@@ -160,8 +149,8 @@ TEST(InConstructor) { |
TEST(Factory) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function createMyObj() {\n" |
@@ -176,8 +165,8 @@ TEST(Factory) { |
TEST(Static) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function MyClass() {}\n" |
@@ -194,8 +183,8 @@ TEST(Static) { |
TEST(Prototype) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function MyClass() {}\n" |
@@ -212,8 +201,8 @@ TEST(Prototype) { |
TEST(ObjectLiteral) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function MyClass() {}\n" |
@@ -226,8 +215,8 @@ TEST(ObjectLiteral) { |
TEST(AsParameter) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function f1(a) { return a(); }\n" |
@@ -242,8 +231,8 @@ TEST(AsParameter) { |
TEST(MultipleFuncsConditional) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"fun1 = 0 ?\n" |
@@ -255,8 +244,8 @@ TEST(MultipleFuncsConditional) { |
TEST(MultipleFuncsInLiteral) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function MyClass() {}\n" |
@@ -270,8 +259,8 @@ TEST(MultipleFuncsInLiteral) { |
// See http://code.google.com/p/v8/issues/detail?id=380 |
TEST(Issue380) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function a() {\n" |
@@ -283,8 +272,8 @@ TEST(Issue380) { |
TEST(MultipleAssignments) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"var fun1 = fun2 = function () { return 1; }\n" |
@@ -299,8 +288,8 @@ TEST(MultipleAssignments) { |
TEST(AsConstructorParameter) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function Foo() {}\n" |
@@ -313,8 +302,8 @@ TEST(AsConstructorParameter) { |
TEST(FactoryHashmap) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function createMyObj() {\n" |
@@ -329,8 +318,8 @@ TEST(FactoryHashmap) { |
TEST(FactoryHashmapVariable) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function createMyObj() {\n" |
@@ -348,8 +337,8 @@ TEST(FactoryHashmapVariable) { |
TEST(FactoryHashmapConditional) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"function createMyObj() {\n" |
@@ -363,8 +352,8 @@ TEST(FactoryHashmapConditional) { |
TEST(GlobalAssignmentAndCall) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"var Foo = function() {\n" |
@@ -381,8 +370,8 @@ TEST(GlobalAssignmentAndCall) { |
TEST(AssignmentAndCall) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"(function Enclosing() {\n" |
@@ -404,8 +393,8 @@ TEST(AssignmentAndCall) { |
TEST(MethodAssignmentInAnonymousFunctionCall) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"(function () {\n" |
@@ -420,8 +409,8 @@ TEST(MethodAssignmentInAnonymousFunctionCall) { |
TEST(ReturnAnonymousFunction) { |
- InitializeVM(); |
- v8::HandleScope scope(env->GetIsolate()); |
+ CcTest::InitializeVM(); |
+ v8::HandleScope scope(CcTest::isolate()); |
v8::Handle<v8::Script> script = Compile( |
"(function() {\n" |