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/native_entry.h" | 5 #include "vm/native_entry.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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 cls.set_type_arguments_field_offset_in_words(reader->Read<int32_t>()); | 75 cls.set_type_arguments_field_offset_in_words(reader->Read<int32_t>()); |
76 cls.set_num_type_arguments(reader->Read<int16_t>()); | 76 cls.set_num_type_arguments(reader->Read<int16_t>()); |
77 cls.set_num_own_type_arguments(reader->Read<int16_t>()); | 77 cls.set_num_own_type_arguments(reader->Read<int16_t>()); |
78 cls.set_num_native_fields(reader->Read<uint16_t>()); | 78 cls.set_num_native_fields(reader->Read<uint16_t>()); |
79 cls.set_token_pos(reader->Read<int32_t>()); | 79 cls.set_token_pos(reader->Read<int32_t>()); |
80 cls.set_state_bits(reader->Read<uint16_t>()); | 80 cls.set_state_bits(reader->Read<uint16_t>()); |
81 | 81 |
82 // Set all the object fields. | 82 // Set all the object fields. |
83 READ_OBJECT_FIELDS(cls, cls.raw()->from(), cls.raw()->to(), kAsReference); | 83 READ_OBJECT_FIELDS(cls, cls.raw()->from(), cls.raw()->to(), kAsReference); |
84 | |
85 ASSERT(!cls.IsInFullSnapshot() || (kind == Snapshot::kFull)); | 84 ASSERT(!cls.IsInFullSnapshot() || (kind == Snapshot::kFull)); |
86 } else { | 85 } else { |
87 cls ^= reader->ReadClassId(object_id); | 86 cls ^= reader->ReadClassId(object_id); |
88 ASSERT((kind == Snapshot::kMessage) || cls.IsInFullSnapshot()); | 87 ASSERT((kind == Snapshot::kMessage) || cls.IsInFullSnapshot()); |
89 } | 88 } |
90 return cls.raw(); | 89 return cls.raw(); |
91 } | 90 } |
92 | 91 |
93 | 92 |
94 void RawClass::WriteTo(SnapshotWriter* writer, | 93 void RawClass::WriteTo(SnapshotWriter* writer, |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 *reader->StringHandle() ^= reader->ReadObjectImpl(kAsInlinedObject); | 1061 *reader->StringHandle() ^= reader->ReadObjectImpl(kAsInlinedObject); |
1063 library = Library::LookupLibrary(*reader->StringHandle()); | 1062 library = Library::LookupLibrary(*reader->StringHandle()); |
1064 ASSERT(library.is_in_fullsnapshot()); | 1063 ASSERT(library.is_in_fullsnapshot()); |
1065 } else { | 1064 } else { |
1066 // Allocate library object. | 1065 // Allocate library object. |
1067 library = NEW_OBJECT(Library); | 1066 library = NEW_OBJECT(Library); |
1068 | 1067 |
1069 // Set all non object fields. | 1068 // Set all non object fields. |
1070 library.StoreNonPointer(&library.raw_ptr()->index_, | 1069 library.StoreNonPointer(&library.raw_ptr()->index_, |
1071 reader->ReadClassIDValue()); | 1070 reader->ReadClassIDValue()); |
1072 library.StoreNonPointer(&library.raw_ptr()->num_anonymous_, | |
1073 reader->ReadClassIDValue()); | |
1074 library.StoreNonPointer(&library.raw_ptr()->num_imports_, | 1071 library.StoreNonPointer(&library.raw_ptr()->num_imports_, |
1075 reader->Read<uint16_t>()); | 1072 reader->Read<uint16_t>()); |
1076 library.StoreNonPointer(&library.raw_ptr()->load_state_, | 1073 library.StoreNonPointer(&library.raw_ptr()->load_state_, |
1077 reader->Read<int8_t>()); | 1074 reader->Read<int8_t>()); |
1078 library.StoreNonPointer(&library.raw_ptr()->corelib_imported_, | 1075 library.StoreNonPointer(&library.raw_ptr()->corelib_imported_, |
1079 reader->Read<bool>()); | 1076 reader->Read<bool>()); |
1080 library.StoreNonPointer(&library.raw_ptr()->is_dart_scheme_, | 1077 library.StoreNonPointer(&library.raw_ptr()->is_dart_scheme_, |
1081 reader->Read<bool>()); | 1078 reader->Read<bool>()); |
1082 library.StoreNonPointer(&library.raw_ptr()->debuggable_, | 1079 library.StoreNonPointer(&library.raw_ptr()->debuggable_, |
1083 reader->Read<bool>()); | 1080 reader->Read<bool>()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 // to be interpreted. | 1130 // to be interpreted. |
1134 writer->Write<bool>(ptr()->is_in_fullsnapshot_); | 1131 writer->Write<bool>(ptr()->is_in_fullsnapshot_); |
1135 | 1132 |
1136 if ((kind == Snapshot::kScript) && ptr()->is_in_fullsnapshot_) { | 1133 if ((kind == Snapshot::kScript) && ptr()->is_in_fullsnapshot_) { |
1137 // Write out library URL so that it can be looked up when reading. | 1134 // Write out library URL so that it can be looked up when reading. |
1138 writer->WriteObjectImpl(ptr()->url_, kAsInlinedObject); | 1135 writer->WriteObjectImpl(ptr()->url_, kAsInlinedObject); |
1139 } else { | 1136 } else { |
1140 ASSERT((kind == Snapshot::kFull) || !ptr()->is_in_fullsnapshot_); | 1137 ASSERT((kind == Snapshot::kFull) || !ptr()->is_in_fullsnapshot_); |
1141 // Write out all non object fields. | 1138 // Write out all non object fields. |
1142 writer->WriteClassIDValue(ptr()->index_); | 1139 writer->WriteClassIDValue(ptr()->index_); |
1143 writer->WriteClassIDValue(ptr()->num_anonymous_); | |
1144 writer->Write<uint16_t>(ptr()->num_imports_); | 1140 writer->Write<uint16_t>(ptr()->num_imports_); |
1145 writer->Write<int8_t>(ptr()->load_state_); | 1141 writer->Write<int8_t>(ptr()->load_state_); |
1146 writer->Write<bool>(ptr()->corelib_imported_); | 1142 writer->Write<bool>(ptr()->corelib_imported_); |
1147 writer->Write<bool>(ptr()->is_dart_scheme_); | 1143 writer->Write<bool>(ptr()->is_dart_scheme_); |
1148 writer->Write<bool>(ptr()->debuggable_); | 1144 writer->Write<bool>(ptr()->debuggable_); |
1149 // We do not serialize the native resolver or symbolizer. These need to be | 1145 // We do not serialize the native resolver or symbolizer. These need to be |
1150 // explicitly set after deserialization. | 1146 // explicitly set after deserialization. |
1151 // We do not write the loaded_scripts_ cache to the snapshot. It gets | 1147 // We do not write the loaded_scripts_ cache to the snapshot. It gets |
1152 // set to NULL when reading the library from the snapshot, and will | 1148 // set to NULL when reading the library from the snapshot, and will |
1153 // be rebuilt lazily. | 1149 // be rebuilt lazily. |
(...skipping 2341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3495 // We do not allow objects with native fields in an isolate message. | 3491 // We do not allow objects with native fields in an isolate message. |
3496 writer->SetWriteException(Exceptions::kArgument, | 3492 writer->SetWriteException(Exceptions::kArgument, |
3497 "Illegal argument in isolate message" | 3493 "Illegal argument in isolate message" |
3498 " : (object is a UserTag)"); | 3494 " : (object is a UserTag)"); |
3499 } else { | 3495 } else { |
3500 UNREACHABLE(); | 3496 UNREACHABLE(); |
3501 } | 3497 } |
3502 } | 3498 } |
3503 | 3499 |
3504 } // namespace dart | 3500 } // namespace dart |
OLD | NEW |