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

Unified Diff: vm/raw_object_snapshot.cc

Issue 10917222: Move all the closure related fields in RawFunction into a new class (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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 | « vm/raw_object.cc ('k') | vm/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vm/raw_object_snapshot.cc
===================================================================
--- vm/raw_object_snapshot.cc (revision 12230)
+++ vm/raw_object_snapshot.cc (working copy)
@@ -465,6 +465,54 @@
}
+RawClosureData* ClosureData::ReadFrom(SnapshotReader* reader,
+ intptr_t object_id,
+ intptr_t tags,
+ Snapshot::Kind kind) {
+ ASSERT(reader != NULL);
+ ASSERT((kind != Snapshot::kMessage) &&
+ !RawObject::IsCreatedFromSnapshot(tags));
+
+ // Allocate closure data object.
+ ClosureData& data = ClosureData::ZoneHandle(
+ reader->isolate(), NEW_OBJECT(ClosureData));
+ reader->AddBackRef(object_id, &data, kIsDeserialized);
+
+ // Set the object tags.
+ data.set_tags(tags);
+
+ // Set all the object fields.
+ // TODO(5411462): Need to assert No GC can happen here, even though
+ // allocations may happen.
+ intptr_t num_flds = (data.raw()->to() - data.raw()->from());
+ for (intptr_t i = 0; i <= num_flds; i++) {
+ *(data.raw()->from() + i) = reader->ReadObjectRef();
+ }
+
+ return data.raw();
+}
+
+
+void RawClosureData::WriteTo(SnapshotWriter* writer,
+ intptr_t object_id,
+ Snapshot::Kind kind) {
+ ASSERT(writer != NULL);
+ ASSERT((kind != Snapshot::kMessage) &&
+ !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)));
+
+ // Write out the serialization header value for this object.
+ writer->WriteInlinedObjectHeader(object_id);
+
+ // Write out the class and tags information.
+ writer->WriteVMIsolateObject(kClosureDataCid);
+ writer->WriteIntptrValue(writer->GetObjectTags(this));
+
+ // Write out all the object pointer fields.
+ SnapshotWriterVisitor visitor(writer);
+ visitor.VisitPointers(from(), to());
+}
+
+
RawFunction* Function::ReadFrom(SnapshotReader* reader,
intptr_t object_id,
intptr_t tags,
« no previous file with comments | « vm/raw_object.cc ('k') | vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698