| 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/object.h" | 5 #include "vm/object.h" |
| 6 #include "vm/object_store.h" | 6 #include "vm/object_store.h" |
| 7 #include "vm/snapshot.h" | 7 #include "vm/snapshot.h" |
| 8 #include "vm/stub_code.h" | 8 #include "vm/stub_code.h" |
| 9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
| 10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 RawClass* Class::ReadFrom(SnapshotReader* reader, | 25 RawClass* Class::ReadFrom(SnapshotReader* reader, |
| 26 intptr_t object_id, | 26 intptr_t object_id, |
| 27 intptr_t tags, | 27 intptr_t tags, |
| 28 Snapshot::Kind kind) { | 28 Snapshot::Kind kind) { |
| 29 ASSERT(reader != NULL); | 29 ASSERT(reader != NULL); |
| 30 | 30 |
| 31 Class& cls = Class::ZoneHandle(reader->zone(), Class::null()); | 31 Class& cls = Class::ZoneHandle(reader->zone(), Class::null()); |
| 32 if ((kind == Snapshot::kFull) || | 32 if ((kind == Snapshot::kFull) || |
| 33 (kind == Snapshot::kScript && !RawObject::IsCreatedFromSnapshot(tags))) { | 33 (kind == Snapshot::kScript && !RawObject::IsCreatedFromSnapshot(tags))) { |
| 34 // Read in the base information. | 34 // Read in the base information. |
| 35 int32_t class_id = reader->Read<int32_t>(); | 35 classid_t class_id = reader->Read<classid_t>(); |
| 36 | 36 |
| 37 // Allocate class object of specified kind. | 37 // Allocate class object of specified kind. |
| 38 if (kind == Snapshot::kFull) { | 38 if (kind == Snapshot::kFull) { |
| 39 cls = reader->NewClass(class_id); | 39 cls = reader->NewClass(class_id); |
| 40 } else { | 40 } else { |
| 41 if (class_id < kNumPredefinedCids) { | 41 if (class_id < kNumPredefinedCids) { |
| 42 ASSERT((class_id >= kInstanceCid) && (class_id <= kMirrorReferenceCid)); | 42 ASSERT((class_id >= kInstanceCid) && (class_id <= kMirrorReferenceCid)); |
| 43 cls = reader->isolate()->class_table()->At(class_id); | 43 cls = reader->isolate()->class_table()->At(class_id); |
| 44 } else { | 44 } else { |
| 45 cls = New<Instance>(kIllegalCid); | 45 cls = New<Instance>(kIllegalCid); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 if ((kind == Snapshot::kFull) || | 90 if ((kind == Snapshot::kFull) || |
| 91 (kind == Snapshot::kScript && | 91 (kind == Snapshot::kScript && |
| 92 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { | 92 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)))) { |
| 93 // Write out the class and tags information. | 93 // Write out the class and tags information. |
| 94 writer->WriteVMIsolateObject(kClassCid); | 94 writer->WriteVMIsolateObject(kClassCid); |
| 95 writer->WriteTags(writer->GetObjectTags(this)); | 95 writer->WriteTags(writer->GetObjectTags(this)); |
| 96 | 96 |
| 97 // Write out all the non object pointer fields. | 97 // Write out all the non object pointer fields. |
| 98 // NOTE: cpp_vtable_ is not written. | 98 // NOTE: cpp_vtable_ is not written. |
| 99 int32_t class_id = ptr()->id_; | 99 classid_t class_id = ptr()->id_; |
| 100 writer->Write<int32_t>(class_id); | 100 writer->Write<classid_t>(class_id); |
| 101 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { | 101 if (!RawObject::IsInternalVMdefinedClassId(class_id)) { |
| 102 // We don't write the instance size of VM defined classes as they | 102 // We don't write the instance size of VM defined classes as they |
| 103 // are already setup during initialization as part of pre populating | 103 // are already setup during initialization as part of pre populating |
| 104 // the class table. | 104 // the class table. |
| 105 writer->Write<int32_t>(ptr()->instance_size_in_words_); | 105 writer->Write<int32_t>(ptr()->instance_size_in_words_); |
| 106 writer->Write<int32_t>(ptr()->next_field_offset_in_words_); | 106 writer->Write<int32_t>(ptr()->next_field_offset_in_words_); |
| 107 } | 107 } |
| 108 writer->Write<int32_t>(ptr()->type_arguments_field_offset_in_words_); | 108 writer->Write<int32_t>(ptr()->type_arguments_field_offset_in_words_); |
| 109 writer->Write<int16_t>(ptr()->num_type_arguments_); | 109 writer->Write<uint16_t>(ptr()->num_type_arguments_); |
| 110 writer->Write<int16_t>(ptr()->num_own_type_arguments_); | 110 writer->Write<uint16_t>(ptr()->num_own_type_arguments_); |
| 111 writer->Write<uint16_t>(ptr()->num_native_fields_); | 111 writer->Write<uint16_t>(ptr()->num_native_fields_); |
| 112 writer->Write<int32_t>(ptr()->token_pos_); | 112 writer->Write<int32_t>(ptr()->token_pos_); |
| 113 writer->Write<uint16_t>(ptr()->state_bits_); | 113 writer->Write<uint16_t>(ptr()->state_bits_); |
| 114 | 114 |
| 115 // Write out all the object pointer fields. | 115 // Write out all the object pointer fields. |
| 116 SnapshotWriterVisitor visitor(writer); | 116 SnapshotWriterVisitor visitor(writer); |
| 117 visitor.VisitPointers(from(), to()); | 117 visitor.VisitPointers(from(), to()); |
| 118 } else { | 118 } else { |
| 119 if (writer->can_send_any_object() || | 119 if (writer->can_send_any_object() || |
| 120 writer->AllowObjectsInDartLibrary(ptr()->library_)) { | 120 writer->AllowObjectsInDartLibrary(ptr()->library_)) { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 | 325 |
| 326 // Allocate type parameter object. | 326 // Allocate type parameter object. |
| 327 TypeParameter& type_parameter = TypeParameter::ZoneHandle( | 327 TypeParameter& type_parameter = TypeParameter::ZoneHandle( |
| 328 reader->zone(), NEW_OBJECT(TypeParameter)); | 328 reader->zone(), NEW_OBJECT(TypeParameter)); |
| 329 reader->AddBackRef(object_id, &type_parameter, kIsDeserialized); | 329 reader->AddBackRef(object_id, &type_parameter, kIsDeserialized); |
| 330 | 330 |
| 331 // Set the object tags. | 331 // Set the object tags. |
| 332 type_parameter.set_tags(tags); | 332 type_parameter.set_tags(tags); |
| 333 | 333 |
| 334 // Set all non object fields. | 334 // Set all non object fields. |
| 335 type_parameter.set_index(reader->Read<int32_t>()); | |
| 336 type_parameter.set_token_pos(reader->Read<int32_t>()); | 335 type_parameter.set_token_pos(reader->Read<int32_t>()); |
| 336 type_parameter.set_index(reader->Read<int16_t>()); |
| 337 type_parameter.set_type_state(reader->Read<int8_t>()); | 337 type_parameter.set_type_state(reader->Read<int8_t>()); |
| 338 | 338 |
| 339 // Set all the object fields. | 339 // Set all the object fields. |
| 340 // TODO(5411462): Need to assert No GC can happen here, even though | 340 // TODO(5411462): Need to assert No GC can happen here, even though |
| 341 // allocations may happen. | 341 // allocations may happen. |
| 342 intptr_t num_flds = (type_parameter.raw()->to() - | 342 intptr_t num_flds = (type_parameter.raw()->to() - |
| 343 type_parameter.raw()->from()); | 343 type_parameter.raw()->from()); |
| 344 for (intptr_t i = 0; i <= num_flds; i++) { | 344 for (intptr_t i = 0; i <= num_flds; i++) { |
| 345 (*reader->PassiveObjectHandle()) = reader->ReadObjectRef(); | 345 (*reader->PassiveObjectHandle()) = reader->ReadObjectRef(); |
| 346 type_parameter.StorePointer((type_parameter.raw()->from() + i), | 346 type_parameter.StorePointer((type_parameter.raw()->from() + i), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 360 ASSERT(ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated); | 360 ASSERT(ptr()->type_state_ == RawTypeParameter::kFinalizedUninstantiated); |
| 361 | 361 |
| 362 // Write out the serialization header value for this object. | 362 // Write out the serialization header value for this object. |
| 363 writer->WriteInlinedObjectHeader(object_id); | 363 writer->WriteInlinedObjectHeader(object_id); |
| 364 | 364 |
| 365 // Write out the class and tags information. | 365 // Write out the class and tags information. |
| 366 writer->WriteIndexedObject(kTypeParameterCid); | 366 writer->WriteIndexedObject(kTypeParameterCid); |
| 367 writer->WriteTags(writer->GetObjectTags(this)); | 367 writer->WriteTags(writer->GetObjectTags(this)); |
| 368 | 368 |
| 369 // Write out all the non object pointer fields. | 369 // Write out all the non object pointer fields. |
| 370 writer->Write<int32_t>(ptr()->index_); | |
| 371 writer->Write<int32_t>(ptr()->token_pos_); | 370 writer->Write<int32_t>(ptr()->token_pos_); |
| 371 writer->Write<int16_t>(ptr()->index_); |
| 372 writer->Write<int8_t>(ptr()->type_state_); | 372 writer->Write<int8_t>(ptr()->type_state_); |
| 373 | 373 |
| 374 // Write out all the object pointer fields. | 374 // Write out all the object pointer fields. |
| 375 SnapshotWriterVisitor visitor(writer); | 375 SnapshotWriterVisitor visitor(writer); |
| 376 visitor.VisitPointers(from(), to()); | 376 visitor.VisitPointers(from(), to()); |
| 377 } | 377 } |
| 378 | 378 |
| 379 | 379 |
| 380 RawBoundedType* BoundedType::ReadFrom(SnapshotReader* reader, | 380 RawBoundedType* BoundedType::ReadFrom(SnapshotReader* reader, |
| 381 intptr_t object_id, | 381 intptr_t object_id, |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 // Set the object tags. | 699 // Set the object tags. |
| 700 func.set_tags(tags); | 700 func.set_tags(tags); |
| 701 | 701 |
| 702 // Set all the non object fields. | 702 // Set all the non object fields. |
| 703 func.set_token_pos(reader->Read<int32_t>()); | 703 func.set_token_pos(reader->Read<int32_t>()); |
| 704 func.set_end_token_pos(reader->Read<int32_t>()); | 704 func.set_end_token_pos(reader->Read<int32_t>()); |
| 705 func.set_usage_counter(reader->Read<int32_t>()); | 705 func.set_usage_counter(reader->Read<int32_t>()); |
| 706 func.set_num_fixed_parameters(reader->Read<int16_t>()); | 706 func.set_num_fixed_parameters(reader->Read<int16_t>()); |
| 707 func.set_num_optional_parameters(reader->Read<int16_t>()); | 707 func.set_num_optional_parameters(reader->Read<int16_t>()); |
| 708 func.set_deoptimization_counter(reader->Read<int16_t>()); | 708 func.set_deoptimization_counter(reader->Read<int16_t>()); |
| 709 func.set_regexp_cid(reader->Read<int16_t>()); | 709 func.set_regexp_cid(reader->Read<classid_t>()); |
| 710 func.set_kind_tag(reader->Read<uint32_t>()); | 710 func.set_kind_tag(reader->Read<uint32_t>()); |
| 711 func.set_optimized_instruction_count(reader->Read<uint16_t>()); | 711 func.set_optimized_instruction_count(reader->Read<uint16_t>()); |
| 712 func.set_optimized_call_site_count(reader->Read<uint16_t>()); | 712 func.set_optimized_call_site_count(reader->Read<uint16_t>()); |
| 713 | 713 |
| 714 // Set all the object fields. | 714 // Set all the object fields. |
| 715 // TODO(5411462): Need to assert No GC can happen here, even though | 715 // TODO(5411462): Need to assert No GC can happen here, even though |
| 716 // allocations may happen. | 716 // allocations may happen. |
| 717 intptr_t num_flds = (func.raw()->to_snapshot() - func.raw()->from()); | 717 intptr_t num_flds = (func.raw()->to_snapshot() - func.raw()->from()); |
| 718 for (intptr_t i = 0; i <= num_flds; i++) { | 718 for (intptr_t i = 0; i <= num_flds; i++) { |
| 719 (*reader->PassiveObjectHandle()) = reader->ReadObjectRef(); | 719 (*reader->PassiveObjectHandle()) = reader->ReadObjectRef(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 743 writer->WriteVMIsolateObject(kFunctionCid); | 743 writer->WriteVMIsolateObject(kFunctionCid); |
| 744 writer->WriteTags(writer->GetObjectTags(this)); | 744 writer->WriteTags(writer->GetObjectTags(this)); |
| 745 | 745 |
| 746 // Write out all the non object fields. | 746 // Write out all the non object fields. |
| 747 writer->Write<int32_t>(ptr()->token_pos_); | 747 writer->Write<int32_t>(ptr()->token_pos_); |
| 748 writer->Write<int32_t>(ptr()->end_token_pos_); | 748 writer->Write<int32_t>(ptr()->end_token_pos_); |
| 749 writer->Write<int32_t>(ptr()->usage_counter_); | 749 writer->Write<int32_t>(ptr()->usage_counter_); |
| 750 writer->Write<int16_t>(ptr()->num_fixed_parameters_); | 750 writer->Write<int16_t>(ptr()->num_fixed_parameters_); |
| 751 writer->Write<int16_t>(ptr()->num_optional_parameters_); | 751 writer->Write<int16_t>(ptr()->num_optional_parameters_); |
| 752 writer->Write<int16_t>(ptr()->deoptimization_counter_); | 752 writer->Write<int16_t>(ptr()->deoptimization_counter_); |
| 753 writer->Write<int16_t>(ptr()->regexp_cid_); | 753 writer->Write<classid_t>(ptr()->regexp_cid_); |
| 754 writer->Write<uint32_t>(ptr()->kind_tag_); | 754 writer->Write<uint32_t>(ptr()->kind_tag_); |
| 755 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); | 755 writer->Write<uint16_t>(ptr()->optimized_instruction_count_); |
| 756 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); | 756 writer->Write<uint16_t>(ptr()->optimized_call_site_count_); |
| 757 | 757 |
| 758 // Write out all the object pointer fields. | 758 // Write out all the object pointer fields. |
| 759 SnapshotWriterVisitor visitor(writer); | 759 SnapshotWriterVisitor visitor(writer); |
| 760 visitor.VisitPointers(from(), to_snapshot()); | 760 visitor.VisitPointers(from(), to_snapshot()); |
| 761 } | 761 } |
| 762 | 762 |
| 763 | 763 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 library = Library::LookupLibrary(*reader->StringHandle()); | 1032 library = Library::LookupLibrary(*reader->StringHandle()); |
| 1033 } else { | 1033 } else { |
| 1034 // Allocate library object. | 1034 // Allocate library object. |
| 1035 library = NEW_OBJECT(Library); | 1035 library = NEW_OBJECT(Library); |
| 1036 | 1036 |
| 1037 // Set the object tags. | 1037 // Set the object tags. |
| 1038 library.set_tags(tags); | 1038 library.set_tags(tags); |
| 1039 | 1039 |
| 1040 // Set all non object fields. | 1040 // Set all non object fields. |
| 1041 library.StoreNonPointer(&library.raw_ptr()->index_, | 1041 library.StoreNonPointer(&library.raw_ptr()->index_, |
| 1042 reader->Read<int32_t>()); | 1042 reader->Read<classid_t>()); |
| 1043 library.StoreNonPointer(&library.raw_ptr()->num_anonymous_, |
| 1044 reader->Read<classid_t>()); |
| 1043 library.StoreNonPointer(&library.raw_ptr()->num_imports_, | 1045 library.StoreNonPointer(&library.raw_ptr()->num_imports_, |
| 1044 reader->Read<int32_t>()); | 1046 reader->Read<uint16_t>()); |
| 1045 library.StoreNonPointer(&library.raw_ptr()->num_anonymous_, | 1047 library.StoreNonPointer(&library.raw_ptr()->load_state_, |
| 1046 reader->Read<int32_t>()); | 1048 reader->Read<int8_t>()); |
| 1047 library.StoreNonPointer(&library.raw_ptr()->corelib_imported_, | 1049 library.StoreNonPointer(&library.raw_ptr()->corelib_imported_, |
| 1048 reader->Read<bool>()); | 1050 reader->Read<bool>()); |
| 1049 library.StoreNonPointer(&library.raw_ptr()->is_dart_scheme_, | 1051 library.StoreNonPointer(&library.raw_ptr()->is_dart_scheme_, |
| 1050 reader->Read<bool>()); | 1052 reader->Read<bool>()); |
| 1051 library.StoreNonPointer(&library.raw_ptr()->debuggable_, | 1053 library.StoreNonPointer(&library.raw_ptr()->debuggable_, |
| 1052 reader->Read<bool>()); | 1054 reader->Read<bool>()); |
| 1053 library.StoreNonPointer(&library.raw_ptr()->load_state_, | |
| 1054 reader->Read<int8_t>()); | |
| 1055 // The native resolver is not serialized. | 1055 // The native resolver is not serialized. |
| 1056 Dart_NativeEntryResolver resolver = | 1056 Dart_NativeEntryResolver resolver = |
| 1057 reader->Read<Dart_NativeEntryResolver>(); | 1057 reader->Read<Dart_NativeEntryResolver>(); |
| 1058 ASSERT(resolver == NULL); | 1058 ASSERT(resolver == NULL); |
| 1059 library.set_native_entry_resolver(resolver); | 1059 library.set_native_entry_resolver(resolver); |
| 1060 // The symbol resolver is not serialized. | 1060 // The symbol resolver is not serialized. |
| 1061 Dart_NativeEntrySymbol symbol_resolver = | 1061 Dart_NativeEntrySymbol symbol_resolver = |
| 1062 reader->Read<Dart_NativeEntrySymbol>(); | 1062 reader->Read<Dart_NativeEntrySymbol>(); |
| 1063 ASSERT(symbol_resolver == NULL); | 1063 ASSERT(symbol_resolver == NULL); |
| 1064 library.set_native_entry_symbol_resolver(symbol_resolver); | 1064 library.set_native_entry_symbol_resolver(symbol_resolver); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1095 writer->WriteVMIsolateObject(kLibraryCid); | 1095 writer->WriteVMIsolateObject(kLibraryCid); |
| 1096 writer->WriteTags(writer->GetObjectTags(this)); | 1096 writer->WriteTags(writer->GetObjectTags(this)); |
| 1097 | 1097 |
| 1098 if ((kind == Snapshot::kScript) && | 1098 if ((kind == Snapshot::kScript) && |
| 1099 RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) { | 1099 RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))) { |
| 1100 ASSERT(kind != Snapshot::kFull); | 1100 ASSERT(kind != Snapshot::kFull); |
| 1101 // Write out library URL so that it can be looked up when reading. | 1101 // Write out library URL so that it can be looked up when reading. |
| 1102 writer->WriteObjectImpl(ptr()->url_); | 1102 writer->WriteObjectImpl(ptr()->url_); |
| 1103 } else { | 1103 } else { |
| 1104 // Write out all non object fields. | 1104 // Write out all non object fields. |
| 1105 writer->Write<int32_t>(ptr()->index_); | 1105 writer->Write<classid_t>(ptr()->index_); |
| 1106 writer->Write<int32_t>(ptr()->num_imports_); | 1106 writer->Write<classid_t>(ptr()->num_anonymous_); |
| 1107 writer->Write<int32_t>(ptr()->num_anonymous_); | 1107 writer->Write<uint16_t>(ptr()->num_imports_); |
| 1108 writer->Write<int8_t>(ptr()->load_state_); |
| 1108 writer->Write<bool>(ptr()->corelib_imported_); | 1109 writer->Write<bool>(ptr()->corelib_imported_); |
| 1109 writer->Write<bool>(ptr()->is_dart_scheme_); | 1110 writer->Write<bool>(ptr()->is_dart_scheme_); |
| 1110 writer->Write<bool>(ptr()->debuggable_); | 1111 writer->Write<bool>(ptr()->debuggable_); |
| 1111 writer->Write<int8_t>(ptr()->load_state_); | |
| 1112 // We do not serialize the native resolver over, this needs to be explicitly | 1112 // We do not serialize the native resolver over, this needs to be explicitly |
| 1113 // set after deserialization. | 1113 // set after deserialization. |
| 1114 writer->Write<Dart_NativeEntryResolver>(NULL); | 1114 writer->Write<Dart_NativeEntryResolver>(NULL); |
| 1115 // We do not serialize the native entry symbol, this needs to be explicitly | 1115 // We do not serialize the native entry symbol, this needs to be explicitly |
| 1116 // set after deserialization. | 1116 // set after deserialization. |
| 1117 writer->Write<Dart_NativeEntrySymbol>(NULL); | 1117 writer->Write<Dart_NativeEntrySymbol>(NULL); |
| 1118 // We do not write the loaded_scripts_ cache to the snapshot. It gets | 1118 // We do not write the loaded_scripts_ cache to the snapshot. It gets |
| 1119 // set to NULL when reading the library from the snapshot, and will | 1119 // set to NULL when reading the library from the snapshot, and will |
| 1120 // be rebuilt lazily. | 1120 // be rebuilt lazily. |
| 1121 | 1121 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1138 // Allocate library prefix object. | 1138 // Allocate library prefix object. |
| 1139 LibraryPrefix& prefix = LibraryPrefix::ZoneHandle( | 1139 LibraryPrefix& prefix = LibraryPrefix::ZoneHandle( |
| 1140 reader->zone(), NEW_OBJECT(LibraryPrefix)); | 1140 reader->zone(), NEW_OBJECT(LibraryPrefix)); |
| 1141 reader->AddBackRef(object_id, &prefix, kIsDeserialized); | 1141 reader->AddBackRef(object_id, &prefix, kIsDeserialized); |
| 1142 | 1142 |
| 1143 // Set the object tags. | 1143 // Set the object tags. |
| 1144 prefix.set_tags(tags); | 1144 prefix.set_tags(tags); |
| 1145 | 1145 |
| 1146 // Set all non object fields. | 1146 // Set all non object fields. |
| 1147 prefix.StoreNonPointer(&prefix.raw_ptr()->num_imports_, | 1147 prefix.StoreNonPointer(&prefix.raw_ptr()->num_imports_, |
| 1148 reader->Read<int32_t>()); | 1148 reader->Read<int16_t>()); |
| 1149 prefix.StoreNonPointer(&prefix.raw_ptr()->is_deferred_load_, | 1149 prefix.StoreNonPointer(&prefix.raw_ptr()->is_deferred_load_, |
| 1150 reader->Read<bool>()); | 1150 reader->Read<bool>()); |
| 1151 prefix.StoreNonPointer(&prefix.raw_ptr()->is_loaded_, reader->Read<bool>()); | 1151 prefix.StoreNonPointer(&prefix.raw_ptr()->is_loaded_, reader->Read<bool>()); |
| 1152 | 1152 |
| 1153 // Set all the object fields. | 1153 // Set all the object fields. |
| 1154 // TODO(5411462): Need to assert No GC can happen here, even though | 1154 // TODO(5411462): Need to assert No GC can happen here, even though |
| 1155 // allocations may happen. | 1155 // allocations may happen. |
| 1156 intptr_t num_flds = (prefix.raw()->to() - prefix.raw()->from()); | 1156 intptr_t num_flds = (prefix.raw()->to() - prefix.raw()->from()); |
| 1157 for (intptr_t i = 0; i <= num_flds; i++) { | 1157 for (intptr_t i = 0; i <= num_flds; i++) { |
| 1158 (*reader->PassiveObjectHandle()) = reader->ReadObjectRef(); | 1158 (*reader->PassiveObjectHandle()) = reader->ReadObjectRef(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1173 (kind == Snapshot::kFull)); | 1173 (kind == Snapshot::kFull)); |
| 1174 | 1174 |
| 1175 // Write out the serialization header value for this object. | 1175 // Write out the serialization header value for this object. |
| 1176 writer->WriteInlinedObjectHeader(object_id); | 1176 writer->WriteInlinedObjectHeader(object_id); |
| 1177 | 1177 |
| 1178 // Write out the class and tags information. | 1178 // Write out the class and tags information. |
| 1179 writer->WriteIndexedObject(kLibraryPrefixCid); | 1179 writer->WriteIndexedObject(kLibraryPrefixCid); |
| 1180 writer->WriteTags(writer->GetObjectTags(this)); | 1180 writer->WriteTags(writer->GetObjectTags(this)); |
| 1181 | 1181 |
| 1182 // Write out all non object fields. | 1182 // Write out all non object fields. |
| 1183 writer->Write<int32_t>(ptr()->num_imports_); | 1183 writer->Write<int16_t>(ptr()->num_imports_); |
| 1184 writer->Write<bool>(ptr()->is_deferred_load_); | 1184 writer->Write<bool>(ptr()->is_deferred_load_); |
| 1185 writer->Write<bool>(ptr()->is_loaded_); | 1185 writer->Write<bool>(ptr()->is_loaded_); |
| 1186 | 1186 |
| 1187 // Write out all the object pointer fields. | 1187 // Write out all the object pointer fields. |
| 1188 SnapshotWriterVisitor visitor(writer); | 1188 SnapshotWriterVisitor visitor(writer); |
| 1189 visitor.VisitPointers(from(), to()); | 1189 visitor.VisitPointers(from(), to()); |
| 1190 } | 1190 } |
| 1191 | 1191 |
| 1192 | 1192 |
| 1193 RawNamespace* Namespace::ReadFrom(SnapshotReader* reader, | 1193 RawNamespace* Namespace::ReadFrom(SnapshotReader* reader, |
| (...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2947 // We do not allow objects with native fields in an isolate message. | 2947 // We do not allow objects with native fields in an isolate message. |
| 2948 writer->SetWriteException(Exceptions::kArgument, | 2948 writer->SetWriteException(Exceptions::kArgument, |
| 2949 "Illegal argument in isolate message" | 2949 "Illegal argument in isolate message" |
| 2950 " : (object is a UserTag)"); | 2950 " : (object is a UserTag)"); |
| 2951 } else { | 2951 } else { |
| 2952 UNREACHABLE(); | 2952 UNREACHABLE(); |
| 2953 } | 2953 } |
| 2954 } | 2954 } |
| 2955 | 2955 |
| 2956 } // namespace dart | 2956 } // namespace dart |
| OLD | NEW |