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

[heap] Remove return value from UpdateSlot methods

Remove the return value from various UpdateSlot methods. These methods
were always returning REMOVE_SLOT anyways.

Bug: v8:11708
Change-Id: I5398f0df14e93e3e74a13aea42d7c422ffc100a0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3793384Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82061}
parent 84179d10
...@@ -3531,8 +3531,7 @@ MaybeObject MakeSlotValue<FullMaybeObjectSlot, HeapObjectReferenceType::STRONG>( ...@@ -3531,8 +3531,7 @@ MaybeObject MakeSlotValue<FullMaybeObjectSlot, HeapObjectReferenceType::STRONG>(
template <AccessMode access_mode, HeapObjectReferenceType reference_type, template <AccessMode access_mode, HeapObjectReferenceType reference_type,
typename TSlot> typename TSlot>
static inline SlotCallbackResult UpdateSlot(PtrComprCageBase cage_base, static inline void UpdateSlot(PtrComprCageBase cage_base, TSlot slot,
TSlot slot,
typename TSlot::TObject old, typename TSlot::TObject old,
HeapObject heap_obj) { HeapObject heap_obj) {
static_assert(std::is_same<TSlot, FullObjectSlot>::value || static_assert(std::is_same<TSlot, FullObjectSlot>::value ||
...@@ -3565,48 +3564,43 @@ static inline SlotCallbackResult UpdateSlot(PtrComprCageBase cage_base, ...@@ -3565,48 +3564,43 @@ static inline SlotCallbackResult UpdateSlot(PtrComprCageBase cage_base,
} else { } else {
DCHECK(MarkCompactCollector::IsMapOrForwarded(map_word.ToMap())); DCHECK(MarkCompactCollector::IsMapOrForwarded(map_word.ToMap()));
} }
return REMOVE_SLOT;
} }
template <AccessMode access_mode, typename TSlot> template <AccessMode access_mode, typename TSlot>
static inline SlotCallbackResult UpdateSlot(PtrComprCageBase cage_base, static inline void UpdateSlot(PtrComprCageBase cage_base, TSlot slot) {
TSlot slot) {
typename TSlot::TObject obj = slot.Relaxed_Load(cage_base); typename TSlot::TObject obj = slot.Relaxed_Load(cage_base);
HeapObject heap_obj; HeapObject heap_obj;
if (TSlot::kCanBeWeak && obj->GetHeapObjectIfWeak(&heap_obj)) { if (TSlot::kCanBeWeak && obj->GetHeapObjectIfWeak(&heap_obj)) {
UpdateSlot<access_mode, HeapObjectReferenceType::WEAK>(cage_base, slot, obj, UpdateSlot<access_mode, HeapObjectReferenceType::WEAK>(cage_base, slot, obj,
heap_obj); heap_obj);
} else if (obj->GetHeapObjectIfStrong(&heap_obj)) { } else if (obj->GetHeapObjectIfStrong(&heap_obj)) {
return UpdateSlot<access_mode, HeapObjectReferenceType::STRONG>( UpdateSlot<access_mode, HeapObjectReferenceType::STRONG>(cage_base, slot,
cage_base, slot, obj, heap_obj); obj, heap_obj);
} }
return REMOVE_SLOT;
} }
template <AccessMode access_mode, typename TSlot> template <AccessMode access_mode, typename TSlot>
static inline SlotCallbackResult UpdateStrongSlot(PtrComprCageBase cage_base, static inline void UpdateStrongSlot(PtrComprCageBase cage_base, TSlot slot) {
TSlot slot) {
typename TSlot::TObject obj = slot.Relaxed_Load(cage_base); typename TSlot::TObject obj = slot.Relaxed_Load(cage_base);
DCHECK(!HAS_WEAK_HEAP_OBJECT_TAG(obj.ptr())); DCHECK(!HAS_WEAK_HEAP_OBJECT_TAG(obj.ptr()));
HeapObject heap_obj; HeapObject heap_obj;
if (obj.GetHeapObject(&heap_obj)) { if (obj.GetHeapObject(&heap_obj)) {
return UpdateSlot<access_mode, HeapObjectReferenceType::STRONG>( UpdateSlot<access_mode, HeapObjectReferenceType::STRONG>(cage_base, slot,
cage_base, slot, obj, heap_obj); obj, heap_obj);
} }
return REMOVE_SLOT;
} }
template <AccessMode access_mode> template <AccessMode access_mode>
static inline SlotCallbackResult UpdateStrongCodeSlot( static inline void UpdateStrongCodeSlot(HeapObject host,
HeapObject host, PtrComprCageBase cage_base, PtrComprCageBase cage_base,
PtrComprCageBase code_cage_base, CodeObjectSlot slot) { PtrComprCageBase code_cage_base,
CodeObjectSlot slot) {
Object obj = slot.Relaxed_Load(code_cage_base); Object obj = slot.Relaxed_Load(code_cage_base);
DCHECK(!HAS_WEAK_HEAP_OBJECT_TAG(obj.ptr())); DCHECK(!HAS_WEAK_HEAP_OBJECT_TAG(obj.ptr()));
HeapObject heap_obj; HeapObject heap_obj;
if (obj.GetHeapObject(&heap_obj)) { if (obj.GetHeapObject(&heap_obj)) {
SlotCallbackResult result = UpdateSlot<access_mode, HeapObjectReferenceType::STRONG>(cage_base, slot,
UpdateSlot<access_mode, HeapObjectReferenceType::STRONG>( obj, heap_obj);
cage_base, slot, obj, heap_obj);
CodeDataContainer code_data_container = CodeDataContainer code_data_container =
CodeDataContainer::cast(HeapObject::FromAddress( CodeDataContainer::cast(HeapObject::FromAddress(
...@@ -3614,9 +3608,7 @@ static inline SlotCallbackResult UpdateStrongCodeSlot( ...@@ -3614,9 +3608,7 @@ static inline SlotCallbackResult UpdateStrongCodeSlot(
Code code = code_data_container.code(code_cage_base); Code code = code_data_container.code(code_cage_base);
Isolate* isolate_for_sandbox = GetIsolateForSandbox(host); Isolate* isolate_for_sandbox = GetIsolateForSandbox(host);
code_data_container.UpdateCodeEntryPoint(isolate_for_sandbox, code); code_data_container.UpdateCodeEntryPoint(isolate_for_sandbox, code);
return result;
} }
return REMOVE_SLOT;
} }
} // namespace } // namespace
...@@ -3689,29 +3681,29 @@ class PointersUpdatingVisitor final : public ObjectVisitorWithCageBases, ...@@ -3689,29 +3681,29 @@ class PointersUpdatingVisitor final : public ObjectVisitorWithCageBases,
} }
private: private:
static inline SlotCallbackResult UpdateRootSlotInternal( static inline void UpdateRootSlotInternal(PtrComprCageBase cage_base,
PtrComprCageBase cage_base, FullObjectSlot slot) { FullObjectSlot slot) {
return UpdateStrongSlot<AccessMode::NON_ATOMIC>(cage_base, slot); UpdateStrongSlot<AccessMode::NON_ATOMIC>(cage_base, slot);
} }
static inline SlotCallbackResult UpdateRootSlotInternal( static inline void UpdateRootSlotInternal(PtrComprCageBase cage_base,
PtrComprCageBase cage_base, OffHeapObjectSlot slot) { OffHeapObjectSlot slot) {
return UpdateStrongSlot<AccessMode::NON_ATOMIC>(cage_base, slot); UpdateStrongSlot<AccessMode::NON_ATOMIC>(cage_base, slot);
} }
static inline SlotCallbackResult UpdateStrongMaybeObjectSlotInternal( static inline void UpdateStrongMaybeObjectSlotInternal(
PtrComprCageBase cage_base, MaybeObjectSlot slot) { PtrComprCageBase cage_base, MaybeObjectSlot slot) {
return UpdateStrongSlot<AccessMode::NON_ATOMIC>(cage_base, slot); UpdateStrongSlot<AccessMode::NON_ATOMIC>(cage_base, slot);
} }
static inline SlotCallbackResult UpdateStrongSlotInternal( static inline void UpdateStrongSlotInternal(PtrComprCageBase cage_base,
PtrComprCageBase cage_base, ObjectSlot slot) { ObjectSlot slot) {
return UpdateStrongSlot<AccessMode::NON_ATOMIC>(cage_base, slot); UpdateStrongSlot<AccessMode::NON_ATOMIC>(cage_base, slot);
} }
static inline SlotCallbackResult UpdateSlotInternal( static inline void UpdateSlotInternal(PtrComprCageBase cage_base,
PtrComprCageBase cage_base, MaybeObjectSlot slot) { MaybeObjectSlot slot) {
return UpdateSlot<AccessMode::NON_ATOMIC>(cage_base, slot); UpdateSlot<AccessMode::NON_ATOMIC>(cage_base, slot);
} }
}; };
...@@ -4744,9 +4736,12 @@ class RememberedSetUpdatingItem : public UpdatingItem { ...@@ -4744,9 +4736,12 @@ class RememberedSetUpdatingItem : public UpdatingItem {
HeapObject host = HeapObject::FromAddress( HeapObject host = HeapObject::FromAddress(
slot.address() - CodeDataContainer::kCodeOffset); slot.address() - CodeDataContainer::kCodeOffset);
DCHECK(host.IsCodeDataContainer(cage_base)); DCHECK(host.IsCodeDataContainer(cage_base));
return UpdateStrongCodeSlot<AccessMode::NON_ATOMIC>( UpdateStrongCodeSlot<AccessMode::NON_ATOMIC>(
host, cage_base, code_cage_base, host, cage_base, code_cage_base,
CodeObjectSlot(slot.address())); CodeObjectSlot(slot.address()));
// Always keep slot since all slots are dropped at once after
// iteration.
return KEEP_SLOT;
}, },
SlotSet::FREE_EMPTY_BUCKETS); SlotSet::FREE_EMPTY_BUCKETS);
chunk_->ReleaseSlotSet<OLD_TO_CODE>(); chunk_->ReleaseSlotSet<OLD_TO_CODE>();
...@@ -4795,13 +4790,14 @@ class RememberedSetUpdatingItem : public UpdatingItem { ...@@ -4795,13 +4790,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();
UpdateTypedSlotHelper::UpdateTypedSlot( return 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); UpdateStrongSlot<AccessMode::NON_ATOMIC>(cage_base, slot);
}); // Always keep slot since all slots are dropped at once after
// Always keep slot since all slots are dropped at once after iteration. // iteration.
return KEEP_SLOT; return KEEP_SLOT;
}); });
});
chunk_->ReleaseTypedSlotSet<OLD_TO_OLD>(); chunk_->ReleaseTypedSlotSet<OLD_TO_OLD>();
} }
} }
...@@ -5007,7 +5003,8 @@ void MarkCompactCollector::UpdatePointersInClientHeap(Isolate* client) { ...@@ -5007,7 +5003,8 @@ void MarkCompactCollector::UpdatePointersInClientHeap(Isolate* client) {
chunk, chunk,
[cage_base, &filter](MaybeObjectSlot slot) { [cage_base, &filter](MaybeObjectSlot slot) {
if (!filter.IsValid(slot.address())) return REMOVE_SLOT; if (!filter.IsValid(slot.address())) return REMOVE_SLOT;
return UpdateSlot<AccessMode::NON_ATOMIC>(cage_base, slot); UpdateSlot<AccessMode::NON_ATOMIC>(cage_base, slot);
return REMOVE_SLOT;
}, },
SlotSet::FREE_EMPTY_BUCKETS); SlotSet::FREE_EMPTY_BUCKETS);
...@@ -5020,7 +5017,8 @@ void MarkCompactCollector::UpdatePointersInClientHeap(Isolate* client) { ...@@ -5020,7 +5017,8 @@ void MarkCompactCollector::UpdatePointersInClientHeap(Isolate* client) {
PtrComprCageBase cage_base = heap_->isolate(); PtrComprCageBase cage_base = heap_->isolate();
return UpdateTypedSlotHelper::UpdateTypedSlot( return 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); UpdateStrongSlot<AccessMode::NON_ATOMIC>(cage_base, slot);
return REMOVE_SLOT;
}); });
}); });
} }
......
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