[vm] Abstract out object header initialization.
Previously there were two separate implementations of the same initialization code, one in object.cc and one in interpreter.cc. Now they both use Object::InitializeHeader. Make TryAllocate a static method of Interpreter instead of a file-local function in interpreter.cc so that it gets access to the private method Object::InitializeHeader. TEST=ci (just code refactoring) Cq-Include-Trybots: luci.dart.try:vm-dyn-linux-debug-x64-try,vm-aot-dyn-linux-product-x64-try Change-Id: I4e042fbf0db84e02c88f7ca0f3e025723660001b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/476120 Reviewed-by: Alexander Markov <alexmarkov@google.com> Commit-Queue: Tess Strickland <sstrickl@google.com>
This commit is contained in:
committed by
Commit Queue
parent
062382a80a
commit
62b145efbb
+1
-19
@@ -2966,25 +2966,7 @@ void Object::InitializeObject(uword address,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
uword tags = 0;
|
||||
ASSERT(class_id != kIllegalCid);
|
||||
tags = UntaggedObject::ClassIdTag::update(class_id, tags);
|
||||
tags = UntaggedObject::SizeTag::update(size, tags);
|
||||
const bool is_old =
|
||||
(address & kNewObjectAlignmentOffset) == kOldObjectAlignmentOffset;
|
||||
tags = UntaggedObject::AlwaysSetBit::update(true, tags);
|
||||
tags = UntaggedObject::NotMarkedBit::update(true, tags);
|
||||
tags = UntaggedObject::OldAndNotRememberedBit::update(is_old, tags);
|
||||
tags = UntaggedObject::NewOrEvacuationCandidateBit::update(!is_old, tags);
|
||||
tags = UntaggedObject::ShallowImmutableBit::update(
|
||||
Object::ShouldHaveShallowImmutabilityBitSet(class_id), tags);
|
||||
tags = UntaggedObject::DeeplyImmutableBit::update(
|
||||
Object::ShouldHaveDeeplyImmutabilityBitSet(class_id), tags);
|
||||
#if defined(HASH_IN_OBJECT_HEADER)
|
||||
tags = UntaggedObject::HashTag::update(0, tags);
|
||||
#endif
|
||||
|
||||
reinterpret_cast<UntaggedObject*>(address)->tags_ = tags;
|
||||
InitializeHeader(address, class_id, size);
|
||||
#if defined(HOST_HAS_FAST_WRITE_WRITE_FENCE)
|
||||
StoreStoreFence();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user