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); |