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

Unified Diff: runtime/vm/snapshot.cc

Issue 9348048: Add support for medium integers to the native message format (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from asiva@ Created 8 years, 10 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') | runtime/vm/snapshot_test.cc » ('j') | 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 43c12dabff90ea8e02ff5f6a992ef2035403b594..881613fa021114f22b5a60a970146eb1d84a072c 100644
--- a/runtime/vm/snapshot.cc
+++ b/runtime/vm/snapshot.cc
@@ -502,11 +502,43 @@ void MessageWriter::UnmarkAllCObjects(Dart_CObject* object) {
}
-void MessageWriter::WriteSmi(int32_t value) {
+void MessageWriter::WriteSmi(int64_t value) {
+ ASSERT(Smi::IsValid64(value));
Write<RawObject*>(Smi::New(value));
}
+void MessageWriter::WriteMint(Dart_CObject* object, int64_t value) {
+ ASSERT(!Smi::IsValid64(value));
+ // Write out the serialization header value for mint object.
+ WriteInlinedHeader(object);
+ // Write out the class and tags information.
+ WriteObjectHeader(ObjectStore::kMintClass, 0);
+ // Write the 64-bit value.
+ Write<int64_t>(value);
+}
+
+
+void MessageWriter::WriteInt32(Dart_CObject* object) {
+ int64_t value = object->value.as_int32;
+ if (Smi::IsValid64(value)) {
+ WriteSmi(value);
+ } else {
+ WriteMint(object, value);
+ }
+}
+
+
+void MessageWriter::WriteInt64(Dart_CObject* object) {
+ int64_t value = object->value.as_int64;
+ if (Smi::IsValid64(value)) {
+ WriteSmi(value);
+ } else {
+ WriteMint(object, value);
+ }
+}
+
+
void MessageWriter::WriteInlinedHeader(Dart_CObject* object) {
// Write out the serialization header value for this object.
WriteSerializationMarker(kInlined, kMaxPredefinedObjectIds + object_id_);
@@ -535,10 +567,12 @@ void MessageWriter::WriteCObject(Dart_CObject* object) {
WriteIndexedObject(ObjectStore::kFalseValue);
}
break;
- case Dart_CObject::kInt32: {
- WriteSmi(object->value.as_int32);
+ case Dart_CObject::kInt32:
+ WriteInt32(object);
+ break;
+ case Dart_CObject::kInt64:
+ WriteInt64(object);
break;
- }
case Dart_CObject::kDouble:
// Write out the serialization header value for this object.
WriteInlinedHeader(object);
« no previous file with comments | « runtime/vm/snapshot.h ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698