Chromium Code Reviews| 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/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 Loading... | |
| 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 FixSubclassesAndImplementors(); | |
|
siva
2017/06/12 22:59:42
should only be done when kind == kScript?
This pa
rmacnak
2017/06/12 23:37:42
Yes, added check for kScript
| |
| 245 return (*backward_references_)[0].reference()->raw(); | 246 return (*backward_references_)[0].reference()->raw(); |
| 246 } else { | 247 } else { |
| 247 return obj.raw(); | 248 return obj.raw(); |
| 248 } | 249 } |
| 249 } else { | 250 } else { |
| 250 // An error occurred while reading, return the error object. | 251 // An error occurred while reading, return the error object. |
| 251 const Error& err = Error::Handle(thread()->sticky_error()); | 252 const Error& err = Error::Handle(thread()->sticky_error()); |
| 252 thread()->clear_sticky_error(); | 253 thread()->clear_sticky_error(); |
| 253 return err.raw(); | 254 return err.raw(); |
| 254 } | 255 } |
| (...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1230 } | 1231 } |
| 1231 } | 1232 } |
| 1232 } else { | 1233 } else { |
| 1233 ASSERT(objref->IsCanonical()); | 1234 ASSERT(objref->IsCanonical()); |
| 1234 } | 1235 } |
| 1235 } | 1236 } |
| 1236 } | 1237 } |
| 1237 } | 1238 } |
| 1238 | 1239 |
| 1239 | 1240 |
| 1241 void SnapshotReader::FixSubclassesAndImplementors() { | |
| 1242 Class& cls = Class::Handle(zone()); | |
| 1243 Class& supercls = Class::Handle(zone()); | |
| 1244 Array& interfaces = Array::Handle(zone()); | |
| 1245 AbstractType& interface = AbstractType::Handle(zone()); | |
| 1246 Class& interface_cls = Class::Handle(zone()); | |
| 1247 for (intptr_t i = 0; i < backward_references_->length(); i++) { | |
| 1248 BackRefNode& backref = (*backward_references_)[i]; | |
| 1249 Object* objref = backref.reference(); | |
| 1250 if (objref->IsClass()) { | |
| 1251 cls ^= objref->raw(); | |
| 1252 if (!cls.IsInFullSnapshot()) { | |
| 1253 supercls = cls.SuperClass(); | |
| 1254 if (!supercls.IsNull() && !supercls.IsObjectClass() && | |
| 1255 supercls.IsInFullSnapshot()) { | |
| 1256 supercls.AddDirectSubclass(cls); | |
| 1257 supercls.DisableCHAOptimizedCode(cls); | |
| 1258 } | |
| 1259 interfaces = cls.interfaces(); | |
| 1260 for (intptr_t i = 0; i < interfaces.Length(); i++) { | |
| 1261 interface ^= interfaces.At(i); | |
| 1262 interface_cls = interface.type_class(); | |
| 1263 interface_cls.set_is_implemented(); | |
| 1264 interface_cls.DisableCHAOptimizedCode(cls); | |
| 1265 } | |
| 1266 } | |
| 1267 } | |
| 1268 } | |
| 1269 } | |
| 1270 | |
| 1271 | |
| 1240 void SnapshotReader::ArrayReadFrom(intptr_t object_id, | 1272 void SnapshotReader::ArrayReadFrom(intptr_t object_id, |
| 1241 const Array& result, | 1273 const Array& result, |
| 1242 intptr_t len, | 1274 intptr_t len, |
| 1243 intptr_t tags) { | 1275 intptr_t tags) { |
| 1244 // Setup the object fields. | 1276 // Setup the object fields. |
| 1245 const intptr_t typeargs_offset = | 1277 const intptr_t typeargs_offset = |
| 1246 GrowableObjectArray::type_arguments_offset() / kWordSize; | 1278 GrowableObjectArray::type_arguments_offset() / kWordSize; |
| 1247 *TypeArgumentsHandle() ^= | 1279 *TypeArgumentsHandle() ^= |
| 1248 ReadObjectImpl(kAsInlinedObject, object_id, typeargs_offset); | 1280 ReadObjectImpl(kAsInlinedObject, object_id, typeargs_offset); |
| 1249 result.SetTypeArguments(*TypeArgumentsHandle()); | 1281 result.SetTypeArguments(*TypeArgumentsHandle()); |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2010 *buffer_len_ = BytesWritten(); | 2042 *buffer_len_ = BytesWritten(); |
| 2011 } | 2043 } |
| 2012 } else { | 2044 } else { |
| 2013 FreeBuffer(); | 2045 FreeBuffer(); |
| 2014 ThrowException(exception_type(), exception_msg()); | 2046 ThrowException(exception_type(), exception_msg()); |
| 2015 } | 2047 } |
| 2016 } | 2048 } |
| 2017 | 2049 |
| 2018 | 2050 |
| 2019 } // namespace dart | 2051 } // namespace dart |
| OLD | NEW |