heap: Fix --minor-mc ephemeron processing

Minor MC does not support processing the specialized remembered set
for ephemeron tables.

Temporarily delegate to the regular write barrier for correctness
until the other barrier is supported.

Bug: v8:12262
Change-Id: Iad74b27f8738237dcc1e146b2df3aa6ed8c9a505
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3195895
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77170}
This commit is contained in:
Michael Lippautz 2021-09-30 15:12:04 +02:00 committed by V8 LUCI CQ
parent 2ae6cda1ee
commit 46088a2838
2 changed files with 15 additions and 5 deletions

View File

@ -7087,11 +7087,18 @@ void Heap::GenerationalBarrierSlow(HeapObject object, Address slot,
void Heap::RecordEphemeronKeyWrite(EphemeronHashTable table, Address slot) {
DCHECK(ObjectInYoungGeneration(HeapObjectSlot(slot).ToHeapObject()));
if (FLAG_minor_mc) {
// Minor MC lacks support for specialized generational ephemeron barriers.
// The regular write barrier works as well but keeps more memory alive.
MemoryChunk* chunk = MemoryChunk::FromHeapObject(table);
RememberedSet<OLD_TO_NEW>::Insert<AccessMode::NON_ATOMIC>(chunk, slot);
} else {
int slot_index = EphemeronHashTable::SlotToIndex(table.address(), slot);
InternalIndex entry = EphemeronHashTable::IndexToEntry(slot_index);
auto it =
ephemeron_remembered_set_.insert({table, std::unordered_set<int>()});
it.first->second.insert(entry.as_int());
}
}
void Heap::EphemeronKeyWriteBarrierFromCode(Address raw_object,

View File

@ -4797,6 +4797,9 @@ class MinorMarkCompactCollector::RootMarkingVisitor : public RootVisitor {
};
void MinorMarkCompactCollector::CollectGarbage() {
// Minor MC does not support processing the ephemeron remembered set.
DCHECK(heap()->ephemeron_remembered_set_.empty());
{
TRACE_GC(heap()->tracer(), GCTracer::Scope::MINOR_MC_SWEEPING);
heap()->mark_compact_collector()->sweeper()->EnsureIterabilityCompleted();