Commit cf6cda0a authored by Dominik Inführ's avatar Dominik Inführ Committed by V8 LUCI CQ

[heap] Rename CLIENT_TO_SHARED rememebered set to OLD_TO_SHARED

Start the implementation of the shared heap write barrier by renaming
CLIENT_TO_SHARED to OLD_TO_SHARED. I planned to do this with the CL
introducing the write barrier but in order to keep that CL smaller do
this here already.

Bug: v8:11708
Change-Id: I204c728e333a4e80c30c0992e43c3cb6752fc660
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3468351Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79163}
parent 824ae14c
...@@ -1244,7 +1244,7 @@ class MarkCompactCollector::SharedHeapObjectVisitor final ...@@ -1244,7 +1244,7 @@ class MarkCompactCollector::SharedHeapObjectVisitor final
if (!object.IsHeapObject()) return; if (!object.IsHeapObject()) return;
HeapObject heap_object = HeapObject::cast(object); HeapObject heap_object = HeapObject::cast(object);
if (!heap_object.InSharedHeap()) return; if (!heap_object.InSharedHeap()) return;
RememberedSet<CLIENT_TO_SHARED>::Insert<AccessMode::NON_ATOMIC>( RememberedSet<OLD_TO_SHARED>::Insert<AccessMode::NON_ATOMIC>(
MemoryChunk::FromHeapObject(host), slot.address()); MemoryChunk::FromHeapObject(host), slot.address());
collector_->MarkRootObject(Root::kClientHeap, heap_object); collector_->MarkRootObject(Root::kClientHeap, heap_object);
} }
...@@ -1253,8 +1253,8 @@ class MarkCompactCollector::SharedHeapObjectVisitor final ...@@ -1253,8 +1253,8 @@ class MarkCompactCollector::SharedHeapObjectVisitor final
HeapObject target) { HeapObject target) {
if (ShouldRecordRelocSlot(host, rinfo, target)) { if (ShouldRecordRelocSlot(host, rinfo, target)) {
RecordRelocSlotInfo info = ProcessRelocInfo(host, rinfo, target); RecordRelocSlotInfo info = ProcessRelocInfo(host, rinfo, target);
RememberedSet<CLIENT_TO_SHARED>::InsertTyped(info.memory_chunk, RememberedSet<OLD_TO_SHARED>::InsertTyped(info.memory_chunk,
info.slot_type, info.offset); info.slot_type, info.offset);
} }
} }
...@@ -3478,7 +3478,7 @@ void MarkCompactCollector::EvacuateEpilogue() { ...@@ -3478,7 +3478,7 @@ void MarkCompactCollector::EvacuateEpilogue() {
// Old-to-old slot sets must be empty after evacuation. // Old-to-old slot sets must be empty after evacuation.
for (Page* p : *heap()->old_space()) { for (Page* p : *heap()->old_space()) {
DCHECK_NULL((p->slot_set<OLD_TO_OLD, AccessMode::ATOMIC>())); DCHECK_NULL((p->slot_set<OLD_TO_OLD, AccessMode::ATOMIC>()));
DCHECK_NULL((p->slot_set<CLIENT_TO_SHARED, AccessMode::NON_ATOMIC>())); DCHECK_NULL((p->slot_set<OLD_TO_SHARED, AccessMode::NON_ATOMIC>()));
DCHECK_NULL((p->typed_slot_set<OLD_TO_OLD, AccessMode::ATOMIC>())); DCHECK_NULL((p->typed_slot_set<OLD_TO_OLD, AccessMode::ATOMIC>()));
DCHECK_NULL(p->invalidated_slots<OLD_TO_OLD>()); DCHECK_NULL(p->invalidated_slots<OLD_TO_OLD>());
DCHECK_NULL(p->invalidated_slots<OLD_TO_NEW>()); DCHECK_NULL(p->invalidated_slots<OLD_TO_NEW>());
...@@ -4648,16 +4648,16 @@ void MarkCompactCollector::UpdatePointersInClientHeap(Isolate* client) { ...@@ -4648,16 +4648,16 @@ void MarkCompactCollector::UpdatePointersInClientHeap(Isolate* client) {
MemoryChunk* chunk = chunk_iterator.Next(); MemoryChunk* chunk = chunk_iterator.Next();
CodePageMemoryModificationScope unprotect_code_page(chunk); CodePageMemoryModificationScope unprotect_code_page(chunk);
RememberedSet<CLIENT_TO_SHARED>::Iterate( RememberedSet<OLD_TO_SHARED>::Iterate(
chunk, chunk,
[cage_base](MaybeObjectSlot slot) { [cage_base](MaybeObjectSlot slot) {
return UpdateSlot<AccessMode::NON_ATOMIC>(cage_base, slot); return UpdateSlot<AccessMode::NON_ATOMIC>(cage_base, slot);
}, },
SlotSet::KEEP_EMPTY_BUCKETS); SlotSet::KEEP_EMPTY_BUCKETS);
chunk->ReleaseSlotSet<CLIENT_TO_SHARED>(); chunk->ReleaseSlotSet<OLD_TO_SHARED>();
RememberedSet<CLIENT_TO_SHARED>::IterateTyped( RememberedSet<OLD_TO_SHARED>::IterateTyped(
chunk, [this](SlotType slot_type, Address slot) { chunk, [this](SlotType slot_type, Address slot) {
// Using UpdateStrongSlot is OK here, because there are no weak // Using UpdateStrongSlot is OK here, because there are no weak
// typed slots. // typed slots.
...@@ -4669,7 +4669,7 @@ void MarkCompactCollector::UpdatePointersInClientHeap(Isolate* client) { ...@@ -4669,7 +4669,7 @@ void MarkCompactCollector::UpdatePointersInClientHeap(Isolate* client) {
}); });
}); });
chunk->ReleaseTypedSlotSet<CLIENT_TO_SHARED>(); chunk->ReleaseTypedSlotSet<OLD_TO_SHARED>();
} }
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP
......
...@@ -27,9 +27,8 @@ class SlotSet; ...@@ -27,9 +27,8 @@ class SlotSet;
enum RememberedSetType { enum RememberedSetType {
OLD_TO_NEW, OLD_TO_NEW,
OLD_TO_OLD, OLD_TO_OLD,
CLIENT_TO_SHARED, OLD_TO_SHARED,
OLD_TO_CODE = OLD_TO_CODE = V8_EXTERNAL_CODE_SPACE_BOOL ? OLD_TO_SHARED + 1 : OLD_TO_SHARED,
V8_EXTERNAL_CODE_SPACE_BOOL ? CLIENT_TO_SHARED + 1 : CLIENT_TO_SHARED,
NUMBER_OF_REMEMBERED_SET_TYPES NUMBER_OF_REMEMBERED_SET_TYPES
}; };
......
...@@ -123,7 +123,7 @@ MemoryChunk* MemoryChunk::Initialize(BasicMemoryChunk* basic_chunk, Heap* heap, ...@@ -123,7 +123,7 @@ MemoryChunk* MemoryChunk::Initialize(BasicMemoryChunk* basic_chunk, Heap* heap,
base::AsAtomicPointer::Release_Store(&chunk->slot_set_[OLD_TO_NEW], nullptr); base::AsAtomicPointer::Release_Store(&chunk->slot_set_[OLD_TO_NEW], nullptr);
base::AsAtomicPointer::Release_Store(&chunk->slot_set_[OLD_TO_OLD], nullptr); base::AsAtomicPointer::Release_Store(&chunk->slot_set_[OLD_TO_OLD], nullptr);
base::AsAtomicPointer::Release_Store(&chunk->slot_set_[CLIENT_TO_SHARED], base::AsAtomicPointer::Release_Store(&chunk->slot_set_[OLD_TO_SHARED],
nullptr); nullptr);
if (V8_EXTERNAL_CODE_SPACE_BOOL) { if (V8_EXTERNAL_CODE_SPACE_BOOL) {
base::AsAtomicPointer::Release_Store(&chunk->slot_set_[OLD_TO_CODE], base::AsAtomicPointer::Release_Store(&chunk->slot_set_[OLD_TO_CODE],
...@@ -134,8 +134,8 @@ MemoryChunk* MemoryChunk::Initialize(BasicMemoryChunk* basic_chunk, Heap* heap, ...@@ -134,8 +134,8 @@ MemoryChunk* MemoryChunk::Initialize(BasicMemoryChunk* basic_chunk, Heap* heap,
nullptr); nullptr);
base::AsAtomicPointer::Release_Store(&chunk->typed_slot_set_[OLD_TO_OLD], base::AsAtomicPointer::Release_Store(&chunk->typed_slot_set_[OLD_TO_OLD],
nullptr); nullptr);
base::AsAtomicPointer::Release_Store( base::AsAtomicPointer::Release_Store(&chunk->typed_slot_set_[OLD_TO_SHARED],
&chunk->typed_slot_set_[CLIENT_TO_SHARED], nullptr); nullptr);
chunk->invalidated_slots_[OLD_TO_NEW] = nullptr; chunk->invalidated_slots_[OLD_TO_NEW] = nullptr;
chunk->invalidated_slots_[OLD_TO_OLD] = nullptr; chunk->invalidated_slots_[OLD_TO_OLD] = nullptr;
if (V8_EXTERNAL_CODE_SPACE_BOOL) { if (V8_EXTERNAL_CODE_SPACE_BOOL) {
...@@ -265,7 +265,7 @@ void MemoryChunk::ReleaseAllAllocatedMemory() { ...@@ -265,7 +265,7 @@ void MemoryChunk::ReleaseAllAllocatedMemory() {
template V8_EXPORT_PRIVATE SlotSet* MemoryChunk::AllocateSlotSet<OLD_TO_NEW>(); template V8_EXPORT_PRIVATE SlotSet* MemoryChunk::AllocateSlotSet<OLD_TO_NEW>();
template V8_EXPORT_PRIVATE SlotSet* MemoryChunk::AllocateSlotSet<OLD_TO_OLD>(); template V8_EXPORT_PRIVATE SlotSet* MemoryChunk::AllocateSlotSet<OLD_TO_OLD>();
template V8_EXPORT_PRIVATE SlotSet* template V8_EXPORT_PRIVATE SlotSet*
MemoryChunk::AllocateSlotSet<CLIENT_TO_SHARED>(); MemoryChunk::AllocateSlotSet<OLD_TO_SHARED>();
#ifdef V8_EXTERNAL_CODE_SPACE #ifdef V8_EXTERNAL_CODE_SPACE
template V8_EXPORT_PRIVATE SlotSet* MemoryChunk::AllocateSlotSet<OLD_TO_CODE>(); template V8_EXPORT_PRIVATE SlotSet* MemoryChunk::AllocateSlotSet<OLD_TO_CODE>();
#endif // V8_EXTERNAL_CODE_SPACE #endif // V8_EXTERNAL_CODE_SPACE
...@@ -293,7 +293,7 @@ SlotSet* MemoryChunk::AllocateSlotSet(SlotSet** slot_set) { ...@@ -293,7 +293,7 @@ SlotSet* MemoryChunk::AllocateSlotSet(SlotSet** slot_set) {
template void MemoryChunk::ReleaseSlotSet<OLD_TO_NEW>(); template void MemoryChunk::ReleaseSlotSet<OLD_TO_NEW>();
template void MemoryChunk::ReleaseSlotSet<OLD_TO_OLD>(); template void MemoryChunk::ReleaseSlotSet<OLD_TO_OLD>();
template void MemoryChunk::ReleaseSlotSet<CLIENT_TO_SHARED>(); template void MemoryChunk::ReleaseSlotSet<OLD_TO_SHARED>();
#ifdef V8_EXTERNAL_CODE_SPACE #ifdef V8_EXTERNAL_CODE_SPACE
template void MemoryChunk::ReleaseSlotSet<OLD_TO_CODE>(); template void MemoryChunk::ReleaseSlotSet<OLD_TO_CODE>();
#endif // V8_EXTERNAL_CODE_SPACE #endif // V8_EXTERNAL_CODE_SPACE
...@@ -316,7 +316,7 @@ void MemoryChunk::ReleaseSlotSet(SlotSet** slot_set) { ...@@ -316,7 +316,7 @@ void MemoryChunk::ReleaseSlotSet(SlotSet** slot_set) {
template TypedSlotSet* MemoryChunk::AllocateTypedSlotSet<OLD_TO_NEW>(); template TypedSlotSet* MemoryChunk::AllocateTypedSlotSet<OLD_TO_NEW>();
template TypedSlotSet* MemoryChunk::AllocateTypedSlotSet<OLD_TO_OLD>(); template TypedSlotSet* MemoryChunk::AllocateTypedSlotSet<OLD_TO_OLD>();
template TypedSlotSet* MemoryChunk::AllocateTypedSlotSet<CLIENT_TO_SHARED>(); template TypedSlotSet* MemoryChunk::AllocateTypedSlotSet<OLD_TO_SHARED>();
template <RememberedSetType type> template <RememberedSetType type>
TypedSlotSet* MemoryChunk::AllocateTypedSlotSet() { TypedSlotSet* MemoryChunk::AllocateTypedSlotSet() {
...@@ -333,7 +333,7 @@ TypedSlotSet* MemoryChunk::AllocateTypedSlotSet() { ...@@ -333,7 +333,7 @@ TypedSlotSet* MemoryChunk::AllocateTypedSlotSet() {
template void MemoryChunk::ReleaseTypedSlotSet<OLD_TO_NEW>(); template void MemoryChunk::ReleaseTypedSlotSet<OLD_TO_NEW>();
template void MemoryChunk::ReleaseTypedSlotSet<OLD_TO_OLD>(); template void MemoryChunk::ReleaseTypedSlotSet<OLD_TO_OLD>();
template void MemoryChunk::ReleaseTypedSlotSet<CLIENT_TO_SHARED>(); template void MemoryChunk::ReleaseTypedSlotSet<OLD_TO_SHARED>();
template <RememberedSetType type> template <RememberedSetType type>
void MemoryChunk::ReleaseTypedSlotSet() { void MemoryChunk::ReleaseTypedSlotSet() {
......
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