| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 static int make_code(TypeCode type, int id) { | 97 static int make_code(TypeCode type, int id) { |
| 98 return static_cast<uint32_t>(type) << kReferenceTypeShift | id; | 98 return static_cast<uint32_t>(type) << kReferenceTypeShift | id; |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 TEST(ExternalReferenceEncoder) { | 102 TEST(ExternalReferenceEncoder) { |
| 103 Isolate* isolate = i::Isolate::Current(); | 103 Isolate* isolate = i::Isolate::Current(); |
| 104 isolate->stats_table()->SetCounterFunction(counter_function); | 104 isolate->stats_table()->SetCounterFunction(counter_function); |
| 105 v8::V8::Initialize(); | 105 v8::V8::Initialize(); |
| 106 | 106 |
| 107 ExternalReferenceEncoder encoder; | 107 ExternalReferenceEncoder encoder(isolate); |
| 108 CHECK_EQ(make_code(BUILTIN, Builtins::kArrayCode), | 108 CHECK_EQ(make_code(BUILTIN, Builtins::kArrayCode), |
| 109 Encode(encoder, Builtins::kArrayCode)); | 109 Encode(encoder, Builtins::kArrayCode)); |
| 110 CHECK_EQ(make_code(v8::internal::RUNTIME_FUNCTION, Runtime::kAbort), | 110 CHECK_EQ(make_code(v8::internal::RUNTIME_FUNCTION, Runtime::kAbort), |
| 111 Encode(encoder, Runtime::kAbort)); | 111 Encode(encoder, Runtime::kAbort)); |
| 112 ExternalReference total_compile_size = | 112 ExternalReference total_compile_size = |
| 113 ExternalReference(isolate->counters()->total_compile_size()); | 113 ExternalReference(isolate->counters()->total_compile_size()); |
| 114 CHECK_EQ(make_code(STATS_COUNTER, Counters::k_total_compile_size), | 114 CHECK_EQ(make_code(STATS_COUNTER, Counters::k_total_compile_size), |
| 115 encoder.Encode(total_compile_size.address())); | 115 encoder.Encode(total_compile_size.address())); |
| 116 ExternalReference stack_limit_address = | 116 ExternalReference stack_limit_address = |
| 117 ExternalReference::address_of_stack_limit(isolate); | 117 ExternalReference::address_of_stack_limit(isolate); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 134 CHECK_EQ(make_code(UNCLASSIFIED, 52), | 134 CHECK_EQ(make_code(UNCLASSIFIED, 52), |
| 135 encoder.Encode(ExternalReference::cpu_features().address())); | 135 encoder.Encode(ExternalReference::cpu_features().address())); |
| 136 } | 136 } |
| 137 | 137 |
| 138 | 138 |
| 139 TEST(ExternalReferenceDecoder) { | 139 TEST(ExternalReferenceDecoder) { |
| 140 Isolate* isolate = i::Isolate::Current(); | 140 Isolate* isolate = i::Isolate::Current(); |
| 141 isolate->stats_table()->SetCounterFunction(counter_function); | 141 isolate->stats_table()->SetCounterFunction(counter_function); |
| 142 v8::V8::Initialize(); | 142 v8::V8::Initialize(); |
| 143 | 143 |
| 144 ExternalReferenceDecoder decoder; | 144 ExternalReferenceDecoder decoder(isolate); |
| 145 CHECK_EQ(AddressOf(Builtins::kArrayCode), | 145 CHECK_EQ(AddressOf(Builtins::kArrayCode), |
| 146 decoder.Decode(make_code(BUILTIN, Builtins::kArrayCode))); | 146 decoder.Decode(make_code(BUILTIN, Builtins::kArrayCode))); |
| 147 CHECK_EQ(AddressOf(Runtime::kAbort), | 147 CHECK_EQ(AddressOf(Runtime::kAbort), |
| 148 decoder.Decode(make_code(v8::internal::RUNTIME_FUNCTION, | 148 decoder.Decode(make_code(v8::internal::RUNTIME_FUNCTION, |
| 149 Runtime::kAbort))); | 149 Runtime::kAbort))); |
| 150 ExternalReference total_compile_size = | 150 ExternalReference total_compile_size = |
| 151 ExternalReference(isolate->counters()->total_compile_size()); | 151 ExternalReference(isolate->counters()->total_compile_size()); |
| 152 CHECK_EQ(total_compile_size.address(), | 152 CHECK_EQ(total_compile_size.address(), |
| 153 decoder.Decode( | 153 decoder.Decode( |
| 154 make_code(STATS_COUNTER, | 154 make_code(STATS_COUNTER, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 fprintf(fp, "pointer %d\n", pointer_space_used); | 221 fprintf(fp, "pointer %d\n", pointer_space_used); |
| 222 fprintf(fp, "data %d\n", data_space_used); | 222 fprintf(fp, "data %d\n", data_space_used); |
| 223 fprintf(fp, "code %d\n", code_space_used); | 223 fprintf(fp, "code %d\n", code_space_used); |
| 224 fprintf(fp, "map %d\n", map_space_used); | 224 fprintf(fp, "map %d\n", map_space_used); |
| 225 fprintf(fp, "cell %d\n", cell_space_used); | 225 fprintf(fp, "cell %d\n", cell_space_used); |
| 226 fprintf(fp, "property cell %d\n", property_cell_space_used); | 226 fprintf(fp, "property cell %d\n", property_cell_space_used); |
| 227 fclose(fp); | 227 fclose(fp); |
| 228 } | 228 } |
| 229 | 229 |
| 230 | 230 |
| 231 static bool WriteToFile(const char* snapshot_file) { | 231 static bool WriteToFile(Isolate* isolate, const char* snapshot_file) { |
| 232 FileByteSink file(snapshot_file); | 232 FileByteSink file(snapshot_file); |
| 233 StartupSerializer ser(&file); | 233 StartupSerializer ser(isolate, &file); |
| 234 ser.Serialize(); | 234 ser.Serialize(); |
| 235 | 235 |
| 236 file.WriteSpaceUsed( | 236 file.WriteSpaceUsed( |
| 237 ser.CurrentAllocationAddress(NEW_SPACE), | 237 ser.CurrentAllocationAddress(NEW_SPACE), |
| 238 ser.CurrentAllocationAddress(OLD_POINTER_SPACE), | 238 ser.CurrentAllocationAddress(OLD_POINTER_SPACE), |
| 239 ser.CurrentAllocationAddress(OLD_DATA_SPACE), | 239 ser.CurrentAllocationAddress(OLD_DATA_SPACE), |
| 240 ser.CurrentAllocationAddress(CODE_SPACE), | 240 ser.CurrentAllocationAddress(CODE_SPACE), |
| 241 ser.CurrentAllocationAddress(MAP_SPACE), | 241 ser.CurrentAllocationAddress(MAP_SPACE), |
| 242 ser.CurrentAllocationAddress(CELL_SPACE), | 242 ser.CurrentAllocationAddress(CELL_SPACE), |
| 243 ser.CurrentAllocationAddress(PROPERTY_CELL_SPACE)); | 243 ser.CurrentAllocationAddress(PROPERTY_CELL_SPACE)); |
| 244 | 244 |
| 245 return true; | 245 return true; |
| 246 } | 246 } |
| 247 | 247 |
| 248 | 248 |
| 249 static void Serialize() { | 249 static void Serialize() { |
| 250 // We have to create one context. One reason for this is so that the builtins | 250 // We have to create one context. One reason for this is so that the builtins |
| 251 // can be loaded from v8natives.js and their addresses can be processed. This | 251 // can be loaded from v8natives.js and their addresses can be processed. This |
| 252 // will clear the pending fixups array, which would otherwise contain GC roots | 252 // will clear the pending fixups array, which would otherwise contain GC roots |
| 253 // that would confuse the serialization/deserialization process. | 253 // that would confuse the serialization/deserialization process. |
| 254 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 254 { | 255 { |
| 255 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | |
| 256 v8::HandleScope scope(isolate); | 256 v8::HandleScope scope(isolate); |
| 257 v8::Context::New(isolate); | 257 v8::Context::New(isolate); |
| 258 } | 258 } |
| 259 WriteToFile(FLAG_testing_serialization_file); | 259 WriteToFile(reinterpret_cast<Isolate*>(isolate), |
| 260 FLAG_testing_serialization_file); |
| 260 } | 261 } |
| 261 | 262 |
| 262 | 263 |
| 263 // Test that the whole heap can be serialized. | 264 // Test that the whole heap can be serialized. |
| 264 TEST(Serialize) { | 265 TEST(Serialize) { |
| 265 if (!Snapshot::HaveASnapshotToStartFrom()) { | 266 if (!Snapshot::HaveASnapshotToStartFrom()) { |
| 266 Serializer::Enable(); | 267 Serializer::Enable(Isolate::Current()); |
| 267 v8::V8::Initialize(); | 268 v8::V8::Initialize(); |
| 268 Serialize(); | 269 Serialize(); |
| 269 } | 270 } |
| 270 } | 271 } |
| 271 | 272 |
| 272 | 273 |
| 273 // Test that heap serialization is non-destructive. | 274 // Test that heap serialization is non-destructive. |
| 274 TEST(SerializeTwice) { | 275 TEST(SerializeTwice) { |
| 275 if (!Snapshot::HaveASnapshotToStartFrom()) { | 276 if (!Snapshot::HaveASnapshotToStartFrom()) { |
| 276 Serializer::Enable(); | 277 Serializer::Enable(Isolate::Current()); |
| 277 v8::V8::Initialize(); | 278 v8::V8::Initialize(); |
| 278 Serialize(); | 279 Serialize(); |
| 279 Serialize(); | 280 Serialize(); |
| 280 } | 281 } |
| 281 } | 282 } |
| 282 | 283 |
| 283 | 284 |
| 284 //---------------------------------------------------------------------------- | 285 //---------------------------------------------------------------------------- |
| 285 // Tests that the heap can be deserialized. | 286 // Tests that the heap can be deserialized. |
| 286 | 287 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 const char* c_source = "\"1234\".length"; | 365 const char* c_source = "\"1234\".length"; |
| 365 v8::Local<v8::String> source = v8::String::New(c_source); | 366 v8::Local<v8::String> source = v8::String::New(c_source); |
| 366 v8::Local<v8::Script> script = v8::Script::Compile(source); | 367 v8::Local<v8::Script> script = v8::Script::Compile(source); |
| 367 CHECK_EQ(4, script->Run()->Int32Value()); | 368 CHECK_EQ(4, script->Run()->Int32Value()); |
| 368 } | 369 } |
| 369 } | 370 } |
| 370 | 371 |
| 371 | 372 |
| 372 TEST(PartialSerialization) { | 373 TEST(PartialSerialization) { |
| 373 if (!Snapshot::HaveASnapshotToStartFrom()) { | 374 if (!Snapshot::HaveASnapshotToStartFrom()) { |
| 374 Serializer::Enable(); | 375 Isolate* isolate = Isolate::Current(); |
| 376 Serializer::Enable(isolate); |
| 375 v8::V8::Initialize(); | 377 v8::V8::Initialize(); |
| 376 Isolate* isolate = Isolate::Current(); | |
| 377 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 378 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
| 378 Heap* heap = isolate->heap(); | 379 Heap* heap = isolate->heap(); |
| 379 | 380 |
| 380 v8::Persistent<v8::Context> env; | 381 v8::Persistent<v8::Context> env; |
| 381 { | 382 { |
| 382 HandleScope scope(isolate); | 383 HandleScope scope(isolate); |
| 383 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); | 384 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); |
| 384 } | 385 } |
| 385 ASSERT(!env.IsEmpty()); | 386 ASSERT(!env.IsEmpty()); |
| 386 { | 387 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 408 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); | 409 Vector<char> startup_name = Vector<char>::New(file_name_length + 1); |
| 409 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); | 410 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); |
| 410 | 411 |
| 411 { | 412 { |
| 412 v8::HandleScope handle_scope(v8_isolate); | 413 v8::HandleScope handle_scope(v8_isolate); |
| 413 v8::Local<v8::Context>::New(v8_isolate, env)->Exit(); | 414 v8::Local<v8::Context>::New(v8_isolate, env)->Exit(); |
| 414 } | 415 } |
| 415 env.Dispose(); | 416 env.Dispose(); |
| 416 | 417 |
| 417 FileByteSink startup_sink(startup_name.start()); | 418 FileByteSink startup_sink(startup_name.start()); |
| 418 StartupSerializer startup_serializer(&startup_sink); | 419 StartupSerializer startup_serializer(isolate, &startup_sink); |
| 419 startup_serializer.SerializeStrongReferences(); | 420 startup_serializer.SerializeStrongReferences(); |
| 420 | 421 |
| 421 FileByteSink partial_sink(FLAG_testing_serialization_file); | 422 FileByteSink partial_sink(FLAG_testing_serialization_file); |
| 422 PartialSerializer p_ser(&startup_serializer, &partial_sink); | 423 PartialSerializer p_ser(isolate, &startup_serializer, &partial_sink); |
| 423 p_ser.Serialize(&raw_foo); | 424 p_ser.Serialize(&raw_foo); |
| 424 startup_serializer.SerializeWeakReferences(); | 425 startup_serializer.SerializeWeakReferences(); |
| 425 | 426 |
| 426 partial_sink.WriteSpaceUsed( | 427 partial_sink.WriteSpaceUsed( |
| 427 p_ser.CurrentAllocationAddress(NEW_SPACE), | 428 p_ser.CurrentAllocationAddress(NEW_SPACE), |
| 428 p_ser.CurrentAllocationAddress(OLD_POINTER_SPACE), | 429 p_ser.CurrentAllocationAddress(OLD_POINTER_SPACE), |
| 429 p_ser.CurrentAllocationAddress(OLD_DATA_SPACE), | 430 p_ser.CurrentAllocationAddress(OLD_DATA_SPACE), |
| 430 p_ser.CurrentAllocationAddress(CODE_SPACE), | 431 p_ser.CurrentAllocationAddress(CODE_SPACE), |
| 431 p_ser.CurrentAllocationAddress(MAP_SPACE), | 432 p_ser.CurrentAllocationAddress(MAP_SPACE), |
| 432 p_ser.CurrentAllocationAddress(CELL_SPACE), | 433 p_ser.CurrentAllocationAddress(CELL_SPACE), |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); | 488 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); |
| 488 | 489 |
| 489 CHECK(Snapshot::Initialize(startup_name.start())); | 490 CHECK(Snapshot::Initialize(startup_name.start())); |
| 490 startup_name.Dispose(); | 491 startup_name.Dispose(); |
| 491 | 492 |
| 492 const char* file_name = FLAG_testing_serialization_file; | 493 const char* file_name = FLAG_testing_serialization_file; |
| 493 | 494 |
| 494 int snapshot_size = 0; | 495 int snapshot_size = 0; |
| 495 byte* snapshot = ReadBytes(file_name, &snapshot_size); | 496 byte* snapshot = ReadBytes(file_name, &snapshot_size); |
| 496 | 497 |
| 498 Isolate* isolate = Isolate::Current(); |
| 497 Object* root; | 499 Object* root; |
| 498 { | 500 { |
| 499 SnapshotByteSource source(snapshot, snapshot_size); | 501 SnapshotByteSource source(snapshot, snapshot_size); |
| 500 Deserializer deserializer(&source); | 502 Deserializer deserializer(&source); |
| 501 ReserveSpaceForSnapshot(&deserializer, file_name); | 503 ReserveSpaceForSnapshot(&deserializer, file_name); |
| 502 deserializer.DeserializePartial(&root); | 504 deserializer.DeserializePartial(isolate, &root); |
| 503 CHECK(root->IsString()); | 505 CHECK(root->IsString()); |
| 504 } | 506 } |
| 505 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 507 HandleScope handle_scope(isolate); |
| 506 Handle<Object> root_handle(root, Isolate::Current()); | 508 Handle<Object> root_handle(root, isolate); |
| 507 | 509 |
| 508 | 510 |
| 509 Object* root2; | 511 Object* root2; |
| 510 { | 512 { |
| 511 SnapshotByteSource source(snapshot, snapshot_size); | 513 SnapshotByteSource source(snapshot, snapshot_size); |
| 512 Deserializer deserializer(&source); | 514 Deserializer deserializer(&source); |
| 513 ReserveSpaceForSnapshot(&deserializer, file_name); | 515 ReserveSpaceForSnapshot(&deserializer, file_name); |
| 514 deserializer.DeserializePartial(&root2); | 516 deserializer.DeserializePartial(isolate, &root2); |
| 515 CHECK(root2->IsString()); | 517 CHECK(root2->IsString()); |
| 516 CHECK(*root_handle == root2); | 518 CHECK(*root_handle == root2); |
| 517 } | 519 } |
| 518 } | 520 } |
| 519 } | 521 } |
| 520 | 522 |
| 521 | 523 |
| 522 TEST(ContextSerialization) { | 524 TEST(ContextSerialization) { |
| 523 if (!Snapshot::HaveASnapshotToStartFrom()) { | 525 if (!Snapshot::HaveASnapshotToStartFrom()) { |
| 524 Serializer::Enable(); | |
| 525 v8::V8::Initialize(); | 526 v8::V8::Initialize(); |
| 526 Isolate* isolate = Isolate::Current(); | 527 Isolate* isolate = Isolate::Current(); |
| 528 Serializer::Enable(isolate); |
| 527 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); | 529 v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate); |
| 528 Heap* heap = isolate->heap(); | 530 Heap* heap = isolate->heap(); |
| 529 | 531 |
| 530 v8::Persistent<v8::Context> env; | 532 v8::Persistent<v8::Context> env; |
| 531 { | 533 { |
| 532 HandleScope scope(isolate); | 534 HandleScope scope(isolate); |
| 533 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); | 535 env.Reset(v8_isolate, v8::Context::New(v8_isolate)); |
| 534 } | 536 } |
| 535 ASSERT(!env.IsEmpty()); | 537 ASSERT(!env.IsEmpty()); |
| 536 { | 538 { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 554 { | 556 { |
| 555 v8::HandleScope handle_scope(v8_isolate); | 557 v8::HandleScope handle_scope(v8_isolate); |
| 556 v8::Local<v8::Context>::New(v8_isolate, env)->Exit(); | 558 v8::Local<v8::Context>::New(v8_isolate, env)->Exit(); |
| 557 } | 559 } |
| 558 | 560 |
| 559 i::Object* raw_context = *v8::Utils::OpenPersistent(env); | 561 i::Object* raw_context = *v8::Utils::OpenPersistent(env); |
| 560 | 562 |
| 561 env.Dispose(); | 563 env.Dispose(); |
| 562 | 564 |
| 563 FileByteSink startup_sink(startup_name.start()); | 565 FileByteSink startup_sink(startup_name.start()); |
| 564 StartupSerializer startup_serializer(&startup_sink); | 566 StartupSerializer startup_serializer(isolate, &startup_sink); |
| 565 startup_serializer.SerializeStrongReferences(); | 567 startup_serializer.SerializeStrongReferences(); |
| 566 | 568 |
| 567 FileByteSink partial_sink(FLAG_testing_serialization_file); | 569 FileByteSink partial_sink(FLAG_testing_serialization_file); |
| 568 PartialSerializer p_ser(&startup_serializer, &partial_sink); | 570 PartialSerializer p_ser(isolate, &startup_serializer, &partial_sink); |
| 569 p_ser.Serialize(&raw_context); | 571 p_ser.Serialize(&raw_context); |
| 570 startup_serializer.SerializeWeakReferences(); | 572 startup_serializer.SerializeWeakReferences(); |
| 571 | 573 |
| 572 partial_sink.WriteSpaceUsed( | 574 partial_sink.WriteSpaceUsed( |
| 573 p_ser.CurrentAllocationAddress(NEW_SPACE), | 575 p_ser.CurrentAllocationAddress(NEW_SPACE), |
| 574 p_ser.CurrentAllocationAddress(OLD_POINTER_SPACE), | 576 p_ser.CurrentAllocationAddress(OLD_POINTER_SPACE), |
| 575 p_ser.CurrentAllocationAddress(OLD_DATA_SPACE), | 577 p_ser.CurrentAllocationAddress(OLD_DATA_SPACE), |
| 576 p_ser.CurrentAllocationAddress(CODE_SPACE), | 578 p_ser.CurrentAllocationAddress(CODE_SPACE), |
| 577 p_ser.CurrentAllocationAddress(MAP_SPACE), | 579 p_ser.CurrentAllocationAddress(MAP_SPACE), |
| 578 p_ser.CurrentAllocationAddress(CELL_SPACE), | 580 p_ser.CurrentAllocationAddress(CELL_SPACE), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 598 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); | 600 OS::SNPrintF(startup_name, "%s.startup", FLAG_testing_serialization_file); |
| 599 | 601 |
| 600 CHECK(Snapshot::Initialize(startup_name.start())); | 602 CHECK(Snapshot::Initialize(startup_name.start())); |
| 601 startup_name.Dispose(); | 603 startup_name.Dispose(); |
| 602 | 604 |
| 603 const char* file_name = FLAG_testing_serialization_file; | 605 const char* file_name = FLAG_testing_serialization_file; |
| 604 | 606 |
| 605 int snapshot_size = 0; | 607 int snapshot_size = 0; |
| 606 byte* snapshot = ReadBytes(file_name, &snapshot_size); | 608 byte* snapshot = ReadBytes(file_name, &snapshot_size); |
| 607 | 609 |
| 610 Isolate* isolate = Isolate::Current(); |
| 608 Object* root; | 611 Object* root; |
| 609 { | 612 { |
| 610 SnapshotByteSource source(snapshot, snapshot_size); | 613 SnapshotByteSource source(snapshot, snapshot_size); |
| 611 Deserializer deserializer(&source); | 614 Deserializer deserializer(&source); |
| 612 ReserveSpaceForSnapshot(&deserializer, file_name); | 615 ReserveSpaceForSnapshot(&deserializer, file_name); |
| 613 deserializer.DeserializePartial(&root); | 616 deserializer.DeserializePartial(isolate, &root); |
| 614 CHECK(root->IsContext()); | 617 CHECK(root->IsContext()); |
| 615 } | 618 } |
| 616 v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); | 619 HandleScope handle_scope(isolate); |
| 617 Handle<Object> root_handle(root, Isolate::Current()); | 620 Handle<Object> root_handle(root, isolate); |
| 618 | 621 |
| 619 | 622 |
| 620 Object* root2; | 623 Object* root2; |
| 621 { | 624 { |
| 622 SnapshotByteSource source(snapshot, snapshot_size); | 625 SnapshotByteSource source(snapshot, snapshot_size); |
| 623 Deserializer deserializer(&source); | 626 Deserializer deserializer(&source); |
| 624 ReserveSpaceForSnapshot(&deserializer, file_name); | 627 ReserveSpaceForSnapshot(&deserializer, file_name); |
| 625 deserializer.DeserializePartial(&root2); | 628 deserializer.DeserializePartial(isolate, &root2); |
| 626 CHECK(root2->IsContext()); | 629 CHECK(root2->IsContext()); |
| 627 CHECK(*root_handle != root2); | 630 CHECK(*root_handle != root2); |
| 628 } | 631 } |
| 629 } | 632 } |
| 630 } | 633 } |
| 631 | 634 |
| 632 | 635 |
| 633 TEST(TestThatAlwaysSucceeds) { | 636 TEST(TestThatAlwaysSucceeds) { |
| 634 } | 637 } |
| 635 | 638 |
| 636 | 639 |
| 637 TEST(TestThatAlwaysFails) { | 640 TEST(TestThatAlwaysFails) { |
| 638 bool ArtificialFailure = false; | 641 bool ArtificialFailure = false; |
| 639 CHECK(ArtificialFailure); | 642 CHECK(ArtificialFailure); |
| 640 } | 643 } |
| 641 | 644 |
| 642 | 645 |
| 643 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) { | 646 DEPENDENT_TEST(DependentTestThatAlwaysFails, TestThatAlwaysSucceeds) { |
| 644 bool ArtificialFailure2 = false; | 647 bool ArtificialFailure2 = false; |
| 645 CHECK(ArtificialFailure2); | 648 CHECK(ArtificialFailure2); |
| 646 } | 649 } |
| OLD | NEW |