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

Unified Diff: runtime/vm/dart_api_message.cc

Issue 387993007: 5% smaller snapshots by omitting object ids when possible (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 5 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/dart_api_message.h ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_message.cc
===================================================================
--- runtime/vm/dart_api_message.cc (revision 38170)
+++ runtime/vm/dart_api_message.cc (working copy)
@@ -380,6 +380,11 @@
}
+intptr_t ApiMessageReader::NextAvailableObjectId() const {
+ return backward_references_.length() + kMaxPredefinedObjectIds;
+}
+
+
Dart_CObject* ApiMessageReader::ReadObjectRef() {
int64_t value64 = Read<int64_t>();
if ((value64 & kSmiTagMask) == 0) {
@@ -402,10 +407,14 @@
// Read the class header information and lookup the class.
intptr_t class_header = ReadIntptrValue();
+ intptr_t object_id = SerializedHeaderData::decode(value);
+ if (object_id == kOmittedObjectId) {
+ object_id = NextAvailableObjectId();
+ }
+
// Reading of regular dart instances has limited support in order to
// read typed data views.
if (SerializedHeaderData::decode(class_header) == kInstanceObjectId) {
- intptr_t object_id = SerializedHeaderData::decode(value);
Dart_CObject_Internal* object =
AllocateDartCObjectInternal(Dart_CObject_Internal::kUninitialized);
AddBackRef(object_id, object, kIsNotDeserialized);
@@ -416,7 +425,6 @@
return object;
}
ASSERT((class_header & kSmiTagMask) != 0);
- intptr_t object_id = SerializedHeaderData::decode(value);
intptr_t class_id = LookupInternalClass(class_header);
if ((class_id == kArrayCid) || (class_id == kImmutableArrayCid)) {
ASSERT(GetBackRef(object_id) == NULL);
@@ -751,7 +759,12 @@
return ReadIndexedObject(SerializedHeaderData::decode(value));
}
ASSERT(SerializedHeaderTag::decode(value) == kInlined);
- return ReadInlinedObject(SerializedHeaderData::decode(value));
+
+ intptr_t object_id = SerializedHeaderData::decode(value);
+ if (object_id == kOmittedObjectId) {
+ object_id = NextAvailableObjectId();
+ }
+ return ReadInlinedObject(object_id);
}
« no previous file with comments | « runtime/vm/dart_api_message.h ('k') | runtime/vm/snapshot.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698