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

Unified Diff: runtime/vm/snapshot.cc

Issue 1276753002: 1. Fix the type arguments recursion problem that gets introduced when canonicalization of type argu… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: address-code-review Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index 98ae976d4424bf11fb740323dde44e6b7e2c3067..b08e704d7b220ad08c1691e7c49f3b2a7c169cbb 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();
+ 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);
@@ -1204,8 +1214,7 @@ void SnapshotReader::ArrayReadFrom(intptr_t object_id,
// Setup the object fields.
const intptr_t typeargs_offset =
- reinterpret_cast<RawObject**>(&result.raw()->ptr()->type_arguments_) -
- reinterpret_cast<RawObject**>(result.raw()->ptr());
+ GrowableObjectArray::type_arguments_offset() / kWordSize;
*TypeArgumentsHandle() ^= ReadObjectImpl(kAsInlinedObject,
object_id,
typeargs_offset);
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698