Chromium Code Reviews| 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 15 matching lines...) Expand all Loading... | |
| 735 if (IsCreatedFromSnapshot()) { | 737 if (IsCreatedFromSnapshot()) { |
| 736 ASSERT(kind != Snapshot::kFull); | 738 ASSERT(kind != Snapshot::kFull); |
| 737 // Write out library URL so that it can be looked up when reading. | 739 // Write out library URL so that it can be looked up when reading. |
| 738 writer->WriteObject(ptr()->url_); | 740 writer->WriteObject(ptr()->url_); |
| 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_); |
|
siva
2012/01/27 22:50:53
Maybe also add a comment here too that we do not s
hausner
2012/01/27 23:01:04
Done.
| |
| 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); |
| 749 | 751 |
| 750 // Write out all the object pointer fields. | 752 // Write out all the object pointer fields. |
| 751 SnapshotWriterVisitor visitor(writer); | 753 SnapshotWriterVisitor visitor(writer); |
| 752 visitor.VisitPointers(from(), to()); | 754 visitor.VisitPointers(from(), to()); |
| 753 } | 755 } |
| 754 } | 756 } |
| 755 | 757 |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1822 // Write out all the other fields. | 1824 // Write out all the other fields. |
| 1823 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); | 1825 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); |
| 1824 writer->WriteObject(ptr()->pattern_); | 1826 writer->WriteObject(ptr()->pattern_); |
| 1825 writer->WriteIntptrValue(ptr()->type_); | 1827 writer->WriteIntptrValue(ptr()->type_); |
| 1826 writer->WriteIntptrValue(ptr()->flags_); | 1828 writer->WriteIntptrValue(ptr()->flags_); |
| 1827 | 1829 |
| 1828 // Do not write out the data part which is native. | 1830 // Do not write out the data part which is native. |
| 1829 } | 1831 } |
| 1830 | 1832 |
| 1831 } // namespace dart | 1833 } // namespace dart |
| OLD | NEW |