Index: test/cctest/test-serialize.cc |
diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc |
index 0cf80440f6dafe823dcbbfcb4bf2dadacb1c39a9..d236cf1fa8a8f927d833ab90107ed49b7a031cc8 100644 |
--- a/test/cctest/test-serialize.cc |
+++ b/test/cctest/test-serialize.cc |
@@ -251,11 +251,8 @@ 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::HandleScope scope(isolate); |
- v8::Context::New(isolate); |
- } |
+ v8::Persistent<v8::Context> env = v8::Context::New(); |
+ env.Dispose(env->GetIsolate()); |
WriteToFile(FLAG_testing_serialization_file); |
} |
@@ -307,11 +304,10 @@ 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::HandleScope scope(isolate); |
+ v8::HandleScope scope(v8::Isolate::GetCurrent()); |
Deserialize(); |
- v8::Local<v8::Context> env = v8::Context::New(isolate); |
+ v8::Persistent<v8::Context> env = v8::Context::New(); |
env->Enter(); |
SanityCheck(); |
@@ -321,11 +317,10 @@ DEPENDENT_TEST(Deserialize, Serialize) { |
DEPENDENT_TEST(DeserializeFromSecondSerialization, SerializeTwice) { |
if (!Snapshot::HaveASnapshotToStartFrom()) { |
- v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
- v8::HandleScope scope(isolate); |
+ v8::HandleScope scope(v8::Isolate::GetCurrent()); |
Deserialize(); |
- v8::Local<v8::Context> env = v8::Context::New(isolate); |
+ v8::Persistent<v8::Context> env = v8::Context::New(); |
env->Enter(); |
SanityCheck(); |
@@ -335,11 +330,10 @@ DEPENDENT_TEST(DeserializeFromSecondSerialization, SerializeTwice) { |
DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) { |
if (!Snapshot::HaveASnapshotToStartFrom()) { |
- v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
- v8::HandleScope scope(isolate); |
+ v8::HandleScope scope(v8::Isolate::GetCurrent()); |
Deserialize(); |
- v8::Local<v8::Context> env = v8::Context::New(isolate); |
+ v8::Persistent<v8::Context> env = v8::Context::New(); |
env->Enter(); |
const char* c_source = "\"1234\".length"; |
@@ -353,11 +347,10 @@ DEPENDENT_TEST(DeserializeAndRunScript2, Serialize) { |
DEPENDENT_TEST(DeserializeFromSecondSerializationAndRunScript2, |
SerializeTwice) { |
if (!Snapshot::HaveASnapshotToStartFrom()) { |
- v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
- v8::HandleScope scope(isolate); |
+ v8::HandleScope scope(v8::Isolate::GetCurrent()); |
Deserialize(); |
- v8::Local<v8::Context> env = v8::Context::New(isolate); |
+ v8::Persistent<v8::Context> env = v8::Context::New(); |
env->Enter(); |
const char* c_source = "\"1234\".length"; |
@@ -375,12 +368,7 @@ TEST(PartialSerialization) { |
Isolate* isolate = Isolate::Current(); |
Heap* heap = isolate->heap(); |
- v8::Persistent<v8::Context> env; |
- { |
- HandleScope scope(isolate); |
- env.Reset(v8::Isolate::GetCurrent(), |
- v8::Context::New(v8::Isolate::GetCurrent())); |
- } |
+ v8::Persistent<v8::Context> env = v8::Context::New(); |
ASSERT(!env.IsEmpty()); |
env->Enter(); |
// Make sure all builtin scripts are cached. |
@@ -514,12 +502,7 @@ TEST(ContextSerialization) { |
Isolate* isolate = Isolate::Current(); |
Heap* heap = isolate->heap(); |
- v8::Persistent<v8::Context> env; |
- { |
- HandleScope scope(isolate); |
- env.Reset(v8::Isolate::GetCurrent(), |
- v8::Context::New(v8::Isolate::GetCurrent())); |
- } |
+ v8::Persistent<v8::Context> env = v8::Context::New(); |
ASSERT(!env.IsEmpty()); |
env->Enter(); |
// Make sure all builtin scripts are cached. |