Index: runtime/vm/snapshot.cc |
diff --git a/runtime/vm/snapshot.cc b/runtime/vm/snapshot.cc |
index ce9c5dab691220d6230522628ff07d59a916c364..06720c349c30b721231d889dda9ed3c1d1c5fd37 100644 |
--- a/runtime/vm/snapshot.cc |
+++ b/runtime/vm/snapshot.cc |
@@ -752,6 +752,9 @@ void ImageWriter::WriteROData(WriteStream* stream) { |
uword marked_tags = obj.raw()->ptr()->tags_; |
marked_tags = RawObject::VMHeapObjectTag::update(true, marked_tags); |
marked_tags = RawObject::MarkBit::update(true, marked_tags); |
+#if defined(HASH_IN_OBJECT_HEADER) |
+ marked_tags |= static_cast<uword>(obj.raw()->ptr()->hash_) << 32; |
+#endif |
stream->WriteWord(marked_tags); |
start += sizeof(uword); |
for (uword* cursor = reinterpret_cast<uword*>(start); |
@@ -838,6 +841,11 @@ void AssemblyImageWriter::WriteText(WriteStream* clustered_stream, bool vm) { |
uword marked_tags = insns.raw_ptr()->tags_; |
marked_tags = RawObject::VMHeapObjectTag::update(true, marked_tags); |
marked_tags = RawObject::MarkBit::update(true, marked_tags); |
+#if defined(HASH_IN_OBJECT_HEADER) |
+ // Can't use GetObjectTagsAndHash because the update methods discard the |
+ // high bits. |
+ marked_tags |= static_cast<uword>(insns.raw_ptr()->hash_) << 32; |
+#endif |
WriteWordLiteralText(marked_tags); |
beginning += sizeof(uword); |
@@ -1043,6 +1051,11 @@ void BlobImageWriter::WriteText(WriteStream* clustered_stream, bool vm) { |
uword marked_tags = insns.raw_ptr()->tags_; |
marked_tags = RawObject::VMHeapObjectTag::update(true, marked_tags); |
marked_tags = RawObject::MarkBit::update(true, marked_tags); |
+#if defined(HASH_IN_OBJECT_HEADER) |
+ // Can't use GetObjectTagsAndHash because the update methods discard the |
+ // high bits. |
+ marked_tags |= static_cast<uword>(insns.raw_ptr()->hash_) << 32; |
+#endif |
instructions_blob_stream_.WriteWord(marked_tags); |
beginning += sizeof(uword); |
@@ -1316,11 +1329,20 @@ void SnapshotWriter::WriteObject(RawObject* rawobj) { |
} |
-uword SnapshotWriter::GetObjectTags(RawObject* raw) { |
+uint32_t SnapshotWriter::GetObjectTags(RawObject* raw) { |
return raw->ptr()->tags_; |
} |
+uword SnapshotWriter::GetObjectTagsAndHash(RawObject* raw) { |
+ uword result = raw->ptr()->tags_; |
+#if defined(HASH_IN_OBJECT_HEADER) |
+ result |= static_cast<uword>(raw->ptr()->hash_) << 32; |
+#endif |
+ return result; |
+} |
+ |
+ |
#define VM_OBJECT_CLASS_LIST(V) \ |
V(OneByteString) \ |
V(TwoByteString) \ |
@@ -1544,7 +1566,7 @@ void SnapshotWriter::WriteObjectImpl(RawObject* raw, bool as_reference) { |
// When we know that we are dealing with leaf or shallow objects we write |
// these objects inline even when 'as_reference' is true. |
const bool write_as_reference = as_reference && !raw->IsCanonical(); |
- intptr_t tags = raw->ptr()->tags_; |
+ uintptr_t tags = GetObjectTagsAndHash(raw); |
// Add object to the forward ref list and mark it so that future references |
// to this object in the snapshot will use this object id. Mark the |
@@ -1621,7 +1643,7 @@ class WriteInlinedObjectVisitor : public ObjectVisitor { |
virtual void VisitObject(RawObject* obj) { |
intptr_t object_id = writer_->forward_list_->FindObject(obj); |
ASSERT(object_id != kInvalidIndex); |
- intptr_t tags = writer_->GetObjectTags(obj); |
+ intptr_t tags = MessageWriter::GetObjectTagsAndHash(obj); |
writer_->WriteMarkedObjectImpl(obj, tags, object_id, kAsInlinedObject); |
} |
@@ -1786,7 +1808,7 @@ RawFunction* SnapshotWriter::IsSerializableClosure(RawClosure* closure) { |
RawClass* SnapshotWriter::GetFunctionOwner(RawFunction* func) { |
RawObject* owner = func->ptr()->owner_; |
- uword tags = GetObjectTags(owner); |
+ uint32_t tags = GetObjectTags(owner); |
intptr_t class_id = RawObject::ClassIdTag::decode(tags); |
if (class_id == kClassCid) { |
return reinterpret_cast<RawClass*>(owner); |