cppgc: Add AccessMode template to DynamicallyMarkAddress

This will be needed later for concurrent marking

Bug: chromium:1056170
Change-Id: Iab7812d7ac8a30e3a54bd7c4b739077b293db775
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2287869
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68796}
This commit is contained in:
Omer Katz 2020-07-10 14:54:17 +02:00 committed by Commit Bot
parent 907270528c
commit b98a183171

View File

@ -31,6 +31,8 @@ class MarkingState {
inline bool MarkNoPush(HeapObjectHeader&);
template <
HeapObjectHeader::AccessMode = HeapObjectHeader::AccessMode::kNonAtomic>
inline void DynamicallyMarkAddress(ConstAddress);
inline void RegisterWeakReferenceIfNeeded(const void*, TraceDescriptor,
@ -95,15 +97,17 @@ bool MarkingState::MarkNoPush(HeapObjectHeader& header) {
return header.TryMarkAtomic();
}
template <HeapObjectHeader::AccessMode mode>
void MarkingState::DynamicallyMarkAddress(ConstAddress address) {
HeapObjectHeader& header =
BasePage::FromPayload(address)->ObjectHeaderFromInnerAddress(
BasePage::FromPayload(address)->ObjectHeaderFromInnerAddress<mode>(
const_cast<Address>(address));
DCHECK(!header.IsInConstruction<HeapObjectHeader::AccessMode::kNonAtomic>());
DCHECK(!header.IsInConstruction<mode>());
if (MarkNoPush(header)) {
marking_worklist_.Push(
{reinterpret_cast<void*>(header.Payload()),
GlobalGCInfoTable::GCInfoFromIndex(header.GetGCInfoIndex()).trace});
GlobalGCInfoTable::GCInfoFromIndex(header.GetGCInfoIndex<mode>())
.trace});
}
}