Commit b98a1831 authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

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: 's avatarMichael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68796}
parent 90727052
......@@ -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});
}
}
......
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