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

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 1279453005: Do not try to patch type objects that are already canonical. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments 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/object.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/raw_object_snapshot.cc
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 9a12d08f26e9b3593679cc3ff3ff719424f07f91..0cff97ae8bf3ad8655741d355a685a156a283dd2 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -209,10 +209,14 @@ RawType* Type::ReadFrom(SnapshotReader* reader,
Snapshot::Kind kind) {
ASSERT(reader != NULL);
+ // Determine if the type class of this type is in the full snapshot.
+ bool typeclass_is_in_fullsnapshot = reader->Read<bool>();
+
// Allocate type object.
Type& type = Type::ZoneHandle(reader->zone(), NEW_OBJECT(Type));
bool is_canonical = RawObject::IsCanonical(tags);
- bool defer_canonicalization = is_canonical && (kind != Snapshot::kFull);
+ bool defer_canonicalization = is_canonical &&
+ (kind != Snapshot::kFull && typeclass_is_in_fullsnapshot);
reader->AddBackRef(object_id, &type, kIsDeserialized, defer_canonicalization);
// Set all non object fields.
@@ -257,6 +261,14 @@ void RawType::WriteTo(SnapshotWriter* writer,
writer->WriteIndexedObject(kTypeCid);
writer->WriteTags(writer->GetObjectTags(this));
+ // Write out typeclass_is_in_fullsnapshot first as this will
+ // help the reader decide on how to canonicalize the type object.
+ intptr_t tags = writer->GetObjectTags(ptr()->type_class_);
+ bool typeclass_is_in_fullsnapshot =
+ (ClassIdTag::decode(tags) == kClassCid) &&
+ Class::IsInFullSnapshot(reinterpret_cast<RawClass*>(ptr()->type_class_));
+ writer->Write<bool>(typeclass_is_in_fullsnapshot);
+
// Write out all the non object pointer fields.
writer->Write<int32_t>(ptr()->token_pos_);
writer->Write<int8_t>(ptr()->type_state_);
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698