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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 Isolate* internal_isolate = CcTest::i_isolate(); | 256 Isolate* internal_isolate = CcTest::i_isolate(); |
257 internal_isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, "serialize"); | 257 internal_isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, "serialize"); |
258 WriteToFile(internal_isolate, FLAG_testing_serialization_file); | 258 WriteToFile(internal_isolate, FLAG_testing_serialization_file); |
259 } | 259 } |
260 | 260 |
261 | 261 |
262 // Test that the whole heap can be serialized. | 262 // Test that the whole heap can be serialized. |
263 TEST(Serialize) { | 263 TEST(Serialize) { |
264 if (!Snapshot::HaveASnapshotToStartFrom()) { | 264 if (!Snapshot::HaveASnapshotToStartFrom()) { |
265 Serializer::RequestEnable(CcTest::i_isolate()); | 265 CcTest::i_isolate()->enable_serializer(); |
266 v8::V8::Initialize(); | 266 v8::V8::Initialize(); |
267 Serialize(); | 267 Serialize(); |
268 } | 268 } |
269 } | 269 } |
270 | 270 |
271 | 271 |
272 // Test that heap serialization is non-destructive. | 272 // Test that heap serialization is non-destructive. |
273 TEST(SerializeTwice) { | 273 TEST(SerializeTwice) { |
274 if (!Snapshot::HaveASnapshotToStartFrom()) { | 274 if (!Snapshot::HaveASnapshotToStartFrom()) { |
275 Serializer::RequestEnable(CcTest::i_isolate()); | 275 CcTest::i_isolate()->enable_serializer(); |
276 v8::V8::Initialize(); | 276 v8::V8::Initialize(); |
277 Serialize(); | 277 Serialize(); |
278 Serialize(); | 278 Serialize(); |
279 } | 279 } |
280 } | 280 } |
281 | 281 |
282 | 282 |
283 //---------------------------------------------------------------------------- | 283 //---------------------------------------------------------------------------- |
284 // Tests that the heap can be deserialized. | 284 // Tests that the heap can be deserialized. |
285 | 285 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, c_source); | 363 v8::Local<v8::String> source = v8::String::NewFromUtf8(isolate, c_source); |
364 v8::Local<v8::Script> script = v8::Script::Compile(source); | 364 v8::Local<v8::Script> script = v8::Script::Compile(source); |
365 CHECK_EQ(4, script->Run()->Int32Value()); | 365 CHECK_EQ(4, script->Run()->Int32Value()); |
366 } | 366 } |
367 } | 367 } |
368 | 368 |
369 | 369 |
370 TEST(PartialSerialization) { | 370 TEST(PartialSerialization) { |
371 if (!Snapshot::HaveASnapshotToStartFrom()) { | 371 if (!Snapshot::HaveASnapshotToStartFrom()) { |
372 Isolate* isolate = CcTest::i_isolate(); | 372 Isolate* isolate = CcTest::i_isolate(); |
373 Serializer::RequestEnable(isolate); | 373 CcTest::i_isolate()->enable_serializer(); |
374 v8::V8::Initialize(); | 374 v8::V8::Initialize(); |
375 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 375 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
376 Heap* heap = isolate->heap(); | 376 Heap* heap = isolate->heap(); |
377 | 377 |
378 v8::Persistent<v8::Context> env; | 378 v8::Persistent<v8::Context> env; |
379 { | 379 { |
380 HandleScope scope(isolate); | 380 HandleScope scope(isolate); |
381 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); | 381 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); |
382 } | 382 } |
383 ASSERT(!env.IsEmpty()); | 383 ASSERT(!env.IsEmpty()); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 CHECK(root2->IsString()); | 514 CHECK(root2->IsString()); |
515 CHECK(*root_handle == root2); | 515 CHECK(*root_handle == root2); |
516 } | 516 } |
517 } | 517 } |
518 } | 518 } |
519 | 519 |
520 | 520 |
521 TEST(ContextSerialization) { | 521 TEST(ContextSerialization) { |
522 if (!Snapshot::HaveASnapshotToStartFrom()) { | 522 if (!Snapshot::HaveASnapshotToStartFrom()) { |
523 Isolate* isolate = CcTest::i_isolate(); | 523 Isolate* isolate = CcTest::i_isolate(); |
524 Serializer::RequestEnable(isolate); | 524 CcTest::i_isolate()->enable_serializer(); |
525 v8::V8::Initialize(); | 525 v8::V8::Initialize(); |
526 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 526 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
527 Heap* heap = isolate->heap(); | 527 Heap* heap = isolate->heap(); |
528 | 528 |
529 v8::Persistent<v8::Context> env; | 529 v8::Persistent<v8::Context> env; |
530 { | 530 { |
531 HandleScope scope(isolate); | 531 HandleScope scope(isolate); |
532 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); | 532 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); |
533 } | 533 } |
534 ASSERT(!env.IsEmpty()); | 534 ASSERT(!env.IsEmpty()); |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 TEST(TestThatAlwaysFails) { | 637 TEST(TestThatAlwaysFails) { |
638 bool ArtificialFailure = false; | 638 bool ArtificialFailure = false; |
639 CHECK(ArtificialFailure); | 639 CHECK(ArtificialFailure); |
640 } | 640 } |
641 | 641 |
642 | 642 |
643 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) { | 643 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) { |
644 bool ArtificialFailure2 = false; | 644 bool ArtificialFailure2 = false; |
645 CHECK(ArtificialFailure2); | 645 CHECK(ArtificialFailure2); |
646 } | 646 } |
OLD | NEW |