| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/snapshot.h" | 5 #include "vm/snapshot.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
| 9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
| 10 #include "vm/dart.h" | 10 #include "vm/dart.h" |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 for (intptr_t i = 0; i <= num_flds; i++) { | 618 for (intptr_t i = 0; i <= num_flds; i++) { |
| 619 *(object_store->from() + i) = ReadObjectImpl(kAsInlinedObject); | 619 *(object_store->from() + i) = ReadObjectImpl(kAsInlinedObject); |
| 620 } | 620 } |
| 621 for (intptr_t i = 0; i < backward_references_->length(); i++) { | 621 for (intptr_t i = 0; i < backward_references_->length(); i++) { |
| 622 if (!(*backward_references_)[i].is_deserialized()) { | 622 if (!(*backward_references_)[i].is_deserialized()) { |
| 623 ReadObjectImpl(kAsInlinedObject); | 623 ReadObjectImpl(kAsInlinedObject); |
| 624 (*backward_references_)[i].set_state(kIsDeserialized); | 624 (*backward_references_)[i].set_state(kIsDeserialized); |
| 625 } | 625 } |
| 626 } | 626 } |
| 627 | 627 |
| 628 if (Snapshot::IncludesCode(kind_)) { | 628 if (kind_ == Snapshot::kAppNoJIT) { |
| 629 ICData& ic = ICData::Handle(thread->zone()); | 629 ICData& ic = ICData::Handle(thread->zone()); |
| 630 Object& funcOrCode = Object::Handle(thread->zone()); | 630 Object& funcOrCode = Object::Handle(thread->zone()); |
| 631 Code& code = Code::Handle(thread->zone()); | 631 Code& code = Code::Handle(thread->zone()); |
| 632 Smi& entry_point = Smi::Handle(thread->zone()); | 632 Smi& entry_point = Smi::Handle(thread->zone()); |
| 633 for (intptr_t i = 0; i < backward_references_->length(); i++) { | 633 for (intptr_t i = 0; i < backward_references_->length(); i++) { |
| 634 if ((*backward_references_)[i].reference()->IsICData()) { | 634 if ((*backward_references_)[i].reference()->IsICData()) { |
| 635 ic ^= (*backward_references_)[i].reference()->raw(); | 635 ic ^= (*backward_references_)[i].reference()->raw(); |
| 636 for (intptr_t j = 0; j < ic.NumberOfChecks(); j++) { | 636 for (intptr_t j = 0; j < ic.NumberOfChecks(); j++) { |
| 637 funcOrCode = ic.GetTargetOrCodeAt(j); | 637 funcOrCode = ic.GetTargetOrCodeAt(j); |
| 638 if (funcOrCode.IsCode()) { | 638 if (funcOrCode.IsCode()) { |
| (...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 const uint8_t* data_buffer, | 1757 const uint8_t* data_buffer, |
| 1758 Thread* thread) | 1758 Thread* thread) |
| 1759 : SnapshotReader(buffer, | 1759 : SnapshotReader(buffer, |
| 1760 size, | 1760 size, |
| 1761 instructions_buffer, | 1761 instructions_buffer, |
| 1762 data_buffer, | 1762 data_buffer, |
| 1763 kind, | 1763 kind, |
| 1764 new ZoneGrowableArray<BackRefNode>( | 1764 new ZoneGrowableArray<BackRefNode>( |
| 1765 kNumInitialReferencesInFullSnapshot), | 1765 kNumInitialReferencesInFullSnapshot), |
| 1766 thread) { | 1766 thread) { |
| 1767 isolate()->set_compilation_allowed(instructions_buffer_ == NULL); | 1767 isolate()->set_compilation_allowed(kind != Snapshot::kAppNoJIT); |
| 1768 ASSERT(Snapshot::IsFull(kind)); | 1768 ASSERT(Snapshot::IsFull(kind)); |
| 1769 } | 1769 } |
| 1770 | 1770 |
| 1771 | 1771 |
| 1772 IsolateSnapshotReader::~IsolateSnapshotReader() { | 1772 IsolateSnapshotReader::~IsolateSnapshotReader() { |
| 1773 ResetBackwardReferenceTable(); | 1773 ResetBackwardReferenceTable(); |
| 1774 } | 1774 } |
| 1775 | 1775 |
| 1776 | 1776 |
| 1777 ScriptSnapshotReader::ScriptSnapshotReader(const uint8_t* buffer, | 1777 ScriptSnapshotReader::ScriptSnapshotReader(const uint8_t* buffer, |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2181 OS::Print("Instructions(CodeSize): %" Pd "\n", | 2181 OS::Print("Instructions(CodeSize): %" Pd "\n", |
| 2182 instructions_writer_->binary_size()); | 2182 instructions_writer_->binary_size()); |
| 2183 intptr_t total = VmIsolateSnapshotSize() + | 2183 intptr_t total = VmIsolateSnapshotSize() + |
| 2184 IsolateSnapshotSize() + | 2184 IsolateSnapshotSize() + |
| 2185 instructions_writer_->binary_size(); | 2185 instructions_writer_->binary_size(); |
| 2186 OS::Print("Total(CodeSize): %" Pd "\n", total); | 2186 OS::Print("Total(CodeSize): %" Pd "\n", total); |
| 2187 } | 2187 } |
| 2188 } | 2188 } |
| 2189 | 2189 |
| 2190 | 2190 |
| 2191 PrecompiledSnapshotWriter::PrecompiledSnapshotWriter( | |
| 2192 uint8_t** vm_isolate_snapshot_buffer, | |
| 2193 uint8_t** isolate_snapshot_buffer, | |
| 2194 ReAlloc alloc, | |
| 2195 InstructionsWriter* instructions_writer) | |
| 2196 : FullSnapshotWriter(Snapshot::kAppNoJIT, | |
| 2197 vm_isolate_snapshot_buffer, | |
| 2198 isolate_snapshot_buffer, | |
| 2199 alloc, | |
| 2200 instructions_writer, | |
| 2201 false /* vm_isolate_is_symbolic */) { | |
| 2202 } | |
| 2203 | |
| 2204 | |
| 2205 PrecompiledSnapshotWriter::~PrecompiledSnapshotWriter() {} | |
| 2206 | |
| 2207 | |
| 2208 ForwardList::ForwardList(Thread* thread, intptr_t first_object_id) | 2191 ForwardList::ForwardList(Thread* thread, intptr_t first_object_id) |
| 2209 : thread_(thread), | 2192 : thread_(thread), |
| 2210 first_object_id_(first_object_id), | 2193 first_object_id_(first_object_id), |
| 2211 nodes_(), | 2194 nodes_(), |
| 2212 first_unprocessed_object_id_(first_object_id) { | 2195 first_unprocessed_object_id_(first_object_id) { |
| 2213 } | 2196 } |
| 2214 | 2197 |
| 2215 | 2198 |
| 2216 ForwardList::~ForwardList() { | 2199 ForwardList::~ForwardList() { |
| 2217 heap()->ResetObjectIdTable(); | 2200 heap()->ResetObjectIdTable(); |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2786 if (setjmp(*jump.Set()) == 0) { | 2769 if (setjmp(*jump.Set()) == 0) { |
| 2787 NoSafepointScope no_safepoint; | 2770 NoSafepointScope no_safepoint; |
| 2788 WriteObject(obj.raw()); | 2771 WriteObject(obj.raw()); |
| 2789 } else { | 2772 } else { |
| 2790 ThrowException(exception_type(), exception_msg()); | 2773 ThrowException(exception_type(), exception_msg()); |
| 2791 } | 2774 } |
| 2792 } | 2775 } |
| 2793 | 2776 |
| 2794 | 2777 |
| 2795 } // namespace dart | 2778 } // namespace dart |
| OLD | NEW |