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