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

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 10996002: Fix snapshot reading of canonicalized types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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/object.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object_snapshot.cc
===================================================================
--- runtime/vm/raw_object_snapshot.cc (revision 12871)
+++ runtime/vm/raw_object_snapshot.cc (working copy)
@@ -195,9 +195,6 @@
Type& type = Type::ZoneHandle(reader->isolate(), NEW_OBJECT(Type));
reader->AddBackRef(object_id, &type, kIsDeserialized);
- // Set the object tags.
- type.set_tags(tags);
-
// Set all non object fields.
type.set_token_pos(reader->ReadIntptrValue());
type.set_type_state(reader->Read<int8_t>());
@@ -211,9 +208,14 @@
}
// If object needs to be a canonical object, Canonicalize it.
- if ((kind != Snapshot::kFull) && type.IsCanonical()) {
+ if ((kind != Snapshot::kFull) && RawObject::IsCanonical(tags)) {
type ^= type.Canonicalize();
}
+
+ // Set the object tags (This is done after 'Canonicalize', which
+ // does not canonicalize a type already marked as canonical).
+ type.set_tags(tags);
+
return type.raw();
}
@@ -332,15 +334,17 @@
type_arguments.SetTypeAt(i, *reader->TypeHandle());
}
+ // If object needs to be a canonical object, Canonicalize it.
+ if ((kind != Snapshot::kFull) && RawObject::IsCanonical(tags)) {
+ type_arguments ^= type_arguments.Canonicalize();
+ }
+
// Set the object tags (This is done after setting the object fields
// because 'SetTypeAt' has an assertion to check if the object is not
- // already canonical).
+ // already canonical. Also, this is done after 'Canonicalize', which
+ // does not canonicalize a type already marked as canonical).
type_arguments.set_tags(tags);
- // If object needs to be a canonical object, Canonicalize it.
- if ((kind != Snapshot::kFull) && type_arguments.IsCanonical()) {
- type_arguments ^= type_arguments.Canonicalize();
- }
return type_arguments.raw();
}
« 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