summaryrefslogtreecommitdiff
path: root/chromium/v8/src/objects/js-weak-refs-inl.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/v8/src/objects/js-weak-refs-inl.h')
-rw-r--r--chromium/v8/src/objects/js-weak-refs-inl.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/chromium/v8/src/objects/js-weak-refs-inl.h b/chromium/v8/src/objects/js-weak-refs-inl.h
index 6632a310025..46f28e883ed 100644
--- a/chromium/v8/src/objects/js-weak-refs-inl.h
+++ b/chromium/v8/src/objects/js-weak-refs-inl.h
@@ -97,16 +97,16 @@ void JSFinalizationGroup::Register(
}
}
-void JSFinalizationGroup::Unregister(
- Handle<JSFinalizationGroup> finalization_group, Handle<Object> key,
- Isolate* isolate) {
+bool JSFinalizationGroup::Unregister(
+ Handle<JSFinalizationGroup> finalization_group,
+ Handle<JSReceiver> unregister_token, Isolate* isolate) {
// Iterate through the doubly linked list of WeakCells associated with the
// key. Each WeakCell will be in the "active_cells" or "cleared_cells" list of
// its FinalizationGroup; remove it from there.
if (!finalization_group->key_map().IsUndefined(isolate)) {
Handle<ObjectHashTable> key_map =
handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
- Object value = key_map->Lookup(key);
+ Object value = key_map->Lookup(unregister_token);
Object undefined = ReadOnlyRoots(isolate).undefined_value();
while (value.IsWeakCell()) {
WeakCell weak_cell = WeakCell::cast(value);
@@ -116,9 +116,13 @@ void JSFinalizationGroup::Unregister(
weak_cell.set_key_list_next(undefined);
}
bool was_present;
- key_map = ObjectHashTable::Remove(isolate, key_map, key, &was_present);
+ key_map = ObjectHashTable::Remove(isolate, key_map, unregister_token,
+ &was_present);
finalization_group->set_key_map(*key_map);
+ return was_present;
}
+
+ return false;
}
bool JSFinalizationGroup::NeedsCleanup() const {