Commit 0c04daf8 authored by Shu-yu Guo's avatar Shu-yu Guo Committed by Commit Bot

[weakrefs] Make WeakCell::Nullify's gc callback a template parameter

Nullify is already defined in an -inl.h, so there is no need for the
extra functionality (and overhead) of std::function.

Bug: v8:8179
Change-Id: I0b149a962409503a9fde150aa1241de74870533e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1972426Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65494}
parent cb2090cd
......@@ -172,10 +172,9 @@ Object JSFinalizationGroup::PopClearedCellHoldings(
return weak_cell->holdings();
}
void WeakCell::Nullify(
Isolate* isolate,
std::function<void(HeapObject object, ObjectSlot slot, Object target)>
gc_notify_updated_slot) {
template <typename GCNotifyUpdatedSlotCallback>
void WeakCell::Nullify(Isolate* isolate,
GCNotifyUpdatedSlotCallback gc_notify_updated_slot) {
// Remove from the WeakCell from the "active_cells" list of its
// JSFinalizationGroup and insert it into the "cleared_cells" list. This is
// only called for WeakCells which haven't been unregistered yet, so they will
......
......@@ -86,10 +86,9 @@ class WeakCell : public TorqueGeneratedWeakCell<WeakCell, HeapObject> {
// JSFinalizationGroup. Thus we need to tell the GC about the modified slots
// via the gc_notify_updated_slot function. The normal write barrier is not
// enough, since it's disabled before GC.
inline void Nullify(
Isolate* isolate,
std::function<void(HeapObject object, ObjectSlot slot, Object target)>
gc_notify_updated_slot);
template <typename GCNotifyUpdatedSlotCallback>
inline void Nullify(Isolate* isolate,
GCNotifyUpdatedSlotCallback gc_notify_updated_slot);
inline void RemoveFromFinalizationGroupCells(Isolate* isolate);
......
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