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 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 ASSERT(reader != NULL); | 1125 ASSERT(reader != NULL); |
1126 ASSERT(kind != Snapshot::kMessage); | 1126 ASSERT(kind != Snapshot::kMessage); |
1127 | 1127 |
1128 Library& library = Library::ZoneHandle(reader->zone(), Library::null()); | 1128 Library& library = Library::ZoneHandle(reader->zone(), Library::null()); |
1129 reader->AddBackRef(object_id, &library, kIsDeserialized); | 1129 reader->AddBackRef(object_id, &library, kIsDeserialized); |
1130 | 1130 |
1131 bool is_in_fullsnapshot = reader->Read<bool>(); | 1131 bool is_in_fullsnapshot = reader->Read<bool>(); |
1132 if ((kind == Snapshot::kScript) && is_in_fullsnapshot) { | 1132 if ((kind == Snapshot::kScript) && is_in_fullsnapshot) { |
1133 // Lookup the object as it should already exist in the heap. | 1133 // Lookup the object as it should already exist in the heap. |
1134 *reader->StringHandle() ^= reader->ReadObjectImpl(kAsInlinedObject); | 1134 *reader->StringHandle() ^= reader->ReadObjectImpl(kAsInlinedObject); |
1135 library = Library::LookupLibrary(*reader->StringHandle()); | 1135 library = Library::LookupLibrary(reader->thread(), *reader->StringHandle()); |
1136 ASSERT(library.is_in_fullsnapshot()); | 1136 ASSERT(library.is_in_fullsnapshot()); |
1137 } else { | 1137 } else { |
1138 // Allocate library object. | 1138 // Allocate library object. |
1139 library = NEW_OBJECT(Library); | 1139 library = NEW_OBJECT(Library); |
1140 | 1140 |
1141 // Set all non object fields. | 1141 // Set all non object fields. |
1142 library.StoreNonPointer(&library.raw_ptr()->index_, | 1142 library.StoreNonPointer(&library.raw_ptr()->index_, |
1143 reader->ReadClassIDValue()); | 1143 reader->ReadClassIDValue()); |
1144 library.StoreNonPointer(&library.raw_ptr()->num_imports_, | 1144 library.StoreNonPointer(&library.raw_ptr()->num_imports_, |
1145 reader->Read<uint16_t>()); | 1145 reader->Read<uint16_t>()); |
(...skipping 21 matching lines...) Expand all Loading... |
1167 for (intptr_t i = 0; i <= num_flds; i++) { | 1167 for (intptr_t i = 0; i <= num_flds; i++) { |
1168 (*reader->PassiveObjectHandle()) = reader->ReadObjectImpl(kAsReference); | 1168 (*reader->PassiveObjectHandle()) = reader->ReadObjectImpl(kAsReference); |
1169 library.StorePointer((library.raw()->from() + i), | 1169 library.StorePointer((library.raw()->from() + i), |
1170 reader->PassiveObjectHandle()->raw()); | 1170 reader->PassiveObjectHandle()->raw()); |
1171 } | 1171 } |
1172 // Initialize cache of resolved names. | 1172 // Initialize cache of resolved names. |
1173 const intptr_t kInitialNameCacheSize = 64; | 1173 const intptr_t kInitialNameCacheSize = 64; |
1174 if (!Snapshot::IsFull(kind)) { | 1174 if (!Snapshot::IsFull(kind)) { |
1175 // The cache of resolved names in library scope is not serialized. | 1175 // The cache of resolved names in library scope is not serialized. |
1176 library.InitResolvedNamesCache(kInitialNameCacheSize); | 1176 library.InitResolvedNamesCache(kInitialNameCacheSize); |
1177 library.Register(); | 1177 library.Register(reader->thread()); |
1178 } else { | 1178 } else { |
1179 library.InitResolvedNamesCache(kInitialNameCacheSize, reader); | 1179 library.InitResolvedNamesCache(kInitialNameCacheSize, reader); |
1180 } | 1180 } |
1181 library.StorePointer(&library.raw_ptr()->exported_names_, Array::null()); | 1181 library.StorePointer(&library.raw_ptr()->exported_names_, Array::null()); |
1182 // Initialize cache of loaded scripts. | 1182 // Initialize cache of loaded scripts. |
1183 library.StorePointer(&library.raw_ptr()->loaded_scripts_, Array::null()); | 1183 library.StorePointer(&library.raw_ptr()->loaded_scripts_, Array::null()); |
1184 } | 1184 } |
1185 return library.raw(); | 1185 return library.raw(); |
1186 } | 1186 } |
1187 | 1187 |
(...skipping 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3703 // We do not allow objects with native fields in an isolate message. | 3703 // We do not allow objects with native fields in an isolate message. |
3704 writer->SetWriteException(Exceptions::kArgument, | 3704 writer->SetWriteException(Exceptions::kArgument, |
3705 "Illegal argument in isolate message" | 3705 "Illegal argument in isolate message" |
3706 " : (object is a UserTag)"); | 3706 " : (object is a UserTag)"); |
3707 } else { | 3707 } else { |
3708 UNREACHABLE(); | 3708 UNREACHABLE(); |
3709 } | 3709 } |
3710 } | 3710 } |
3711 | 3711 |
3712 } // namespace dart | 3712 } // namespace dart |
OLD | NEW |