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

Unified Diff: runtime/vm/snapshot.cc

Issue 1378423002: Support serializing ObjectPool as reference. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/snapshot.cc
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc
index d83606c1ee795c4b25459fe86a7093b0a68129a3..397e669cdbd935a1e5e1631cf98ac2862db9b7d9 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -65,6 +65,7 @@ static bool IsSplitClassId(intptr_t class_id) {
return class_id >= kNumPredefinedCids ||
class_id == kArrayCid ||
class_id == kImmutableArrayCid ||
+ class_id == kObjectPoolCid ||
RawObject::IsImplicitFieldClassId(class_id);
}
@@ -484,6 +485,17 @@ RawObject* SnapshotReader::ReadObjectRef(intptr_t object_id,
return array.raw();
}
+ if (class_id == kObjectPoolCid) {
+ // Read the length and allocate an object based on the len.
+ intptr_t len = Read<intptr_t>();
+ ObjectPool& pool = ObjectPool::ZoneHandle(
+ zone(),
+ (kind_ == Snapshot::kFull) ?
+ NewObjectPool(len) : ObjectPool::New(len));
siva 2015/10/01 21:05:09 ObjectPool should only be serialized in a Full sna
rmacnak 2015/10/01 21:32:48 Done.
+ AddBackRef(object_id, &pool, kIsNotDeserialized);
+
+ return pool.raw();
+ }
// For all other internal VM classes we read the object inline.
switch (class_id) {
@@ -2262,6 +2274,29 @@ void SnapshotWriter::WriteObjectRef(RawObject* raw) {
return;
}
+ if (class_id == kObjectPoolCid) {
+ intptr_t tags = GetObjectTags(raw);
+
+ // Object is being referenced, add it to the forward ref list and mark
+ // it so that future references to this object in the snapshot will use
+ // this object id. Mark it as not having been serialized yet so that we
+ // will serialize the object when we go through the forward list.
+ forward_list_->MarkAndAddObject(raw, kIsNotSerialized);
+
+ RawObjectPool* rawpool = reinterpret_cast<RawObjectPool*>(raw);
+
+ // Write out the serialization header value for this object.
+ WriteInlinedObjectHeader(kOmittedObjectId);
+
+ // Write out the class information.
+ WriteVMIsolateObject(kObjectPoolCid);
+ WriteTags(tags);
+
+ // Write out the length field.
+ Write<intptr_t>(rawpool->ptr()->length_);
+
+ return;
+ }
// Add object to the forward ref list and mark it so that future references
// to this object in the snapshot will use this object id. Mark it as having
// been serialized so that we do not serialize the object when we go through
« no previous file with comments | « runtime/vm/raw_object_snapshot.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698