Commit 653e60be authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

heap: Reuse MarkingVisitor::IsInConstruction

Make all calls to header->IsInConstruction go through
MarkingVisitor::IsInConstruction. Having a single call
instead of multiple calls scattered around the code
would make the code easier to maintain (in case we need
to change atomicity for example).

Bug: 986235
Change-Id: Ie386a59737bbcaa9d35c87e1ccc45037729b69c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1885050
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710093}
parent 721a7e3a
......@@ -104,7 +104,7 @@ bool MarkingVisitor::WriteBarrierSlow(void* value) {
if (!header->TryMark<HeapObjectHeader::AccessMode::kAtomic>())
return false;
if (UNLIKELY(header->IsInConstruction())) {
if (UNLIKELY(IsInConstruction(header))) {
// It is assumed that objects on not_fully_constructed_worklist_ are not
// marked.
header->Unmark();
......@@ -149,7 +149,7 @@ MarkingVisitor::MarkingVisitor(ThreadState* state, MarkingMode marking_mode)
void MarkingVisitor::DynamicallyMarkAddress(Address address) {
HeapObjectHeader* const header = HeapObjectHeader::FromInnerAddress(address);
DCHECK(header);
DCHECK(!header->IsInConstruction());
DCHECK(!IsInConstruction(header));
const GCInfo* gc_info =
GCInfoTable::Get().GCInfoFromIndex(header->GcInfoIndex());
MarkHeader(header, gc_info->trace);
......@@ -171,7 +171,7 @@ void MarkingVisitor::ConservativelyMarkAddress(BasePage* page,
// Simple case for fully constructed objects.
const GCInfo* gc_info =
GCInfoTable::Get().GCInfoFromIndex(header->GcInfoIndex());
if (!header->IsInConstruction()) {
if (!IsInConstruction(header)) {
MarkHeader(header, gc_info->trace);
return;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment