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

Unified Diff: runtime/vm/snapshot.cc

Issue 745203002: - Make array immutable first, then canonicalize it. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 1 month 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') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
===================================================================
--- runtime/vm/snapshot.cc (revision 41877)
+++ runtime/vm/snapshot.cc (working copy)
@@ -951,10 +951,11 @@
ASSERT(next_field_offset > 0);
// Instance::NextFieldOffset() returns the offset of the first field in
// a Dart object.
+ bool is_canonical = RawObject::IsCanonical(tags);
intptr_t offset = Instance::NextFieldOffset();
intptr_t result_cid = result->GetClassId();
while (offset < next_field_offset) {
- pobj_ = ReadObjectRef();
+ pobj_ = is_canonical ? ReadObjectImpl() : ReadObjectRef();
result->SetFieldAtOffset(offset, pobj_);
if ((offset != type_argument_field_offset) &&
(kind_ == Snapshot::kMessage)) {
@@ -981,7 +982,7 @@
offset += kWordSize;
}
result->SetCreatedFromSnapshot();
- } else if (false && RawObject::IsCanonical(tags)) {
+ } else if (RawObject::IsCanonical(tags)) {
*result = result->CheckAndCanonicalize(NULL);
ASSERT(!result->IsNull());
}
@@ -1034,8 +1035,10 @@
*TypeArgumentsHandle() ^= ReadObjectImpl();
result.SetTypeArguments(*TypeArgumentsHandle());
+ bool is_canonical = RawObject::IsCanonical(tags);
+
for (intptr_t i = 0; i < len; i++) {
- *PassiveObjectHandle() = ReadObjectRef();
+ *PassiveObjectHandle() = is_canonical ? ReadObjectImpl() : ReadObjectRef();
result.SetAt(i, *PassiveObjectHandle());
}
}
@@ -1593,8 +1596,13 @@
WriteObjectImpl(type_arguments);
// Write out the individual object ids.
+ bool is_canonical = RawObject::IsCanonical(tags);
for (intptr_t i = 0; i < len; i++) {
- WriteObjectRef(data[i]);
+ if (is_canonical) {
+ WriteObjectImpl(data[i]);
+ } else {
+ WriteObjectRef(data[i]);
+ }
}
}
@@ -1652,10 +1660,16 @@
// Write out all the fields for the object.
// Instance::NextFieldOffset() returns the offset of the first field in
// a Dart object.
+ bool is_canonical = RawObject::IsCanonical(tags);
intptr_t offset = Instance::NextFieldOffset();
while (offset < next_field_offset) {
- WriteObjectRef(*reinterpret_cast<RawObject**>(
- reinterpret_cast<uword>(raw->ptr()) + offset));
+ RawObject* raw_obj = *reinterpret_cast<RawObject**>(
+ reinterpret_cast<uword>(raw->ptr()) + offset);
+ if (is_canonical) {
+ WriteObjectImpl(raw_obj);
+ } else {
+ WriteObjectRef(raw_obj);
+ }
offset += kWordSize;
}
return;
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698