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

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

Issue 2933223002: Update subclasses array and is_implemented bit when loading script snapshots. (Closed)
Patch Set: . Created 3 years, 6 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/snapshot.h ('k') | runtime/vm/snapshot_test.cc » ('j') | 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/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 PassiveObject& obj = 235 PassiveObject& obj =
236 PassiveObject::Handle(zone(), ReadObjectImpl(kAsInlinedObject)); 236 PassiveObject::Handle(zone(), ReadObjectImpl(kAsInlinedObject));
237 for (intptr_t i = 0; i < backward_references_->length(); i++) { 237 for (intptr_t i = 0; i < backward_references_->length(); i++) {
238 if (!(*backward_references_)[i].is_deserialized()) { 238 if (!(*backward_references_)[i].is_deserialized()) {
239 ReadObjectImpl(kAsInlinedObject); 239 ReadObjectImpl(kAsInlinedObject);
240 (*backward_references_)[i].set_state(kIsDeserialized); 240 (*backward_references_)[i].set_state(kIsDeserialized);
241 } 241 }
242 } 242 }
243 if (backward_references_->length() > 0) { 243 if (backward_references_->length() > 0) {
244 ProcessDeferredCanonicalizations(); 244 ProcessDeferredCanonicalizations();
245 if (kind() == Snapshot::kScript) {
246 FixSubclassesAndImplementors();
247 }
245 return (*backward_references_)[0].reference()->raw(); 248 return (*backward_references_)[0].reference()->raw();
246 } else { 249 } else {
247 return obj.raw(); 250 return obj.raw();
248 } 251 }
249 } else { 252 } else {
250 // An error occurred while reading, return the error object. 253 // An error occurred while reading, return the error object.
251 const Error& err = Error::Handle(thread()->sticky_error()); 254 const Error& err = Error::Handle(thread()->sticky_error());
252 thread()->clear_sticky_error(); 255 thread()->clear_sticky_error();
253 return err.raw(); 256 return err.raw();
254 } 257 }
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 } 1233 }
1231 } 1234 }
1232 } else { 1235 } else {
1233 ASSERT(objref->IsCanonical()); 1236 ASSERT(objref->IsCanonical());
1234 } 1237 }
1235 } 1238 }
1236 } 1239 }
1237 } 1240 }
1238 1241
1239 1242
1243 void SnapshotReader::FixSubclassesAndImplementors() {
1244 Class& cls = Class::Handle(zone());
1245 Class& supercls = Class::Handle(zone());
1246 Array& interfaces = Array::Handle(zone());
1247 AbstractType& interface = AbstractType::Handle(zone());
1248 Class& interface_cls = Class::Handle(zone());
1249 for (intptr_t i = 0; i < backward_references_->length(); i++) {
1250 BackRefNode& backref = (*backward_references_)[i];
1251 Object* objref = backref.reference();
1252 if (objref->IsClass()) {
1253 cls ^= objref->raw();
1254 if (!cls.IsInFullSnapshot()) {
1255 supercls = cls.SuperClass();
1256 if (!supercls.IsNull() && !supercls.IsObjectClass() &&
1257 supercls.IsInFullSnapshot()) {
1258 supercls.AddDirectSubclass(cls);
1259 supercls.DisableCHAOptimizedCode(cls);
1260 }
1261 interfaces = cls.interfaces();
1262 for (intptr_t i = 0; i < interfaces.Length(); i++) {
1263 interface ^= interfaces.At(i);
1264 interface_cls = interface.type_class();
1265 interface_cls.set_is_implemented();
1266 interface_cls.DisableCHAOptimizedCode(cls);
1267 }
1268 }
1269 }
1270 }
1271 }
1272
1273
1240 void SnapshotReader::ArrayReadFrom(intptr_t object_id, 1274 void SnapshotReader::ArrayReadFrom(intptr_t object_id,
1241 const Array& result, 1275 const Array& result,
1242 intptr_t len, 1276 intptr_t len,
1243 intptr_t tags) { 1277 intptr_t tags) {
1244 // Setup the object fields. 1278 // Setup the object fields.
1245 const intptr_t typeargs_offset = 1279 const intptr_t typeargs_offset =
1246 GrowableObjectArray::type_arguments_offset() / kWordSize; 1280 GrowableObjectArray::type_arguments_offset() / kWordSize;
1247 *TypeArgumentsHandle() ^= 1281 *TypeArgumentsHandle() ^=
1248 ReadObjectImpl(kAsInlinedObject, object_id, typeargs_offset); 1282 ReadObjectImpl(kAsInlinedObject, object_id, typeargs_offset);
1249 result.SetTypeArguments(*TypeArgumentsHandle()); 1283 result.SetTypeArguments(*TypeArgumentsHandle());
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 *buffer_len_ = BytesWritten(); 2044 *buffer_len_ = BytesWritten();
2011 } 2045 }
2012 } else { 2046 } else {
2013 FreeBuffer(); 2047 FreeBuffer();
2014 ThrowException(exception_type(), exception_msg()); 2048 ThrowException(exception_type(), exception_msg());
2015 } 2049 }
2016 } 2050 }
2017 2051
2018 2052
2019 } // namespace dart 2053 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.h ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698