Index: runtime/vm/raw_object_snapshot.cc |
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc |
index c2448a3274a2b1662aba1ff95b3cbeebeed8ccbc..b75701ac1a51ed6519d487127abe4633a1e91091 100644 |
--- a/runtime/vm/raw_object_snapshot.cc |
+++ b/runtime/vm/raw_object_snapshot.cc |
@@ -2081,6 +2081,58 @@ void RawBigint::WriteTo(SnapshotWriter* writer, |
} |
+RawFraction* Fraction::ReadFrom(SnapshotReader* reader, |
+ intptr_t object_id, |
+ intptr_t tags, |
+ Snapshot::Kind kind, |
+ bool as_reference) { |
+ ASSERT(reader != NULL); |
+ |
+ // Allocate fraction object. |
+ Fraction& obj = Fraction::ZoneHandle(reader->zone(), NEW_OBJECT(Fraction)); |
+ reader->AddBackRef(object_id, &obj, kIsDeserialized); |
+ |
+ // Set all the object fields. |
+ READ_OBJECT_FIELDS(obj, obj.raw()->from(), obj.raw()->to(), kAsInlinedObject); |
+ |
+ // If it is a canonical constant make it one. |
+ // When reading a full snapshot we don't need to canonicalize the object |
+ // as it would already be a canonical object. |
+ // When reading a script snapshot or a message snapshot we always have |
+ // to canonicalize the object. |
+ if (RawObject::IsCanonical(tags)) { |
+ if (Snapshot::IsFull(kind)) { |
+ // Set the canonical bit. |
+ obj.SetCanonical(); |
+ } else { |
+ obj ^= obj.CheckAndCanonicalize(reader->thread(), NULL); |
+ ASSERT(!obj.IsNull()); |
+ ASSERT(obj.IsCanonical()); |
+ } |
+ } |
+ return obj.raw(); |
+} |
+ |
+ |
+void RawFraction::WriteTo(SnapshotWriter* writer, |
+ intptr_t object_id, |
+ Snapshot::Kind kind, |
+ bool as_reference) { |
+ ASSERT(writer != NULL); |
+ |
+ // Write out the serialization header value for this object. |
+ writer->WriteInlinedObjectHeader(object_id); |
+ |
+ // Write out the class and tags information. |
+ writer->WriteIndexedObject(kFractionCid); |
+ writer->WriteTags(writer->GetObjectTags(this)); |
+ |
+ // Write out all the object pointer fields. |
+ SnapshotWriterVisitor visitor(writer, kAsInlinedObject); |
+ visitor.VisitPointers(from(), to()); |
+} |
+ |
+ |
RawDouble* Double::ReadFrom(SnapshotReader* reader, |
intptr_t object_id, |
intptr_t tags, |