| Index: test/cctest/test-serialize.cc
|
| diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc
|
| index 099f3a05a976c7fb059cc95bb22b3b51278599be..e31899ad6eba56bf1582aaaa1685dcbd28084d67 100644
|
| --- a/test/cctest/test-serialize.cc
|
| +++ b/test/cctest/test-serialize.cc
|
| @@ -84,7 +84,7 @@ static int* counter_function(const char* name) {
|
|
|
| template <class T>
|
| static Address AddressOf(T id) {
|
| - return ExternalReference(id, i::Isolate::Current()).address();
|
| + return ExternalReference(id, CcTest::i_isolate()).address();
|
| }
|
|
|
|
|
| @@ -100,7 +100,7 @@ static int make_code(TypeCode type, int id) {
|
|
|
|
|
| TEST(ExternalReferenceEncoder) {
|
| - Isolate* isolate = i::Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| isolate->stats_table()->SetCounterFunction(counter_function);
|
| v8::V8::Initialize();
|
|
|
| @@ -137,7 +137,7 @@ TEST(ExternalReferenceEncoder) {
|
|
|
|
|
| TEST(ExternalReferenceDecoder) {
|
| - Isolate* isolate = i::Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| isolate->stats_table()->SetCounterFunction(counter_function);
|
| v8::V8::Initialize();
|
|
|
| @@ -251,20 +251,22 @@ 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);
|
| }
|
| - WriteToFile(reinterpret_cast<Isolate*>(isolate),
|
| - FLAG_testing_serialization_file);
|
| +
|
| + Isolate* internal_isolate = CcTest::i_isolate();
|
| + internal_isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, "serialize");
|
| + WriteToFile(internal_isolate, FLAG_testing_serialization_file);
|
| }
|
|
|
|
|
| // Test that the whole heap can be serialized.
|
| -TEST(Serialize) {
|
| +UNINITIALIZED_TEST(Serialize) {
|
| if (!Snapshot::HaveASnapshotToStartFrom()) {
|
| - Serializer::Enable(Isolate::Current());
|
| + Serializer::Enable(CcTest::i_isolate());
|
| v8::V8::Initialize();
|
| Serialize();
|
| }
|
| @@ -272,9 +274,9 @@ TEST(Serialize) {
|
|
|
|
|
| // Test that heap serialization is non-destructive.
|
| -TEST(SerializeTwice) {
|
| +UNINITIALIZED_TEST(SerializeTwice) {
|
| if (!Snapshot::HaveASnapshotToStartFrom()) {
|
| - Serializer::Enable(Isolate::Current());
|
| + Serializer::Enable(CcTest::i_isolate());
|
| v8::V8::Initialize();
|
| Serialize();
|
| Serialize();
|
| @@ -291,14 +293,14 @@ static void Deserialize() {
|
|
|
|
|
| static void SanityCheck() {
|
| - Isolate* isolate = Isolate::Current();
|
| - v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| + Isolate* isolate = CcTest::i_isolate();
|
| + v8::HandleScope scope(CcTest::isolate());
|
| #ifdef VERIFY_HEAP
|
| - HEAP->Verify();
|
| + CcTest::heap()->Verify();
|
| #endif
|
| CHECK(isolate->global_object()->IsJSObject());
|
| CHECK(isolate->native_context()->IsContext());
|
| - CHECK(HEAP->string_table()->IsStringTable());
|
| + CHECK(CcTest::heap()->string_table()->IsStringTable());
|
| CHECK(!isolate->factory()->InternalizeOneByteString(
|
| STATIC_ASCII_VECTOR("Empty"))->IsFailure());
|
| }
|
| @@ -309,7 +311,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 +325,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 +339,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 +357,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();
|
|
|
| @@ -370,9 +372,9 @@ DEPENDENT_TEST(DeserializeFromSecondSerializationAndRunScript2,
|
| }
|
|
|
|
|
| -TEST(PartialSerialization) {
|
| +UNINITIALIZED_TEST(PartialSerialization) {
|
| if (!Snapshot::HaveASnapshotToStartFrom()) {
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Serializer::Enable(isolate);
|
| v8::V8::Initialize();
|
| v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
|
| @@ -495,7 +497,7 @@ DEPENDENT_TEST(PartialDeserialization, PartialSerialization) {
|
| int snapshot_size = 0;
|
| byte* snapshot = ReadBytes(file_name, &snapshot_size);
|
|
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Object* root;
|
| {
|
| SnapshotByteSource source(snapshot, snapshot_size);
|
| @@ -521,9 +523,9 @@ DEPENDENT_TEST(PartialDeserialization, PartialSerialization) {
|
| }
|
|
|
|
|
| -TEST(ContextSerialization) {
|
| +UNINITIALIZED_TEST(ContextSerialization) {
|
| if (!Snapshot::HaveASnapshotToStartFrom()) {
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Serializer::Enable(isolate);
|
| v8::V8::Initialize();
|
| v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
|
| @@ -607,7 +609,7 @@ DEPENDENT_TEST(ContextDeserialization, ContextSerialization) {
|
| int snapshot_size = 0;
|
| byte* snapshot = ReadBytes(file_name, &snapshot_size);
|
|
|
| - Isolate* isolate = Isolate::Current();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| Object* root;
|
| {
|
| SnapshotByteSource source(snapshot, snapshot_size);
|
|
|