5#ifndef INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_
6#define INCLUDE_CPPGC_INTERNAL_PERSISTENT_NODE_H_
20class FatalOutOfMemoryHandler;
57 trace_(root_visitor,
owner_);
60 bool IsUsed()
const {
return trace_; }
79 using PersistentNodeSlots = std::array<PersistentNode, 256u>;
101 node = free_list_head_;
114 free_list_head_ = node;
123 template <
typename PersistentBaseClass>
126 void RefillFreeList();
128 std::vector<std::unique_ptr<PersistentNodeSlots>> nodes_;
130 size_t nodes_in_use_ = 0;
131 const FatalOutOfMemoryHandler& oom_handler_;
141 const FatalOutOfMemoryHandler& oom_handler)
167 bool IsCreationThread();
169 const HeapBase& heap_;
void Iterate(RootVisitor &)
CrossThreadPersistentRegion(const CrossThreadPersistentRegion &)=delete
size_t NodesInUse() const
~CrossThreadPersistentRegion()
V8_INLINE PersistentNode * AllocateNode(void *owner, TraceRootCallback trace)
CrossThreadPersistentRegion(const FatalOutOfMemoryHandler &)
CrossThreadPersistentRegion & operator=(const CrossThreadPersistentRegion &)=delete
V8_INLINE void FreeNode(PersistentNode *node)
void UpdateOwner(void *owner)
PersistentNode(const PersistentNode &)=delete
void Trace(RootVisitor &root_visitor) const
PersistentNode * FreeListNext() const
void InitializeAsUsedNode(void *owner, TraceRootCallback trace)
void InitializeAsFreeNode(PersistentNode *next)
PersistentNode & operator=(const PersistentNode &)=delete
void Iterate(RootVisitor &)
PersistentRegionBase(const FatalOutOfMemoryHandler &oom_handler)
size_t NodesInUse() const
PersistentNode * RefillFreeListAndAllocateNode(void *owner, TraceRootCallback trace)
PersistentRegionBase & operator=(const PersistentRegionBase &)=delete
PersistentRegionBase(const PersistentRegionBase &)=delete
void FreeNode(PersistentNode *node)
friend class CrossThreadPersistentRegion
PersistentNode * TryAllocateNodeFromFreeList(void *owner, TraceRootCallback trace)
~PersistentRegion()=default
PersistentRegion & operator=(const PersistentRegion &)=delete
V8_INLINE PersistentRegion(const HeapBase &heap, const FatalOutOfMemoryHandler &oom_handler)
V8_INLINE PersistentNode * AllocateNode(void *owner, TraceRootCallback trace)
PersistentRegion(const PersistentRegion &)=delete
V8_INLINE void FreeNode(PersistentNode *node)
static void AssertLocked()
#define CPPGC_DCHECK(condition)
#define CPPGC_CHECK(condition)
void(*)(RootVisitor &, const void *object) TraceRootCallback
#define V8_LIKELY(condition)