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

Unified Diff: runtime/vm/snapshot.cc

Issue 50243004: Fix bug with guarded fields and deserialization. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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
Index: runtime/vm/snapshot.cc
===================================================================
--- runtime/vm/snapshot.cc (revision 29540)
+++ runtime/vm/snapshot.cc (working copy)
@@ -150,6 +150,8 @@
isolate_(isolate),
cls_(Class::Handle()),
obj_(Object::Handle()),
+ array_(Array::Handle()),
+ field_(Field::Handle()),
str_(String::Handle()),
library_(Library::Handle()),
type_(AbstractType::Handle()),
@@ -789,9 +791,21 @@
instance_size = cls_.instance_size();
}
intptr_t offset = Object::InstanceSize();
+ intptr_t result_cid = result->GetClassId();
while (offset < instance_size) {
obj_ = ReadObjectRef();
result->SetFieldAtOffset(offset, obj_);
+ if (kind_ == Snapshot::kMessage) {
+ cls_ = isolate()->class_table()->At(result_cid);
Ivan Posva 2013/11/01 04:50:05 You want to look this up only once and not for eve
Florian Schneider 2013/11/01 10:39:27 Done. Added TODO.
+ array_ = cls_.OffsetToFieldMap();
Ivan Posva 2013/11/01 04:50:05 ditto
Florian Schneider 2013/11/01 10:39:27 Done.
+ field_ ^= array_.At(offset / kWordSize);
Ivan Posva 2013/11/01 04:50:05 offset >> kWordSizeLog2
Florian Schneider 2013/11/01 10:39:27 Done.
+ // Entries can be null because offset can be outside of instance fields
+ // due to rounded allocation size.
+ if (!field_.IsNull()) {
+ ASSERT(field_.Offset() == offset);
+ field_.UpdateGuardedCidAndLength(obj_);
+ }
+ }
Ivan Posva 2013/11/01 04:50:05 We also wanted to assert that when deserializing o
Florian Schneider 2013/11/01 10:39:27 Added TODO. I'll think about how to assert this fo
offset += kWordSize;
}
if (kind_ == Snapshot::kFull) {

Powered by Google App Engine
This is Rietveld 408576698