| 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/bigint_operations.h" | 5 #include "vm/bigint_operations.h" |
| 6 #include "vm/object.h" | 6 #include "vm/object.h" |
| 7 #include "vm/object_store.h" | 7 #include "vm/object_store.h" |
| 8 #include "vm/snapshot.h" | 8 #include "vm/snapshot.h" |
| 9 #include "vm/visitor.h" | 9 #include "vm/visitor.h" |
| 10 | 10 |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 library.raw_ptr()->num_imports_ = reader->ReadIntptrValue(); | 700 library.raw_ptr()->num_imports_ = reader->ReadIntptrValue(); |
| 701 library.raw_ptr()->num_imported_into_ = reader->ReadIntptrValue(); | 701 library.raw_ptr()->num_imported_into_ = reader->ReadIntptrValue(); |
| 702 library.raw_ptr()->num_anonymous_ = reader->ReadIntptrValue(); | 702 library.raw_ptr()->num_anonymous_ = reader->ReadIntptrValue(); |
| 703 library.raw_ptr()->corelib_imported_ = reader->Read<bool>(); | 703 library.raw_ptr()->corelib_imported_ = reader->Read<bool>(); |
| 704 library.raw_ptr()->load_state_ = reader->Read<int8_t>(); | 704 library.raw_ptr()->load_state_ = reader->Read<int8_t>(); |
| 705 // The native resolver is not serialized. | 705 // The native resolver is not serialized. |
| 706 Dart_NativeEntryResolver resolver = | 706 Dart_NativeEntryResolver resolver = |
| 707 reader->Read<Dart_NativeEntryResolver>(); | 707 reader->Read<Dart_NativeEntryResolver>(); |
| 708 ASSERT(resolver == NULL); | 708 ASSERT(resolver == NULL); |
| 709 library.set_native_entry_resolver(resolver); | 709 library.set_native_entry_resolver(resolver); |
| 710 // The cache of loaded scripts is not serialized. |
| 711 library.raw_ptr()->loaded_scripts_ = Array::null(); |
| 710 | 712 |
| 711 // Set all the object fields. | 713 // Set all the object fields. |
| 712 // TODO(5411462): Need to assert No GC can happen here, even though | 714 // TODO(5411462): Need to assert No GC can happen here, even though |
| 713 // allocations may happen. | 715 // allocations may happen. |
| 714 intptr_t num_flds = (library.raw()->to() - library.raw()->from()); | 716 intptr_t num_flds = (library.raw()->to() - library.raw()->from()); |
| 715 for (intptr_t i = 0; i <= num_flds; i++) { | 717 for (intptr_t i = 0; i <= num_flds; i++) { |
| 716 *(library.raw()->from() + i) = reader->ReadObject(); | 718 *(library.raw()->from() + i) = reader->ReadObject(); |
| 717 } | 719 } |
| 718 } | 720 } |
| 719 return library.raw(); | 721 return library.raw(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 739 } else { | 741 } else { |
| 740 // Write out all non object fields. | 742 // Write out all non object fields. |
| 741 writer->WriteIntptrValue(ptr()->num_imports_); | 743 writer->WriteIntptrValue(ptr()->num_imports_); |
| 742 writer->WriteIntptrValue(ptr()->num_imported_into_); | 744 writer->WriteIntptrValue(ptr()->num_imported_into_); |
| 743 writer->WriteIntptrValue(ptr()->num_anonymous_); | 745 writer->WriteIntptrValue(ptr()->num_anonymous_); |
| 744 writer->Write<bool>(ptr()->corelib_imported_); | 746 writer->Write<bool>(ptr()->corelib_imported_); |
| 745 writer->Write<int8_t>(ptr()->load_state_); | 747 writer->Write<int8_t>(ptr()->load_state_); |
| 746 // We do not serialize the native resolver over, this needs to be explicitly | 748 // We do not serialize the native resolver over, this needs to be explicitly |
| 747 // set after deserialization. | 749 // set after deserialization. |
| 748 writer->Write<Dart_NativeEntryResolver>(NULL); | 750 writer->Write<Dart_NativeEntryResolver>(NULL); |
| 751 // We do not write the loaded_scripts_ cache to the snapshot. It gets |
| 752 // set to NULL when reading the library from the snapshot, and will |
| 753 // be rebuilt lazily. |
| 749 | 754 |
| 750 // Write out all the object pointer fields. | 755 // Write out all the object pointer fields. |
| 751 SnapshotWriterVisitor visitor(writer); | 756 SnapshotWriterVisitor visitor(writer); |
| 752 visitor.VisitPointers(from(), to()); | 757 visitor.VisitPointers(from(), to()); |
| 753 } | 758 } |
| 754 } | 759 } |
| 755 | 760 |
| 756 | 761 |
| 757 RawLibraryPrefix* LibraryPrefix::ReadFrom(SnapshotReader* reader, | 762 RawLibraryPrefix* LibraryPrefix::ReadFrom(SnapshotReader* reader, |
| 758 intptr_t object_id, | 763 intptr_t object_id, |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1822 // Write out all the other fields. | 1827 // Write out all the other fields. |
| 1823 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 1828 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
| 1824 writer->WriteObject(ptr()->pattern_); | 1829 writer->WriteObject(ptr()->pattern_); |
| 1825 writer->WriteIntptrValue(ptr()->type_); | 1830 writer->WriteIntptrValue(ptr()->type_); |
| 1826 writer->WriteIntptrValue(ptr()->flags_); | 1831 writer->WriteIntptrValue(ptr()->flags_); |
| 1827 | 1832 |
| 1828 // Do not write out the data part which is native. | 1833 // Do not write out the data part which is native. |
| 1829 } | 1834 } |
| 1830 | 1835 |
| 1831 } // namespace dart | 1836 } // namespace dart |
| OLD | NEW |