v8  8.6.395 (node 15.0.1)
V8 is Google's open source JavaScript engine
cppgc Namespace Reference



Data Structures

class  MakeGarbageCollectedTraitBase
class  MakeGarbageCollectedTrait
struct  PostConstructionCallbackTrait
struct  CustomSpaceIndex
class  CustomSpaceBase
class  CustomSpace
struct  SpaceTrait
class  DefaultTaskRunner
class  DefaultPlatform
class  GarbageCollected
class  GarbageCollectedMixin
class  Heap
class  LivenessBroker
class  Platform
class  SourceLocation
struct  TraceDescriptor
struct  TraceTrait
class  Visitor
struct  TraceTrait< v8::JSMember< T > >


template<typename T >
using Member = internal::BasicMember< T, internal::StrongMemberTag, internal::DijkstraWriteBarrierPolicy >
template<typename T >
using WeakMember = internal::BasicMember< T, internal::WeakMemberTag, internal::DijkstraWriteBarrierPolicy >
template<typename T >
using UntracedMember = internal::BasicMember< T, internal::UntracedMemberTag, internal::NoWriteBarrierPolicy >
template<typename T >
using Persistent = internal::BasicPersistent< T, internal::StrongPersistentPolicy >
template<typename T >
using WeakPersistent = internal::BasicPersistent< T, internal::WeakPersistentPolicy >
using IdleTask = v8::IdleTask
using JobHandle = v8::JobHandle
using JobDelegate = v8::JobDelegate
using JobTask = v8::JobTask
using PageAllocator = v8::PageAllocator
using Task = v8::Task
using TaskPriority = v8::TaskPriority
using TaskRunner = v8::TaskRunner
using TraceCallback = void(*)(Visitor *visitor, const void *object)
using WeakCallback = void(*)(const LivenessBroker &, const void *)


enum class  EmbedderStackState {
  kMayContainHeapPointers , kNoHeapPointers , V8_ENUM_DEPRECATE_SOON , V8_ENUM_DEPRECATE_SOON ,
  V8_ENUM_DEPRECATE_SOON =("Use kNoHeapPointers") = kNoHeapPointers


template<typename T , typename... Args>
T * MakeGarbageCollected (AllocationHandle &handle, Args &&... args)
V8_EXPORT void InitializeProcess (PageAllocator *)
V8_EXPORT void ShutdownProcess ()


constexpr internal::SentinelPointer kSentinelPointer
template<typename T >
constexpr bool IsWeakV = internal::IsWeak<T>::value

Detailed Description

cppgc - A C++ garbage collection library.

Typedef Documentation

◆ IdleTask

Definition at line 15 of file platform.h.

◆ JobDelegate

Definition at line 17 of file platform.h.

◆ JobHandle

Definition at line 16 of file platform.h.

◆ JobTask

Definition at line 18 of file platform.h.

◆ Member

using Member = internal::BasicMember<T, internal::StrongMemberTag, internal::DijkstraWriteBarrierPolicy>

Members are used in classes to contain strong pointers to other garbage collected objects. All Member fields of a class must be traced in the class' trace method.

Definition at line 199 of file member.h.

◆ PageAllocator

Definition at line 19 of file platform.h.

◆ Persistent

Persistent is a way to create a strong pointer from an off-heap object to another on-heap object. As long as the Persistent handle is alive the GC will keep the object pointed to alive. The Persistent handle is always a GC root from the point of view of the GC. Persistent must be constructed and destructed in the same thread.

Definition at line 326 of file persistent.h.

◆ Task

using Task = v8::Task

Definition at line 20 of file platform.h.

◆ TaskPriority

Definition at line 21 of file platform.h.

◆ TaskRunner

Definition at line 22 of file platform.h.

◆ TraceCallback

using TraceCallback = void (*)(Visitor* visitor, const void* object)

Callback for invoking tracing on a given object.

visitorThe visitor to dispatch to.
objectThe object to invoke tracing on.

Definition at line 34 of file trace-trait.h.

◆ UntracedMember

using UntracedMember = internal::BasicMember<T, internal::UntracedMemberTag, internal::NoWriteBarrierPolicy>

UntracedMember is a pointer to an on-heap object that is not traced for some reason. Do not use this unless you know what you are doing. Keeping raw pointers to on-heap objects is prohibited unless used from stack. Pointee must be kept alive through other means.

Definition at line 221 of file member.h.

◆ WeakCallback

using WeakCallback = void (*)(const LivenessBroker&, const void*)

Definition at line 28 of file visitor.h.

◆ WeakMember

WeakMember is similar to Member in that it is used to point to other garbage collected objects. However instead of creating a strong pointer to the object, the WeakMember creates a weak pointer, which does not keep the pointee alive. Hence if all pointers to to a heap allocated object are weak the object will be garbage collected. At the time of GC the weak pointers will automatically be set to null.

Definition at line 211 of file member.h.

◆ WeakPersistent

WeakPersistent is a way to create a weak pointer from an off-heap object to an on-heap object. The pointer is automatically cleared when the pointee gets collected. WeakPersistent must be constructed and destructed in the same thread.

Definition at line 336 of file persistent.h.

Enumeration Type Documentation

◆ EmbedderStackState

enum EmbedderStackState

Definition at line 14 of file common.h.

Function Documentation

◆ InitializeProcess()

V8_EXPORT void cppgc::InitializeProcess ( PageAllocator )

Process-global initialization of the garbage collector. Must be called before creating a Heap.

◆ MakeGarbageCollected()

T* cppgc::MakeGarbageCollected ( AllocationHandle &  handle,
Args &&...  args 

Constructs a managed object of type T where T transitively inherits from GarbageCollected.

argsList of arguments with which an instance of T will be constructed.
an instance of type T.

Definition at line 164 of file allocation.h.

◆ ShutdownProcess()

V8_EXPORT void cppgc::ShutdownProcess ( )

Must be called after destroying the last used heap.

Variable Documentation

◆ IsWeakV

constexpr bool IsWeakV = internal::IsWeak<T>::value

Definition at line 105 of file type-traits.h.

◆ kSentinelPointer

constexpr internal::SentinelPointer kSentinelPointer

Definition at line 130 of file pointer-policies.h.

Referenced by LivenessBroker::IsHeapObjectAlive(), and Visitor::Trace().