| 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/stub_code.h" | 9 #include "vm/stub_code.h" |
| 10 #include "vm/symbols.h" | 10 #include "vm/symbols.h" |
| (...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 library.raw_ptr()->num_anonymous_ = reader->ReadIntptrValue(); | 1019 library.raw_ptr()->num_anonymous_ = reader->ReadIntptrValue(); |
| 1020 library.raw_ptr()->corelib_imported_ = reader->Read<bool>(); | 1020 library.raw_ptr()->corelib_imported_ = reader->Read<bool>(); |
| 1021 library.raw_ptr()->is_dart_scheme_ = reader->Read<bool>(); | 1021 library.raw_ptr()->is_dart_scheme_ = reader->Read<bool>(); |
| 1022 library.raw_ptr()->debuggable_ = reader->Read<bool>(); | 1022 library.raw_ptr()->debuggable_ = reader->Read<bool>(); |
| 1023 library.raw_ptr()->load_state_ = reader->Read<int8_t>(); | 1023 library.raw_ptr()->load_state_ = reader->Read<int8_t>(); |
| 1024 // The native resolver is not serialized. | 1024 // The native resolver is not serialized. |
| 1025 Dart_NativeEntryResolver resolver = | 1025 Dart_NativeEntryResolver resolver = |
| 1026 reader->Read<Dart_NativeEntryResolver>(); | 1026 reader->Read<Dart_NativeEntryResolver>(); |
| 1027 ASSERT(resolver == NULL); | 1027 ASSERT(resolver == NULL); |
| 1028 library.set_native_entry_resolver(resolver); | 1028 library.set_native_entry_resolver(resolver); |
| 1029 // The symbol resolver is not serialized. |
| 1030 Dart_NativeEntrySymbol symbol_resolver = |
| 1031 reader->Read<Dart_NativeEntrySymbol>(); |
| 1032 ASSERT(symbol_resolver == NULL); |
| 1033 library.set_native_entry_symbol_resolver(symbol_resolver); |
| 1029 // The cache of loaded scripts is not serialized. | 1034 // The cache of loaded scripts is not serialized. |
| 1030 library.raw_ptr()->loaded_scripts_ = Array::null(); | 1035 library.raw_ptr()->loaded_scripts_ = Array::null(); |
| 1031 | 1036 |
| 1032 // Set all the object fields. | 1037 // Set all the object fields. |
| 1033 // TODO(5411462): Need to assert No GC can happen here, even though | 1038 // TODO(5411462): Need to assert No GC can happen here, even though |
| 1034 // allocations may happen. | 1039 // allocations may happen. |
| 1035 intptr_t num_flds = (library.raw()->to() - library.raw()->from()); | 1040 intptr_t num_flds = (library.raw()->to() - library.raw()->from()); |
| 1036 for (intptr_t i = 0; i <= num_flds; i++) { | 1041 for (intptr_t i = 0; i <= num_flds; i++) { |
| 1037 *(library.raw()->from() + i) = reader->ReadObjectRef(); | 1042 *(library.raw()->from() + i) = reader->ReadObjectRef(); |
| 1038 } | 1043 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1067 writer->WriteIntptrValue(ptr()->index_); | 1072 writer->WriteIntptrValue(ptr()->index_); |
| 1068 writer->WriteIntptrValue(ptr()->num_imports_); | 1073 writer->WriteIntptrValue(ptr()->num_imports_); |
| 1069 writer->WriteIntptrValue(ptr()->num_anonymous_); | 1074 writer->WriteIntptrValue(ptr()->num_anonymous_); |
| 1070 writer->Write<bool>(ptr()->corelib_imported_); | 1075 writer->Write<bool>(ptr()->corelib_imported_); |
| 1071 writer->Write<bool>(ptr()->is_dart_scheme_); | 1076 writer->Write<bool>(ptr()->is_dart_scheme_); |
| 1072 writer->Write<bool>(ptr()->debuggable_); | 1077 writer->Write<bool>(ptr()->debuggable_); |
| 1073 writer->Write<int8_t>(ptr()->load_state_); | 1078 writer->Write<int8_t>(ptr()->load_state_); |
| 1074 // We do not serialize the native resolver over, this needs to be explicitly | 1079 // We do not serialize the native resolver over, this needs to be explicitly |
| 1075 // set after deserialization. | 1080 // set after deserialization. |
| 1076 writer->Write<Dart_NativeEntryResolver>(NULL); | 1081 writer->Write<Dart_NativeEntryResolver>(NULL); |
| 1082 // We do not serialize the native entry symbol, this needs to be explicitly |
| 1083 // set after deserialization. |
| 1084 writer->Write<Dart_NativeEntrySymbol>(NULL); |
| 1077 // We do not write the loaded_scripts_ cache to the snapshot. It gets | 1085 // We do not write the loaded_scripts_ cache to the snapshot. It gets |
| 1078 // set to NULL when reading the library from the snapshot, and will | 1086 // set to NULL when reading the library from the snapshot, and will |
| 1079 // be rebuilt lazily. | 1087 // be rebuilt lazily. |
| 1080 | 1088 |
| 1081 // Write out all the object pointer fields. | 1089 // Write out all the object pointer fields. |
| 1082 SnapshotWriterVisitor visitor(writer); | 1090 SnapshotWriterVisitor visitor(writer); |
| 1083 visitor.VisitPointers(from(), to()); | 1091 visitor.VisitPointers(from(), to()); |
| 1084 } | 1092 } |
| 1085 } | 1093 } |
| 1086 | 1094 |
| (...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2773 // We do not allow objects with native fields in an isolate message. | 2781 // We do not allow objects with native fields in an isolate message. |
| 2774 writer->SetWriteException(Exceptions::kArgument, | 2782 writer->SetWriteException(Exceptions::kArgument, |
| 2775 "Illegal argument in isolate message" | 2783 "Illegal argument in isolate message" |
| 2776 " : (object is a UserTag)"); | 2784 " : (object is a UserTag)"); |
| 2777 } else { | 2785 } else { |
| 2778 UNREACHABLE(); | 2786 UNREACHABLE(); |
| 2779 } | 2787 } |
| 2780 } | 2788 } |
| 2781 | 2789 |
| 2782 } // namespace dart | 2790 } // namespace dart |
| OLD | NEW |