• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2019 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5bitfield struct FinalizationRegistryFlags extends uint31 {
6  scheduled_for_cleanup: bool: 1 bit;
7}
8
9extern class JSFinalizationRegistry extends JSObject {
10  native_context: NativeContext;
11  cleanup: Callable;
12  active_cells: Undefined|WeakCell;
13  cleared_cells: Undefined|WeakCell;
14  key_map: Object;
15  // For the linked list of FinalizationRegistries that need cleanup. This
16  // link is weak.
17  next_dirty: Undefined|JSFinalizationRegistry;
18  flags: SmiTagged<FinalizationRegistryFlags>;
19}
20
21extern class WeakCell extends HeapObject {
22  finalization_registry: Undefined|JSFinalizationRegistry;
23  target: Undefined|JSReceiver|Symbol;
24  unregister_token: Undefined|JSReceiver|Symbol;
25  holdings: JSAny;
26
27  // For storing doubly linked lists of WeakCells in JSFinalizationRegistry's
28  // "active_cells" and "cleared_cells" lists.
29  prev: Undefined|WeakCell;
30  next: Undefined|WeakCell;
31
32  // For storing doubly linked lists of WeakCells per key in
33  // JSFinalizationRegistry's key-based hashmap. The key is the identity hash
34  // of unregister_token. WeakCell also needs to know its token, so that we
35  // can remove its corresponding key from the key_map when we remove the last
36  // WeakCell associated with it or when the unregister_token dies. The
37  // unregister token is stored above, after target, as both are weak.
38  key_list_prev: Undefined|WeakCell;
39  key_list_next: Undefined|WeakCell;
40}
41extern class JSWeakRef extends JSObject {
42  target: Undefined|JSReceiver|Symbol;
43}
44