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

Unified Diff: runtime/vm/raw_object_snapshot.cc

Issue 12578009: - Canonicalize types, type_arguments only when the object is marked as being from the core librarie… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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/pages.h ('k') | runtime/vm/snapshot.h » ('j') | 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 20419)
+++ runtime/vm/raw_object_snapshot.cc (working copy)
@@ -205,7 +205,16 @@
}
// If object needs to be a canonical object, Canonicalize it.
- if ((kind != Snapshot::kFull) && RawObject::IsCanonical(tags)) {
+ // When reading a full snapshot we don't need to canonicalize the object
+ // as it would already be a canonical object.
+ // When reading a script snapshot we need to canonicalize only those object
+ // references that are objects from the core library (loaded from a
+ // full snapshot). Objects that are only in the script need not be
+ // canonicalized as they are already canonical.
+ // When reading a message snapshot we always have to canonicalize the object.
+ if ((kind != Snapshot::kFull) && RawObject::IsCanonical(tags) &&
+ (RawObject::IsCreatedFromSnapshot(tags) ||
+ (kind == Snapshot::kMessage))) {
type ^= type.Canonicalize();
}
@@ -458,7 +467,16 @@
}
// If object needs to be a canonical object, Canonicalize it.
- if ((kind != Snapshot::kFull) && RawObject::IsCanonical(tags)) {
+ // When reading a full snapshot we don't need to canonicalize the object
+ // as it would already be a canonical object.
+ // When reading a script snapshot we need to canonicalize only those object
+ // references that are objects from the core library (loaded from a
+ // full snapshot). Objects that are only in the script need not be
+ // canonicalized as they are already canonical.
+ // When reading a message snapshot we always have to canonicalize the object.
+ if ((kind != Snapshot::kFull) && RawObject::IsCanonical(tags) &&
+ (RawObject::IsCreatedFromSnapshot(tags) ||
+ (kind == Snapshot::kMessage))) {
type_arguments ^= type_arguments.Canonicalize();
}
@@ -1597,7 +1615,14 @@
if (kind == Snapshot::kFull) {
mint = reader->NewMint(value);
} else {
- if (RawObject::IsCanonical(tags)) {
+ // When reading a script snapshot we need to canonicalize only those object
+ // references that are objects from the core library (loaded from a
+ // full snapshot). Objects that are only in the script need not be
+ // canonicalized as they are already canonical.
+ // When reading a message snapshot we always have to canonicalize.
+ if (RawObject::IsCanonical(tags) &&
+ (RawObject::IsCreatedFromSnapshot(tags) ||
+ (kind == Snapshot::kMessage))) {
mint = Mint::NewCanonical(value);
} else {
mint = Mint::New(value, HEAP_SPACE(kind));
@@ -1648,7 +1673,16 @@
BigintOperations::FromHexCString(str, HEAP_SPACE(kind))));
// If it is a canonical constant make it one.
- if ((kind != Snapshot::kFull) && RawObject::IsCanonical(tags)) {
+ // When reading a full snapshot we don't need to canonicalize the object
+ // as it would already be a canonical object.
+ // When reading a script snapshot we need to canonicalize only those object
+ // references that are objects from the core library (loaded from a
+ // full snapshot). Objects that are only in the script need not be
+ // canonicalized as they are already canonical.
+ // When reading a message snapshot we always have to canonicalize the object.
+ if ((kind != Snapshot::kFull) && RawObject::IsCanonical(tags) &&
+ (RawObject::IsCreatedFromSnapshot(tags) ||
+ (kind == Snapshot::kMessage))) {
obj ^= obj.Canonicalize();
}
reader->AddBackRef(object_id, &obj, kIsDeserialized);
@@ -1715,7 +1749,14 @@
if (kind == Snapshot::kFull) {
dbl = reader->NewDouble(value);
} else {
- if (RawObject::IsCanonical(tags)) {
+ // When reading a script snapshot we need to canonicalize only those object
+ // references that are objects from the core library (loaded from a
+ // full snapshot). Objects that are only in the script need not be
+ // canonicalized as they are already canonical.
+ // When reading a message snapshot we always have to canonicalize.
+ if (RawObject::IsCanonical(tags) &&
+ (RawObject::IsCreatedFromSnapshot(tags) ||
+ (kind == Snapshot::kMessage))) {
dbl = Double::NewCanonical(value);
} else {
dbl = Double::New(value, HEAP_SPACE(kind));
« no previous file with comments | « runtime/vm/pages.h ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698