| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/clustered_snapshot.h" | 5 #include "vm/clustered_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 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 | 1560 |
| 1561 void Trace(Serializer* s, RawObject* object) { | 1561 void Trace(Serializer* s, RawObject* object) { |
| 1562 RawCode* code = Code::RawCast(object); | 1562 RawCode* code = Code::RawCast(object); |
| 1563 objects_.Add(code); | 1563 objects_.Add(code); |
| 1564 | 1564 |
| 1565 s->Push(code->ptr()->object_pool_); | 1565 s->Push(code->ptr()->object_pool_); |
| 1566 s->Push(code->ptr()->owner_); | 1566 s->Push(code->ptr()->owner_); |
| 1567 s->Push(code->ptr()->exception_handlers_); | 1567 s->Push(code->ptr()->exception_handlers_); |
| 1568 s->Push(code->ptr()->pc_descriptors_); | 1568 s->Push(code->ptr()->pc_descriptors_); |
| 1569 s->Push(code->ptr()->stackmaps_); | 1569 s->Push(code->ptr()->stackmaps_); |
| 1570 s->Push(code->ptr()->inlined_id_to_function_); |
| 1571 s->Push(code->ptr()->code_source_map_); |
| 1570 | 1572 |
| 1571 if (s->kind() == Snapshot::kAppJIT) { | 1573 if (s->kind() == Snapshot::kAppJIT) { |
| 1572 s->Push(code->ptr()->deopt_info_array_); | 1574 s->Push(code->ptr()->deopt_info_array_); |
| 1573 s->Push(code->ptr()->static_calls_target_table_); | 1575 s->Push(code->ptr()->static_calls_target_table_); |
| 1574 s->Push(code->ptr()->inlined_id_to_function_); | |
| 1575 s->Push(code->ptr()->code_source_map_); | |
| 1576 NOT_IN_PRODUCT(s->Push(code->ptr()->return_address_metadata_)); | 1576 NOT_IN_PRODUCT(s->Push(code->ptr()->return_address_metadata_)); |
| 1577 } | 1577 } |
| 1578 } | 1578 } |
| 1579 | 1579 |
| 1580 void WriteAlloc(Serializer* s) { | 1580 void WriteAlloc(Serializer* s) { |
| 1581 s->WriteCid(kCodeCid); | 1581 s->WriteCid(kCodeCid); |
| 1582 intptr_t count = objects_.length(); | 1582 intptr_t count = objects_.length(); |
| 1583 s->Write<int32_t>(count); | 1583 s->Write<int32_t>(count); |
| 1584 for (intptr_t i = 0; i < count; i++) { | 1584 for (intptr_t i = 0; i < count; i++) { |
| 1585 RawCode* code = objects_[i]; | 1585 RawCode* code = objects_[i]; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1614 text_offset = s->GetTextOffset(instr, code); | 1614 text_offset = s->GetTextOffset(instr, code); |
| 1615 } | 1615 } |
| 1616 s->Write<int32_t>(text_offset); | 1616 s->Write<int32_t>(text_offset); |
| 1617 } | 1617 } |
| 1618 | 1618 |
| 1619 s->WriteRef(code->ptr()->object_pool_); | 1619 s->WriteRef(code->ptr()->object_pool_); |
| 1620 s->WriteRef(code->ptr()->owner_); | 1620 s->WriteRef(code->ptr()->owner_); |
| 1621 s->WriteRef(code->ptr()->exception_handlers_); | 1621 s->WriteRef(code->ptr()->exception_handlers_); |
| 1622 s->WriteRef(code->ptr()->pc_descriptors_); | 1622 s->WriteRef(code->ptr()->pc_descriptors_); |
| 1623 s->WriteRef(code->ptr()->stackmaps_); | 1623 s->WriteRef(code->ptr()->stackmaps_); |
| 1624 s->WriteRef(code->ptr()->inlined_id_to_function_); |
| 1625 s->WriteRef(code->ptr()->code_source_map_); |
| 1624 | 1626 |
| 1625 if (s->kind() == Snapshot::kAppJIT) { | 1627 if (s->kind() == Snapshot::kAppJIT) { |
| 1626 s->WriteRef(code->ptr()->deopt_info_array_); | 1628 s->WriteRef(code->ptr()->deopt_info_array_); |
| 1627 s->WriteRef(code->ptr()->static_calls_target_table_); | 1629 s->WriteRef(code->ptr()->static_calls_target_table_); |
| 1628 s->WriteRef(code->ptr()->inlined_id_to_function_); | |
| 1629 s->WriteRef(code->ptr()->code_source_map_); | |
| 1630 NOT_IN_PRODUCT(s->WriteRef(code->ptr()->return_address_metadata_)); | 1630 NOT_IN_PRODUCT(s->WriteRef(code->ptr()->return_address_metadata_)); |
| 1631 } | 1631 } |
| 1632 | 1632 |
| 1633 s->Write<int32_t>(code->ptr()->state_bits_); | 1633 s->Write<int32_t>(code->ptr()->state_bits_); |
| 1634 } | 1634 } |
| 1635 } | 1635 } |
| 1636 | 1636 |
| 1637 private: | 1637 private: |
| 1638 GrowableArray<RawCode*> objects_; | 1638 GrowableArray<RawCode*> objects_; |
| 1639 }; | 1639 }; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1684 #endif // !DART_PRECOMPILED_RUNTIME | 1684 #endif // !DART_PRECOMPILED_RUNTIME |
| 1685 | 1685 |
| 1686 code->ptr()->object_pool_ = | 1686 code->ptr()->object_pool_ = |
| 1687 reinterpret_cast<RawObjectPool*>(d->ReadRef()); | 1687 reinterpret_cast<RawObjectPool*>(d->ReadRef()); |
| 1688 code->ptr()->owner_ = d->ReadRef(); | 1688 code->ptr()->owner_ = d->ReadRef(); |
| 1689 code->ptr()->exception_handlers_ = | 1689 code->ptr()->exception_handlers_ = |
| 1690 reinterpret_cast<RawExceptionHandlers*>(d->ReadRef()); | 1690 reinterpret_cast<RawExceptionHandlers*>(d->ReadRef()); |
| 1691 code->ptr()->pc_descriptors_ = | 1691 code->ptr()->pc_descriptors_ = |
| 1692 reinterpret_cast<RawPcDescriptors*>(d->ReadRef()); | 1692 reinterpret_cast<RawPcDescriptors*>(d->ReadRef()); |
| 1693 code->ptr()->stackmaps_ = reinterpret_cast<RawArray*>(d->ReadRef()); | 1693 code->ptr()->stackmaps_ = reinterpret_cast<RawArray*>(d->ReadRef()); |
| 1694 code->ptr()->inlined_id_to_function_ = |
| 1695 reinterpret_cast<RawArray*>(d->ReadRef()); |
| 1696 code->ptr()->code_source_map_ = |
| 1697 reinterpret_cast<RawCodeSourceMap*>(d->ReadRef()); |
| 1694 | 1698 |
| 1695 #if !defined(DART_PRECOMPILED_RUNTIME) | 1699 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 1696 if (d->kind() == Snapshot::kAppJIT) { | 1700 if (d->kind() == Snapshot::kAppJIT) { |
| 1697 code->ptr()->deopt_info_array_ = | 1701 code->ptr()->deopt_info_array_ = |
| 1698 reinterpret_cast<RawArray*>(d->ReadRef()); | 1702 reinterpret_cast<RawArray*>(d->ReadRef()); |
| 1699 code->ptr()->static_calls_target_table_ = | 1703 code->ptr()->static_calls_target_table_ = |
| 1700 reinterpret_cast<RawArray*>(d->ReadRef()); | 1704 reinterpret_cast<RawArray*>(d->ReadRef()); |
| 1701 code->ptr()->inlined_id_to_function_ = | |
| 1702 reinterpret_cast<RawArray*>(d->ReadRef()); | |
| 1703 code->ptr()->code_source_map_ = | |
| 1704 reinterpret_cast<RawCodeSourceMap*>(d->ReadRef()); | |
| 1705 #if defined(PRODUCT) | 1705 #if defined(PRODUCT) |
| 1706 code->ptr()->return_address_metadata_ = Object::null(); | 1706 code->ptr()->return_address_metadata_ = Object::null(); |
| 1707 #else | 1707 #else |
| 1708 code->ptr()->return_address_metadata_ = d->ReadRef(); | 1708 code->ptr()->return_address_metadata_ = d->ReadRef(); |
| 1709 #endif | 1709 #endif |
| 1710 } else { | 1710 } else { |
| 1711 code->ptr()->deopt_info_array_ = Array::null(); | 1711 code->ptr()->deopt_info_array_ = Array::null(); |
| 1712 code->ptr()->static_calls_target_table_ = Array::null(); | 1712 code->ptr()->static_calls_target_table_ = Array::null(); |
| 1713 code->ptr()->inlined_id_to_function_ = Array::null(); | |
| 1714 code->ptr()->code_source_map_ = CodeSourceMap::null(); | |
| 1715 code->ptr()->return_address_metadata_ = Object::null(); | 1713 code->ptr()->return_address_metadata_ = Object::null(); |
| 1716 } | 1714 } |
| 1717 | 1715 |
| 1718 code->ptr()->var_descriptors_ = LocalVarDescriptors::null(); | 1716 code->ptr()->var_descriptors_ = LocalVarDescriptors::null(); |
| 1719 code->ptr()->comments_ = Array::null(); | 1717 code->ptr()->comments_ = Array::null(); |
| 1720 | 1718 |
| 1721 code->ptr()->compile_timestamp_ = 0; | 1719 code->ptr()->compile_timestamp_ = 0; |
| 1722 #endif // !DART_PRECOMPILED_RUNTIME | 1720 #endif // !DART_PRECOMPILED_RUNTIME |
| 1723 | 1721 |
| 1724 code->ptr()->state_bits_ = d->Read<int32_t>(); | 1722 code->ptr()->state_bits_ = d->Read<int32_t>(); |
| (...skipping 3789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5514 thread_->isolate()->SetupImagePage(data_buffer_, | 5512 thread_->isolate()->SetupImagePage(data_buffer_, |
| 5515 /* is_executable */ false); | 5513 /* is_executable */ false); |
| 5516 } | 5514 } |
| 5517 | 5515 |
| 5518 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); | 5516 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); |
| 5519 | 5517 |
| 5520 return ApiError::null(); | 5518 return ApiError::null(); |
| 5521 } | 5519 } |
| 5522 | 5520 |
| 5523 } // namespace dart | 5521 } // namespace dart |
| OLD | NEW |