Chromium Code Reviews| Index: runtime/vm/snapshot.cc |
| diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc |
| index 98ae976d4424bf11fb740323dde44e6b7e2c3067..c02a03f6465553dba1f9b264265984240bf759cc 100644 |
| --- a/runtime/vm/snapshot.cc |
| +++ b/runtime/vm/snapshot.cc |
| @@ -214,7 +214,9 @@ RawObject* SnapshotReader::ReadObject() { |
| (*backward_references_)[i].set_state(kIsDeserialized); |
| } |
| } |
| - ProcessDeferredCanonicalizations(); |
| + if (kind() != Snapshot::kFull) { |
| + ProcessDeferredCanonicalizations(); |
| + } |
| return obj.raw(); |
| } else { |
| // An error occurred while reading, return the error object. |
| @@ -1155,28 +1157,36 @@ void SnapshotReader::AddPatchRecord(intptr_t object_id, |
| void SnapshotReader::ProcessDeferredCanonicalizations() { |
| - AbstractType& typeobj = AbstractType::Handle(); |
| + Type& typeobj = Type::Handle(); |
| TypeArguments& typeargs = TypeArguments::Handle(); |
| Object& newobj = Object::Handle(); |
| for (intptr_t i = 0; i < backward_references_->length(); i++) { |
| BackRefNode& backref = (*backward_references_)[i]; |
| if (backref.defer_canonicalization()) { |
| Object* objref = backref.reference(); |
| + bool needs_patching = false; |
| // Object should either be an abstract type or a type argument. |
| - if (objref->IsAbstractType()) { |
| + if (objref->IsType()) { |
| typeobj ^= objref->raw(); |
| - typeobj.ClearCanonical(); |
| newobj = typeobj.Canonicalize(); |
|
regis
2015/08/06 16:36:08
Ideally, in the case of a resursive type, Canonica
siva
2015/08/06 17:28:44
I was thinking of another approach wherein we alwa
regis
2015/08/06 18:24:35
We still have to make sure type tests succeed. Yes
|
| + if ((newobj.raw() != typeobj.raw()) && !typeobj.IsRecursive()) { |
| + needs_patching = true; |
| + } else { |
| + // Set Canonical bit. |
| + objref->SetCanonical(); |
| + } |
| } else { |
| ASSERT(objref->IsTypeArguments()); |
| typeargs ^= objref->raw(); |
| - typeargs.ClearCanonical(); |
| newobj = typeargs.Canonicalize(); |
| + if ((newobj.raw() != typeargs.raw()) && !typeargs.IsRecursive()) { |
| + needs_patching = true; |
| + } else { |
| + // Set Canonical bit. |
| + objref->SetCanonical(); |
| + } |
| } |
| - if (newobj.raw() == objref->raw()) { |
| - // Restore Canonical bit. |
| - objref->SetCanonical(); |
| - } else { |
| + if (needs_patching) { |
| ZoneGrowableArray<intptr_t>* patches = backref.patch_records(); |
| ASSERT(newobj.IsCanonical()); |
| ASSERT(patches != NULL); |