| OLD | NEW |
| 1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 v8::ExtensionConfiguration extensions(kExtensionCount, extension_list); | 185 v8::ExtensionConfiguration extensions(kExtensionCount, extension_list); |
| 186 Serializer::Enable(); | 186 Serializer::Enable(); |
| 187 v8::Persistent<v8::Context> env = v8::Context::New(&extensions); | 187 v8::Persistent<v8::Context> env = v8::Context::New(&extensions); |
| 188 env->Enter(); | 188 env->Enter(); |
| 189 | 189 |
| 190 Snapshot::WriteToFile(FLAG_testing_serialization_file); | 190 Snapshot::WriteToFile(FLAG_testing_serialization_file); |
| 191 } | 191 } |
| 192 | 192 |
| 193 | 193 |
| 194 static void Serialize2() { | 194 static void Serialize2() { |
| 195 Serializer::Enable(); | |
| 196 // We have to create one context. One reason for this is so that the builtins | 195 // We have to create one context. One reason for this is so that the builtins |
| 197 // can be loaded from v8natives.js and their addresses can be processed. This | 196 // can be loaded from v8natives.js and their addresses can be processed. This |
| 198 // will clear the pending fixups array, which would otherwise contain GC roots | 197 // will clear the pending fixups array, which would otherwise contain GC roots |
| 199 // that would confuse the serialization/deserialization process. | 198 // that would confuse the serialization/deserialization process. |
| 200 v8::Persistent<v8::Context> env = v8::Context::New(); | 199 v8::Persistent<v8::Context> env = v8::Context::New(); |
| 201 env.Dispose(); | 200 env.Dispose(); |
| 202 Snapshot::WriteToFile2(FLAG_testing_serialization_file); | 201 Snapshot::WriteToFile2(FLAG_testing_serialization_file); |
| 203 } | 202 } |
| 204 | 203 |
| 205 | 204 |
| 206 // Test that the whole heap can be serialized when running from a | 205 // Test that the whole heap can be serialized when running from a |
| 207 // bootstrapped heap. | 206 // bootstrapped heap. |
| 208 // (Smoke test.) | 207 // (Smoke test.) |
| 209 TEST(Serialize) { | 208 TEST(Serialize) { |
| 210 if (Snapshot::IsEnabled()) return; | 209 if (Snapshot::IsEnabled()) return; |
| 211 Serialize(); | 210 Serialize(); |
| 212 } | 211 } |
| 213 | 212 |
| 214 | 213 |
| 215 // Test that the whole heap can be serialized. | 214 // Test that the whole heap can be serialized. |
| 216 TEST(Serialize2) { | 215 TEST(Serialize2) { |
| 216 Serializer::Enable(); |
| 217 v8::V8::Initialize(); | 217 v8::V8::Initialize(); |
| 218 Serialize2(); | 218 Serialize2(); |
| 219 } | 219 } |
| 220 | 220 |
| 221 | 221 |
| 222 // Test that the heap isn't destroyed after a serialization. | 222 // Test that the heap isn't destroyed after a serialization. |
| 223 TEST(SerializeNondestructive) { | 223 TEST(SerializeNondestructive) { |
| 224 if (Snapshot::IsEnabled()) return; | 224 if (Snapshot::IsEnabled()) return; |
| 225 StatsTable::SetCounterFunction(counter_function); | 225 StatsTable::SetCounterFunction(counter_function); |
| 226 v8::HandleScope scope; | 226 v8::HandleScope scope; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 TEST(TestThatAlwaysFails) { | 346 TEST(TestThatAlwaysFails) { |
| 347 bool ArtificialFailure = false; | 347 bool ArtificialFailure = false; |
| 348 CHECK(ArtificialFailure); | 348 CHECK(ArtificialFailure); |
| 349 } | 349 } |
| 350 | 350 |
| 351 | 351 |
| 352 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) { | 352 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) { |
| 353 bool ArtificialFailure2 = false; | 353 bool ArtificialFailure2 = false; |
| 354 CHECK(ArtificialFailure2); | 354 CHECK(ArtificialFailure2); |
| 355 } | 355 } |
| OLD | NEW |