| 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 1553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 1570 |
| 1571 if (s->kind() == Snapshot::kAppJIT) { | 1571 if (s->kind() == Snapshot::kAppJIT) { |
| 1572 s->Push(code->ptr()->deopt_info_array_); | 1572 s->Push(code->ptr()->deopt_info_array_); |
| 1573 s->Push(code->ptr()->static_calls_target_table_); | 1573 s->Push(code->ptr()->static_calls_target_table_); |
| 1574 NOT_IN_PRODUCT(s->Push(code->ptr()->inlined_id_to_function_)); | 1574 s->Push(code->ptr()->inlined_id_to_function_); |
| 1575 s->Push(code->ptr()->code_source_map_); |
| 1575 NOT_IN_PRODUCT(s->Push(code->ptr()->return_address_metadata_)); | 1576 NOT_IN_PRODUCT(s->Push(code->ptr()->return_address_metadata_)); |
| 1576 } | 1577 } |
| 1577 } | 1578 } |
| 1578 | 1579 |
| 1579 void WriteAlloc(Serializer* s) { | 1580 void WriteAlloc(Serializer* s) { |
| 1580 s->WriteCid(kCodeCid); | 1581 s->WriteCid(kCodeCid); |
| 1581 intptr_t count = objects_.length(); | 1582 intptr_t count = objects_.length(); |
| 1582 s->Write<int32_t>(count); | 1583 s->Write<int32_t>(count); |
| 1583 for (intptr_t i = 0; i < count; i++) { | 1584 for (intptr_t i = 0; i < count; i++) { |
| 1584 RawCode* code = objects_[i]; | 1585 RawCode* code = objects_[i]; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1617 | 1618 |
| 1618 s->WriteRef(code->ptr()->object_pool_); | 1619 s->WriteRef(code->ptr()->object_pool_); |
| 1619 s->WriteRef(code->ptr()->owner_); | 1620 s->WriteRef(code->ptr()->owner_); |
| 1620 s->WriteRef(code->ptr()->exception_handlers_); | 1621 s->WriteRef(code->ptr()->exception_handlers_); |
| 1621 s->WriteRef(code->ptr()->pc_descriptors_); | 1622 s->WriteRef(code->ptr()->pc_descriptors_); |
| 1622 s->WriteRef(code->ptr()->stackmaps_); | 1623 s->WriteRef(code->ptr()->stackmaps_); |
| 1623 | 1624 |
| 1624 if (s->kind() == Snapshot::kAppJIT) { | 1625 if (s->kind() == Snapshot::kAppJIT) { |
| 1625 s->WriteRef(code->ptr()->deopt_info_array_); | 1626 s->WriteRef(code->ptr()->deopt_info_array_); |
| 1626 s->WriteRef(code->ptr()->static_calls_target_table_); | 1627 s->WriteRef(code->ptr()->static_calls_target_table_); |
| 1627 NOT_IN_PRODUCT(s->WriteRef(code->ptr()->inlined_id_to_function_)); | 1628 s->WriteRef(code->ptr()->inlined_id_to_function_); |
| 1629 s->WriteRef(code->ptr()->code_source_map_); |
| 1628 NOT_IN_PRODUCT(s->WriteRef(code->ptr()->return_address_metadata_)); | 1630 NOT_IN_PRODUCT(s->WriteRef(code->ptr()->return_address_metadata_)); |
| 1629 } | 1631 } |
| 1630 | 1632 |
| 1631 s->Write<int32_t>(code->ptr()->state_bits_); | 1633 s->Write<int32_t>(code->ptr()->state_bits_); |
| 1632 } | 1634 } |
| 1633 } | 1635 } |
| 1634 | 1636 |
| 1635 private: | 1637 private: |
| 1636 GrowableArray<RawCode*> objects_; | 1638 GrowableArray<RawCode*> objects_; |
| 1637 }; | 1639 }; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 code->ptr()->pc_descriptors_ = | 1691 code->ptr()->pc_descriptors_ = |
| 1690 reinterpret_cast<RawPcDescriptors*>(d->ReadRef()); | 1692 reinterpret_cast<RawPcDescriptors*>(d->ReadRef()); |
| 1691 code->ptr()->stackmaps_ = reinterpret_cast<RawArray*>(d->ReadRef()); | 1693 code->ptr()->stackmaps_ = reinterpret_cast<RawArray*>(d->ReadRef()); |
| 1692 | 1694 |
| 1693 #if !defined(DART_PRECOMPILED_RUNTIME) | 1695 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 1694 if (d->kind() == Snapshot::kAppJIT) { | 1696 if (d->kind() == Snapshot::kAppJIT) { |
| 1695 code->ptr()->deopt_info_array_ = | 1697 code->ptr()->deopt_info_array_ = |
| 1696 reinterpret_cast<RawArray*>(d->ReadRef()); | 1698 reinterpret_cast<RawArray*>(d->ReadRef()); |
| 1697 code->ptr()->static_calls_target_table_ = | 1699 code->ptr()->static_calls_target_table_ = |
| 1698 reinterpret_cast<RawArray*>(d->ReadRef()); | 1700 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()); |
| 1699 #if defined(PRODUCT) | 1705 #if defined(PRODUCT) |
| 1700 code->ptr()->inlined_id_to_function_ = Array::null(); | |
| 1701 code->ptr()->return_address_metadata_ = Object::null(); | 1706 code->ptr()->return_address_metadata_ = Object::null(); |
| 1702 #else | 1707 #else |
| 1703 code->ptr()->inlined_id_to_function_ = | |
| 1704 reinterpret_cast<RawArray*>(d->ReadRef()); | |
| 1705 code->ptr()->return_address_metadata_ = d->ReadRef(); | 1708 code->ptr()->return_address_metadata_ = d->ReadRef(); |
| 1706 #endif | 1709 #endif |
| 1707 } else { | 1710 } else { |
| 1708 code->ptr()->deopt_info_array_ = Array::null(); | 1711 code->ptr()->deopt_info_array_ = Array::null(); |
| 1709 code->ptr()->static_calls_target_table_ = Array::null(); | 1712 code->ptr()->static_calls_target_table_ = Array::null(); |
| 1710 code->ptr()->inlined_id_to_function_ = Array::null(); | 1713 code->ptr()->inlined_id_to_function_ = Array::null(); |
| 1714 code->ptr()->code_source_map_ = CodeSourceMap::null(); |
| 1711 code->ptr()->return_address_metadata_ = Object::null(); | 1715 code->ptr()->return_address_metadata_ = Object::null(); |
| 1712 } | 1716 } |
| 1713 | 1717 |
| 1714 code->ptr()->var_descriptors_ = LocalVarDescriptors::null(); | 1718 code->ptr()->var_descriptors_ = LocalVarDescriptors::null(); |
| 1715 code->ptr()->code_source_map_ = CodeSourceMap::null(); | |
| 1716 code->ptr()->comments_ = Array::null(); | 1719 code->ptr()->comments_ = Array::null(); |
| 1717 | 1720 |
| 1718 code->ptr()->compile_timestamp_ = 0; | 1721 code->ptr()->compile_timestamp_ = 0; |
| 1719 #endif // !DART_PRECOMPILED_RUNTIME | 1722 #endif // !DART_PRECOMPILED_RUNTIME |
| 1720 | 1723 |
| 1721 code->ptr()->state_bits_ = d->Read<int32_t>(); | 1724 code->ptr()->state_bits_ = d->Read<int32_t>(); |
| 1722 } | 1725 } |
| 1723 } | 1726 } |
| 1724 }; | 1727 }; |
| 1725 | 1728 |
| (...skipping 2812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4538 case kLibraryCid: | 4541 case kLibraryCid: |
| 4539 return new (Z) LibrarySerializationCluster(); | 4542 return new (Z) LibrarySerializationCluster(); |
| 4540 case kNamespaceCid: | 4543 case kNamespaceCid: |
| 4541 return new (Z) NamespaceSerializationCluster(); | 4544 return new (Z) NamespaceSerializationCluster(); |
| 4542 case kCodeCid: | 4545 case kCodeCid: |
| 4543 return new (Z) CodeSerializationCluster(); | 4546 return new (Z) CodeSerializationCluster(); |
| 4544 case kObjectPoolCid: | 4547 case kObjectPoolCid: |
| 4545 return new (Z) ObjectPoolSerializationCluster(); | 4548 return new (Z) ObjectPoolSerializationCluster(); |
| 4546 case kPcDescriptorsCid: | 4549 case kPcDescriptorsCid: |
| 4547 return new (Z) RODataSerializationCluster(kPcDescriptorsCid); | 4550 return new (Z) RODataSerializationCluster(kPcDescriptorsCid); |
| 4551 case kCodeSourceMapCid: |
| 4552 return new (Z) RODataSerializationCluster(kCodeSourceMapCid); |
| 4548 case kStackMapCid: | 4553 case kStackMapCid: |
| 4549 return new (Z) RODataSerializationCluster(kStackMapCid); | 4554 return new (Z) RODataSerializationCluster(kStackMapCid); |
| 4550 case kExceptionHandlersCid: | 4555 case kExceptionHandlersCid: |
| 4551 return new (Z) ExceptionHandlersSerializationCluster(); | 4556 return new (Z) ExceptionHandlersSerializationCluster(); |
| 4552 case kContextCid: | 4557 case kContextCid: |
| 4553 return new (Z) ContextSerializationCluster(); | 4558 return new (Z) ContextSerializationCluster(); |
| 4554 case kContextScopeCid: | 4559 case kContextScopeCid: |
| 4555 return new (Z) ContextScopeSerializationCluster(); | 4560 return new (Z) ContextScopeSerializationCluster(); |
| 4556 case kUnlinkedCallCid: | 4561 case kUnlinkedCallCid: |
| 4557 return new (Z) UnlinkedCallSerializationCluster(); | 4562 return new (Z) UnlinkedCallSerializationCluster(); |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4903 return new (Z) ScriptDeserializationCluster(); | 4908 return new (Z) ScriptDeserializationCluster(); |
| 4904 case kLibraryCid: | 4909 case kLibraryCid: |
| 4905 return new (Z) LibraryDeserializationCluster(); | 4910 return new (Z) LibraryDeserializationCluster(); |
| 4906 case kNamespaceCid: | 4911 case kNamespaceCid: |
| 4907 return new (Z) NamespaceDeserializationCluster(); | 4912 return new (Z) NamespaceDeserializationCluster(); |
| 4908 case kCodeCid: | 4913 case kCodeCid: |
| 4909 return new (Z) CodeDeserializationCluster(); | 4914 return new (Z) CodeDeserializationCluster(); |
| 4910 case kObjectPoolCid: | 4915 case kObjectPoolCid: |
| 4911 return new (Z) ObjectPoolDeserializationCluster(); | 4916 return new (Z) ObjectPoolDeserializationCluster(); |
| 4912 case kPcDescriptorsCid: | 4917 case kPcDescriptorsCid: |
| 4918 case kCodeSourceMapCid: |
| 4913 case kStackMapCid: | 4919 case kStackMapCid: |
| 4914 return new (Z) RODataDeserializationCluster(); | 4920 return new (Z) RODataDeserializationCluster(); |
| 4915 case kExceptionHandlersCid: | 4921 case kExceptionHandlersCid: |
| 4916 return new (Z) ExceptionHandlersDeserializationCluster(); | 4922 return new (Z) ExceptionHandlersDeserializationCluster(); |
| 4917 case kContextCid: | 4923 case kContextCid: |
| 4918 return new (Z) ContextDeserializationCluster(); | 4924 return new (Z) ContextDeserializationCluster(); |
| 4919 case kContextScopeCid: | 4925 case kContextScopeCid: |
| 4920 return new (Z) ContextScopeDeserializationCluster(); | 4926 return new (Z) ContextScopeDeserializationCluster(); |
| 4921 case kUnlinkedCallCid: | 4927 case kUnlinkedCallCid: |
| 4922 return new (Z) UnlinkedCallDeserializationCluster(); | 4928 return new (Z) UnlinkedCallDeserializationCluster(); |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5510 thread_->isolate()->SetupImagePage(data_buffer_, | 5516 thread_->isolate()->SetupImagePage(data_buffer_, |
| 5511 /* is_executable */ false); | 5517 /* is_executable */ false); |
| 5512 } | 5518 } |
| 5513 | 5519 |
| 5514 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); | 5520 deserializer.ReadIsolateSnapshot(thread_->isolate()->object_store()); |
| 5515 | 5521 |
| 5516 return ApiError::null(); | 5522 return ApiError::null(); |
| 5517 } | 5523 } |
| 5518 | 5524 |
| 5519 } // namespace dart | 5525 } // namespace dart |
| OLD | NEW |