OLD | NEW |
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // can be loaded from v8natives.js and their addresses can be processed. This | 193 // can be loaded from v8natives.js and their addresses can be processed. This |
194 // will clear the pending fixups array, which would otherwise contain GC roots | 194 // will clear the pending fixups array, which would otherwise contain GC roots |
195 // that would confuse the serialization/deserialization process. | 195 // that would confuse the serialization/deserialization process. |
196 v8::Isolate::Scope isolate_scope(isolate); | 196 v8::Isolate::Scope isolate_scope(isolate); |
197 { | 197 { |
198 v8::HandleScope scope(isolate); | 198 v8::HandleScope scope(isolate); |
199 v8::Context::New(isolate); | 199 v8::Context::New(isolate); |
200 } | 200 } |
201 | 201 |
202 Isolate* internal_isolate = reinterpret_cast<Isolate*>(isolate); | 202 Isolate* internal_isolate = reinterpret_cast<Isolate*>(isolate); |
203 internal_isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, "serialize"); | 203 internal_isolate->heap()->CollectAllAvailableGarbage("serialize"); |
204 WriteToFile(internal_isolate, FLAG_testing_serialization_file); | 204 WriteToFile(internal_isolate, FLAG_testing_serialization_file); |
205 } | 205 } |
206 | 206 |
207 | 207 |
208 // Test that the whole heap can be serialized. | 208 // Test that the whole heap can be serialized. |
209 UNINITIALIZED_TEST(Serialize) { | 209 UNINITIALIZED_TEST(Serialize) { |
210 if (!Snapshot::HaveASnapshotToStartFrom()) { | 210 if (!Snapshot::HaveASnapshotToStartFrom()) { |
211 v8::Isolate::CreateParams params; | 211 v8::Isolate::CreateParams params; |
212 params.enable_serializer = true; | 212 params.enable_serializer = true; |
213 v8::Isolate* isolate = v8::Isolate::New(params); | 213 v8::Isolate* isolate = v8::Isolate::New(params); |
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 { | 1155 { |
1156 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); | 1156 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); |
1157 script = v8::ScriptCompiler::CompileUnbound( | 1157 script = v8::ScriptCompiler::CompileUnbound( |
1158 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); | 1158 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); |
1159 } | 1159 } |
1160 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); | 1160 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); |
1161 CHECK(result->ToString()->Equals(v8_str("abcdef"))); | 1161 CHECK(result->ToString()->Equals(v8_str("abcdef"))); |
1162 } | 1162 } |
1163 isolate2->Dispose(); | 1163 isolate2->Dispose(); |
1164 } | 1164 } |
OLD | NEW |