5#ifndef V8_HANDLES_GLOBAL_HANDLES_H_
6#define V8_HANDLES_GLOBAL_HANDLES_H_
35 template <
class NodeType>
42 static void MoveGlobal(Address** from, Address** to);
46 static void Destroy(Address* location);
57 static void MakeWeak(Address* location,
void* parameter,
60 static void MakeWeak(Address** location_addr);
62 static void AnnotateStrongRetainer(Address* location,
const char*
label);
65 static void* ClearWeakness(Address* location);
68 static bool IsWeak(Address* location);
82 size_t InvokeFirstPassWeakCallbacks();
83 void InvokeSecondPassPhantomCallbacks();
95 void IterateWeakRootsForPhantomHandles(
104 void IterateYoungStrongAndDependentRoots(
RootVisitor* v);
113 void UpdateListOfYoungNodes();
116 void ClearListOfYoungNodes();
120 size_t TotalSize()
const;
121 size_t UsedSize()
const;
123 size_t handles_count()
const;
133 bool HasYoung()
const {
return !young_nodes_.empty(); }
138 template <
class BlockType>
140 template <
class NodeType>
151 bool ResetWeakNodeIfDead(
Node* node,
160 std::vector<std::pair<Node*, PendingPhantomCallback>>
163 bool second_pass_callbacks_task_posted_ =
false;
164 size_t last_gc_custom_callbacks_ = 0;
257 std::vector<Address, StrongRootAllocator<Address>>::iterator
it_;
281 std::vector<Address, StrongRootAllocator<Address>>
locations_;
void(*)(const WeakCallbackInfo< T > &data) Callback
size_t handles_count() const
std::vector< Address * > blocks_
IndirectHandle< Object > Get(int index)
EternalHandles & operator=(const EternalHandles &)=delete
EternalHandles(const EternalHandles &)=delete
static const int kInvalidIndex
V8_EXPORT_PRIVATE void Create(Isolate *isolate, Tagged< Object > object, int *index)
std::vector< int > young_node_indices_
void IterateAllRoots(RootVisitor *visitor)
void PostGarbageCollectionProcessing()
void IterateYoungRoots(RootVisitor *visitor)
Address * GetLocation(int index)
bool operator!=(const Iterator &that) const
IndirectHandle< T > operator*()
Iterator(std::vector< Address, StrongRootAllocator< Address > >::iterator it)
bool operator==(const Iterator &that) const
std::vector< Address, StrongRootAllocator< Address > >::iterator it_
std::vector< Address, StrongRootAllocator< Address > > locations_
IndirectHandle< T > operator[](size_t i)
GlobalHandleVector(Heap *heap)
void Push(Tagged< T > val)
void Reserve(size_t size)
void * embedder_fields_[v8::kEmbedderFieldsInWeakCallback]
void Invoke(Isolate *isolate, InvocationType type)
Data::Callback callback() const
PendingPhantomCallback(Data::Callback callback, void *parameter, void *embedder_fields[v8::kEmbedderFieldsInWeakCallback])
static void MakeWeak(Address *location, void *parameter, WeakCallbackInfo< void >::Callback weak_callback, v8::WeakCallbackType type)
std::unique_ptr< NodeSpace< Node > > regular_nodes_
Isolate * isolate() const
std::vector< std::pair< Node *, PendingPhantomCallback > > pending_phantom_callbacks_
std::vector< PendingPhantomCallback > second_pass_callbacks_
std::vector< Node * > young_nodes_
GlobalHandles & operator=(const GlobalHandles &)=delete
GlobalHandles(const GlobalHandles &)=delete
size_t last_gc_custom_callbacks() const
V8_INLINE constexpr StorageType ptr() const
V8_INLINE constexpr bool IsWeak(TaggedImpl< HeapObjectReferenceType::WEAK, StorageType > obj)
Handle< T > IndirectHandle
bool(*)(Heap *heap, FullObjectSlot pointer) WeakSlotCallbackWithHeap
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
static constexpr int kEmbedderFieldsInWeakCallback
#define DCHECK(condition)
#define V8_EXPORT_PRIVATE