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

Unified Diff: runtime/vm/snapshot.cc

Issue 10444059: When generate snapshot use tags_ instead of class_ to store object ids. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 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/snapshot.h ('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 f9f37749579c7e56d9b2bd3c2dfa4b6a0879a2c9..244e2aed25a015c30ef4d853fedc81a4d12b0b2f 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -523,7 +523,7 @@ void SnapshotWriter::WriteObject(RawObject* rawobj) {
// Check if it is a code object in that case just write a Null object
// as we do not want code objects in the snapshot.
- if (rawobj->ptr()->class_ == Object::code_class()) {
+ if (RawObject::ClassTag::decode(GetObjectTags(rawobj)) == kCode) {
WriteIndexedObject(Object::kNullObject);
return;
}
@@ -547,7 +547,7 @@ void SnapshotWriter::UnmarkAll() {
NoGCScope no_gc;
for (intptr_t i = 0; i < forward_list_.length(); i++) {
RawObject* raw = forward_list_[i]->raw();
- raw->ptr()->class_ = forward_list_[i]->cls(); // Restore original class.
+ raw->ptr()->tags_ = forward_list_[i]->tags(); // Restore original class.
siva 2012/05/30 00:35:29 Comment should be restore original tags_ (will bec
}
}
@@ -569,6 +569,17 @@ void SnapshotWriter::WriteFullSnapshot() {
}
+uword SnapshotWriter::GetObjectTags(RawObject* raw) {
+ uword tags = raw->ptr()->tags_;
+ if (SerializedHeaderTag::decode(tags) == kObjectId) {
+ intptr_t id = SerializedHeaderData::decode(tags);
+ return forward_list_[id - kMaxPredefinedObjectIds]->tags();
+ } else {
+ return tags;
+ }
+}
+
+
intptr_t SnapshotWriter::MarkObject(RawObject* raw, RawClass* cls) {
NoGCScope no_gc;
intptr_t object_id = forward_list_.length() + kMaxPredefinedObjectIds;
@@ -576,8 +587,9 @@ intptr_t SnapshotWriter::MarkObject(RawObject* raw, RawClass* cls) {
uword value = 0;
value = SerializedHeaderTag::update(kObjectId, value);
value = SerializedHeaderData::update(object_id, value);
siva 2012/05/30 00:35:29 The SerializedHeaderTag bits collide with the rese
Vyacheslav Egorov (Google) 2012/05/30 07:48:35 Actually there is one change I did not merge from
- raw->ptr()->class_ = reinterpret_cast<RawClass*>(value);
- ForwardObjectNode* node = new ForwardObjectNode(raw, cls);
+ uword tags = raw->ptr()->tags_;
+ raw->ptr()->tags_ = value;
+ ForwardObjectNode* node = new ForwardObjectNode(raw, tags);
ASSERT(node != NULL);
forward_list_.Add(node);
return object_id;
@@ -586,16 +598,18 @@ intptr_t SnapshotWriter::MarkObject(RawObject* raw, RawClass* cls) {
void SnapshotWriter::WriteInlinedObject(RawObject* raw) {
NoGCScope no_gc;
- RawClass* cls = raw->ptr()->class_;
+ uword tags = raw->ptr()->tags_;
// Check if object has already been serialized, in that
// case just write the object id out.
- if (SerializedHeaderTag::decode(reinterpret_cast<uword>(cls)) == kObjectId) {
- intptr_t id = SerializedHeaderData::decode(reinterpret_cast<intptr_t>(cls));
+ if (SerializedHeaderTag::decode(tags) == kObjectId) {
+ intptr_t id = SerializedHeaderData::decode(tags);
WriteIndexedObject(id);
return;
}
+ RawClass* cls = class_table_->At(RawObject::ClassTag::decode(tags));
+
// Object is being serialized, add it to the forward ref list and mark
// it so that future references to this object in the snapshot will use
// an object id, instead of trying to serialize it again.
@@ -617,7 +631,7 @@ void SnapshotWriter::WriteInlinedObject(RawObject* raw) {
WriteIntptrValue(SerializedHeaderData::encode(kInstanceId));
// Write out the tags.
- WriteIntptrValue(raw->ptr()->tags_);
+ WriteIntptrValue(tags);
// Write out the class information for this object.
WriteObject(cls);
« no previous file with comments | « runtime/vm/snapshot.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698