Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Side by Side Diff: runtime/vm/raw_object_snapshot.cc

Issue 2823633003: Allow the resolved names cache to be lazily created like the exported names cache. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 1148
1149 // Set all the object fields. 1149 // Set all the object fields.
1150 // TODO(5411462): Need to assert No GC can happen here, even though 1150 // TODO(5411462): Need to assert No GC can happen here, even though
1151 // allocations may happen. 1151 // allocations may happen.
1152 intptr_t num_flds = (library.raw()->to_snapshot() - library.raw()->from()); 1152 intptr_t num_flds = (library.raw()->to_snapshot() - library.raw()->from());
1153 for (intptr_t i = 0; i <= num_flds; i++) { 1153 for (intptr_t i = 0; i <= num_flds; i++) {
1154 (*reader->PassiveObjectHandle()) = reader->ReadObjectImpl(kAsReference); 1154 (*reader->PassiveObjectHandle()) = reader->ReadObjectImpl(kAsReference);
1155 library.StorePointer((library.raw()->from() + i), 1155 library.StorePointer((library.raw()->from() + i),
1156 reader->PassiveObjectHandle()->raw()); 1156 reader->PassiveObjectHandle()->raw());
1157 } 1157 }
1158 // Initialize cache of resolved names. 1158 // Initialize caches that are not serialized.
1159 const intptr_t kInitialNameCacheSize = 64; 1159 library.StorePointer(&library.raw_ptr()->resolved_names_, Array::null());
1160 // The cache of resolved names in library scope is not serialized. 1160 library.StorePointer(&library.raw_ptr()->exported_names_, Array::null());
1161 library.InitResolvedNamesCache(kInitialNameCacheSize); 1161 library.StorePointer(&library.raw_ptr()->loaded_scripts_, Array::null());
1162 library.Register(reader->thread()); 1162 library.Register(reader->thread());
1163 library.StorePointer(&library.raw_ptr()->exported_names_, Array::null());
1164 // Initialize cache of loaded scripts.
1165 library.StorePointer(&library.raw_ptr()->loaded_scripts_, Array::null());
1166 } 1163 }
1167 return library.raw(); 1164 return library.raw();
1168 } 1165 }
1169 1166
1170 1167
1171 void RawLibrary::WriteTo(SnapshotWriter* writer, 1168 void RawLibrary::WriteTo(SnapshotWriter* writer,
1172 intptr_t object_id, 1169 intptr_t object_id,
1173 Snapshot::Kind kind, 1170 Snapshot::Kind kind,
1174 bool as_reference) { 1171 bool as_reference) {
1175 ASSERT(writer != NULL); 1172 ASSERT(writer != NULL);
(...skipping 1892 matching lines...) Expand 10 before | Expand all | Expand 10 after
3068 // We do not allow objects with native fields in an isolate message. 3065 // We do not allow objects with native fields in an isolate message.
3069 writer->SetWriteException(Exceptions::kArgument, 3066 writer->SetWriteException(Exceptions::kArgument,
3070 "Illegal argument in isolate message" 3067 "Illegal argument in isolate message"
3071 " : (object is a UserTag)"); 3068 " : (object is a UserTag)");
3072 } else { 3069 } else {
3073 UNREACHABLE(); 3070 UNREACHABLE();
3074 } 3071 }
3075 } 3072 }
3076 3073
3077 } // namespace dart 3074 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698