Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Unified Diff: test/cctest/test-compiler.cc

Issue 12716010: Added a version of the v8::HandleScope constructor with an Isolate and use that consistently. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixed rest Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/cctest/test-compiler.cc
diff --git a/test/cctest/test-compiler.cc b/test/cctest/test-compiler.cc
index f6632d4a49e2deaa91ac54b657877df127194172..6c100b09d860bbb0ee7311631e5812073a24b618 100644
--- a/test/cctest/test-compiler.cc
+++ b/test/cctest/test-compiler.cc
@@ -67,7 +67,7 @@ v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunction(
v8::Handle<v8::Value> PrintExtension::Print(const v8::Arguments& args) {
for (int i = 0; i < args.Length(); i++) {
if (i != 0) printf(" ");
- v8::HandleScope scope;
+ v8::HandleScope scope(args.GetIsolate());
v8::String::Utf8Value str(args[i]);
if (*str == NULL) return v8::Undefined();
printf("%s", *str);
@@ -83,12 +83,10 @@ v8::DeclareExtension kPrintExtensionDeclaration(&kPrintExtension);
static void InitializeVM() {
if (env.IsEmpty()) {
- v8::HandleScope scope;
const char* extensions[] = { "v8/print", "v8/gc" };
v8::ExtensionConfiguration config(2, extensions);
env = v8::Context::New(&config);
}
- v8::HandleScope scope;
env->Enter();
}
@@ -145,7 +143,7 @@ static double Inc(int x) {
TEST(Inc) {
InitializeVM();
- v8::HandleScope scope;
+ v8::HandleScope scope(env->GetIsolate());
CHECK_EQ(4.0, Inc(3));
}
@@ -166,7 +164,7 @@ static double Add(int x, int y) {
TEST(Add) {
InitializeVM();
- v8::HandleScope scope;
+ v8::HandleScope scope(env->GetIsolate());
CHECK_EQ(5.0, Add(2, 3));
}
@@ -186,7 +184,7 @@ static double Abs(int x) {
TEST(Abs) {
InitializeVM();
- v8::HandleScope scope;
+ v8::HandleScope scope(env->GetIsolate());
CHECK_EQ(3.0, Abs(-3));
}
@@ -207,14 +205,14 @@ static double Sum(int n) {
TEST(Sum) {
InitializeVM();
- v8::HandleScope scope;
+ v8::HandleScope scope(env->GetIsolate());
CHECK_EQ(5050.0, Sum(100));
}
TEST(Print) {
InitializeVM();
- v8::HandleScope scope;
+ v8::HandleScope scope(env->GetIsolate());
const char* source = "for (n = 0; n < 100; ++n) print(n, 1, 2);";
Handle<JSFunction> fun = Compile(source);
if (fun.is_null()) return;
@@ -229,7 +227,7 @@ TEST(Print) {
// tests all the functionality I have added to the compiler today
TEST(Stuff) {
InitializeVM();
- v8::HandleScope scope;
+ v8::HandleScope scope(env->GetIsolate());
const char* source =
"r = 0;\n"
"a = new Object;\n"
@@ -261,7 +259,7 @@ TEST(Stuff) {
TEST(UncaughtThrow) {
InitializeVM();
- v8::HandleScope scope;
+ v8::HandleScope scope(env->GetIsolate());
const char* source = "throw 42;";
Handle<JSFunction> fun = Compile(source);
@@ -283,7 +281,7 @@ TEST(UncaughtThrow) {
// | C-to-JS |
TEST(C2JSFrames) {
InitializeVM();
- v8::HandleScope scope;
+ v8::HandleScope scope(env->GetIsolate());
const char* source = "function foo(a) { gc(), print(a); }";
@@ -320,7 +318,7 @@ TEST(C2JSFrames) {
// source resulted in crash.
TEST(Regression236) {
InitializeVM();
- v8::HandleScope scope;
+ v8::HandleScope scope(env->GetIsolate());
Handle<Script> script = FACTORY->NewScript(FACTORY->empty_string());
script->set_source(HEAP->undefined_value());
@@ -332,7 +330,7 @@ TEST(Regression236) {
TEST(GetScriptLineNumber) {
LocalContext env;
- v8::HandleScope scope;
+ v8::HandleScope scope(env->GetIsolate());
v8::ScriptOrigin origin = v8::ScriptOrigin(v8::String::New("test"));
const char function_f[] = "function f() {}";
const int max_rows = 1000;
@@ -362,7 +360,7 @@ TEST(OptimizedCodeSharing) {
if (!FLAG_cache_optimized_code) return;
FLAG_allow_natives_syntax = true;
InitializeVM();
- v8::HandleScope scope;
+ v8::HandleScope scope(env->GetIsolate());
for (int i = 0; i < 10; i++) {
LocalContext env;
env->Global()->Set(v8::String::New("x"), v8::Integer::New(i));
@@ -425,8 +423,8 @@ static void CheckCodeForUnsafeLiteral(Handle<JSFunction> f) {
TEST(SplitConstantsInFullCompiler) {
- v8::HandleScope scope;
LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
CompileRun("function f() { a = 12345678 }; f();");
CheckCodeForUnsafeLiteral(GetJSFunction(env->Global(), "f"));

Powered by Google App Engine
This is Rietveld 408576698