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

[heap] Drop old-to-old slots at once after iteration

Removing slots in the Iterate() method performs an atomic CAS operation
on a cell. This is not necessary, we can simply keep slots and drop
the whole SlotSet with all buckets after iteration.

Bug: v8:12760
Change-Id: I6aeb656d21e5fea6f7e15238d4105013c84ffb2a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3574558Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79863}
parent aacd4162
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "src/heap/read-only-heap.h" #include "src/heap/read-only-heap.h"
#include "src/heap/read-only-spaces.h" #include "src/heap/read-only-spaces.h"
#include "src/heap/safepoint.h" #include "src/heap/safepoint.h"
#include "src/heap/slot-set.h"
#include "src/heap/spaces-inl.h" #include "src/heap/spaces-inl.h"
#include "src/heap/sweeper.h" #include "src/heap/sweeper.h"
#include "src/heap/weak-object-worklists.h" #include "src/heap/weak-object-worklists.h"
...@@ -3223,7 +3224,6 @@ static inline SlotCallbackResult UpdateSlot(PtrComprCageBase cage_base, ...@@ -3223,7 +3224,6 @@ static inline SlotCallbackResult UpdateSlot(PtrComprCageBase cage_base,
} else { } else {
DCHECK(MarkCompactCollector::IsMapOrForwardedMap(map_word.ToMap())); DCHECK(MarkCompactCollector::IsMapOrForwardedMap(map_word.ToMap()));
} }
// OLD_TO_OLD slots are always removed after updating.
return REMOVE_SLOT; return REMOVE_SLOT;
} }
...@@ -4399,10 +4399,14 @@ class RememberedSetUpdatingItem : public UpdatingItem { ...@@ -4399,10 +4399,14 @@ class RememberedSetUpdatingItem : public UpdatingItem {
RememberedSet<OLD_TO_OLD>::Iterate( RememberedSet<OLD_TO_OLD>::Iterate(
chunk_, chunk_,
[&filter, cage_base](MaybeObjectSlot slot) { [&filter, cage_base](MaybeObjectSlot slot) {
if (!filter.IsValid(slot.address())) return REMOVE_SLOT; if (filter.IsValid(slot.address())) {
return UpdateSlot<AccessMode::NON_ATOMIC>(cage_base, slot); UpdateSlot<AccessMode::NON_ATOMIC>(cage_base, slot);
}
// Always keep slot since all slots are dropped at once after
// iteration.
return KEEP_SLOT;
}, },
SlotSet::FREE_EMPTY_BUCKETS); SlotSet::KEEP_EMPTY_BUCKETS);
chunk_->ReleaseSlotSet<OLD_TO_OLD>(); chunk_->ReleaseSlotSet<OLD_TO_OLD>();
} }
if ((updating_mode_ == RememberedSetUpdatingMode::ALL) && if ((updating_mode_ == RememberedSetUpdatingMode::ALL) &&
...@@ -4463,11 +4467,14 @@ class RememberedSetUpdatingItem : public UpdatingItem { ...@@ -4463,11 +4467,14 @@ class RememberedSetUpdatingItem : public UpdatingItem {
// Using UpdateStrongSlot is OK here, because there are no weak // Using UpdateStrongSlot is OK here, because there are no weak
// typed slots. // typed slots.
PtrComprCageBase cage_base = heap_->isolate(); PtrComprCageBase cage_base = heap_->isolate();
return UpdateTypedSlotHelper::UpdateTypedSlot( UpdateTypedSlotHelper::UpdateTypedSlot(
heap_, slot_type, slot, [cage_base](FullMaybeObjectSlot slot) { heap_, slot_type, slot, [cage_base](FullMaybeObjectSlot slot) {
return UpdateStrongSlot<AccessMode::NON_ATOMIC>(cage_base, slot); return UpdateStrongSlot<AccessMode::NON_ATOMIC>(cage_base, slot);
}); });
// Always keep slot since all slots are dropped at once after iteration.
return KEEP_SLOT;
}); });
chunk_->ReleaseTypedSlotSet<OLD_TO_OLD>();
} }
} }
......
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