| 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 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 SnapshotData partial_snapshot(partial_serializer); | 510 SnapshotData partial_snapshot(partial_serializer); |
| 511 | 511 |
| 512 *partial_blob_out = WritePayload(partial_snapshot.RawData()); | 512 *partial_blob_out = WritePayload(partial_snapshot.RawData()); |
| 513 *startup_blob_out = WritePayload(startup_snapshot.RawData()); | 513 *startup_blob_out = WritePayload(startup_snapshot.RawData()); |
| 514 } | 514 } |
| 515 v8_isolate->Dispose(); | 515 v8_isolate->Dispose(); |
| 516 } | 516 } |
| 517 | 517 |
| 518 UNINITIALIZED_TEST(PartialSerializerCustomContext) { | 518 UNINITIALIZED_TEST(PartialSerializerCustomContext) { |
| 519 DisableTurbofan(); | 519 DisableTurbofan(); |
| 520 FLAG_crankshaft = false; | |
| 521 Vector<const byte> startup_blob; | 520 Vector<const byte> startup_blob; |
| 522 Vector<const byte> partial_blob; | 521 Vector<const byte> partial_blob; |
| 523 PartiallySerializeCustomContext(&startup_blob, &partial_blob); | 522 PartiallySerializeCustomContext(&startup_blob, &partial_blob); |
| 524 | 523 |
| 525 v8::Isolate* v8_isolate = InitializeFromBlob(startup_blob); | 524 v8::Isolate* v8_isolate = InitializeFromBlob(startup_blob); |
| 526 CHECK(v8_isolate); | 525 CHECK(v8_isolate); |
| 527 startup_blob.Dispose(); | 526 startup_blob.Dispose(); |
| 528 { | 527 { |
| 529 v8::Isolate::Scope isolate_scope(v8_isolate); | 528 v8::Isolate::Scope isolate_scope(v8_isolate); |
| 530 | 529 |
| 531 Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate); | 530 Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate); |
| 532 HandleScope handle_scope(isolate); | 531 HandleScope handle_scope(isolate); |
| 533 Handle<Object> root; | 532 Handle<Object> root; |
| 534 Handle<JSGlobalProxy> global_proxy = | 533 Handle<JSGlobalProxy> global_proxy = |
| 535 isolate->factory()->NewUninitializedJSGlobalProxy(); | 534 isolate->factory()->NewUninitializedJSGlobalProxy(); |
| 536 { | 535 { |
| 537 SnapshotData snapshot_data(partial_blob); | 536 SnapshotData snapshot_data(partial_blob); |
| 538 Deserializer deserializer(&snapshot_data); | 537 Deserializer deserializer(&snapshot_data); |
| 539 root = deserializer.DeserializePartial(isolate, global_proxy) | 538 root = deserializer.DeserializePartial(isolate, global_proxy) |
| 540 .ToHandleChecked(); | 539 .ToHandleChecked(); |
| 541 CHECK(root->IsContext()); | 540 CHECK(root->IsContext()); |
| 542 Handle<Context> context = Handle<Context>::cast(root); | 541 Handle<Context> context = Handle<Context>::cast(root); |
| 542 |
| 543 // Add context to the weak native context list |
| 544 context->set(Context::NEXT_CONTEXT_LINK, |
| 545 isolate->heap()->native_contexts_list(), |
| 546 UPDATE_WEAK_WRITE_BARRIER); |
| 547 isolate->heap()->set_native_contexts_list(*context); |
| 548 |
| 543 CHECK(context->global_proxy() == *global_proxy); | 549 CHECK(context->global_proxy() == *global_proxy); |
| 544 Handle<String> o = isolate->factory()->NewStringFromAsciiChecked("o"); | 550 Handle<String> o = isolate->factory()->NewStringFromAsciiChecked("o"); |
| 545 Handle<JSObject> global_object(context->global_object(), isolate); | 551 Handle<JSObject> global_object(context->global_object(), isolate); |
| 546 Handle<Object> property = JSReceiver::GetDataProperty(global_object, o); | 552 Handle<Object> property = JSReceiver::GetDataProperty(global_object, o); |
| 547 CHECK(property.is_identical_to(global_proxy)); | 553 CHECK(property.is_identical_to(global_proxy)); |
| 548 | 554 |
| 549 v8::Local<v8::Context> v8_context = v8::Utils::ToLocal(context); | 555 v8::Local<v8::Context> v8_context = v8::Utils::ToLocal(context); |
| 550 v8::Context::Scope context_scope(v8_context); | 556 v8::Context::Scope context_scope(v8_context); |
| 551 double r = CompileRun("r") | 557 double r = CompileRun("r") |
| 552 ->ToNumber(v8_isolate->GetCurrentContext()) | 558 ->ToNumber(v8_isolate->GetCurrentContext()) |
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1654 delete script_data; | 1660 delete script_data; |
| 1655 } | 1661 } |
| 1656 | 1662 |
| 1657 | 1663 |
| 1658 TEST(SerializationMemoryStats) { | 1664 TEST(SerializationMemoryStats) { |
| 1659 FLAG_profile_deserialization = true; | 1665 FLAG_profile_deserialization = true; |
| 1660 FLAG_always_opt = false; | 1666 FLAG_always_opt = false; |
| 1661 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); | 1667 v8::StartupData blob = v8::V8::CreateSnapshotDataBlob(); |
| 1662 delete[] blob.data; | 1668 delete[] blob.data; |
| 1663 } | 1669 } |
| OLD | NEW |