v8  7.4.288(node12.0.0)
V8 is Google's open source JavaScript engine
EmbedderHeapTracer Class Referenceabstract

#include <v8.h>

Collaboration diagram for EmbedderHeapTracer:

Data Structures

class  TracedGlobalHandleVisitor

Public Types

enum  EmbedderStackState { kUnknown, kNonEmpty, kEmpty }

Public Member Functions

virtual ~EmbedderHeapTracer ()=default
void IterateTracedGlobalHandles (TracedGlobalHandleVisitor *visitor)
virtual void RegisterV8References (const std::vector< std::pair< void *, void * > > &embedder_fields)=0
void RegisterEmbedderReference (const TracedGlobal< v8::Value > &ref)
virtual void TracePrologue ()=0
virtual bool AdvanceTracing (double deadline_in_ms)=0
virtual bool IsTracingDone ()=0
virtual void TraceEpilogue ()=0
virtual void EnterFinalPause (EmbedderStackState stack_state)=0
void FinalizeTracing ()
virtual bool IsRootForNonTracingGC (const v8::TracedGlobal< v8::Value > &handle)
void GarbageCollectionForTesting (EmbedderStackState stack_state)
v8::Isolateisolate () const

Protected Attributes

v8::Isolateisolate_ = nullptr


class internal::LocalEmbedderHeapTracer

Detailed Description

Interface for tracing through the embedder heap. During a V8 garbage collection, V8 collects hidden fields of all potential wrappers, and at the end of its marking phase iterates the collection and asks the embedder to trace through its heap and use reporter to report each JavaScript object reachable from any of the given wrappers.

Definition at line 7215 of file v8.h.

Member Enumeration Documentation

◆ EmbedderStackState


Definition at line 7218 of file v8.h.

Constructor & Destructor Documentation

◆ ~EmbedderHeapTracer()

virtual ~EmbedderHeapTracer ( )

Member Function Documentation

◆ AdvanceTracing()

virtual bool AdvanceTracing ( double  deadline_in_ms)
pure virtual

Called to advance tracing in the embedder.

The embedder is expected to trace its heap starting from wrappers reported by RegisterV8References method, and report back all reachable wrappers. Furthermore, the embedder is expected to stop tracing by the given deadline. A deadline of infinity means that tracing should be finished.

Returns |true| if tracing is done, and false otherwise.

◆ EnterFinalPause()

virtual void EnterFinalPause ( EmbedderStackState  stack_state)
pure virtual

Called upon entering the final marking pause. No more incremental marking steps will follow this call.

◆ FinalizeTracing()

void FinalizeTracing ( )

◆ GarbageCollectionForTesting()

void GarbageCollectionForTesting ( EmbedderStackState  stack_state)

◆ isolate()

v8::Isolate* isolate ( ) const

Definition at line 7321 of file v8.h.

◆ IsRootForNonTracingGC()

virtual bool IsRootForNonTracingGC ( const v8::TracedGlobal< v8::Value > &  handle)

Returns true if the TracedGlobal handle should be considered as root for the currently running non-tracing garbage collection and false otherwise.

Default implementation will keep all TracedGlobal references as roots.

Definition at line 7305 of file v8.h.

◆ IsTracingDone()

virtual bool IsTracingDone ( )
pure virtual

◆ IterateTracedGlobalHandles()

void IterateTracedGlobalHandles ( TracedGlobalHandleVisitor visitor)

Iterates all TracedGlobal handles created for the v8::Isolate the tracer is attached to.

◆ RegisterEmbedderReference()

void RegisterEmbedderReference ( const TracedGlobal< v8::Value > &  ref)

◆ RegisterV8References()

virtual void RegisterV8References ( const std::vector< std::pair< void *, void * > > &  embedder_fields)
pure virtual

Called by v8 to register internal fields of found wrappers.

The embedder is expected to store them somewhere and trace reachable wrappers from them when called through |AdvanceTracing|.

◆ TraceEpilogue()

virtual void TraceEpilogue ( )
pure virtual

Called at the end of a GC cycle.

Note that allocation is not allowed within |TraceEpilogue|.

◆ TracePrologue()

virtual void TracePrologue ( )
pure virtual

Called at the beginning of a GC cycle.

Friends And Related Function Documentation

◆ internal::LocalEmbedderHeapTracer

friend class internal::LocalEmbedderHeapTracer

Definition at line 7326 of file v8.h.

Field Documentation

◆ isolate_

v8::Isolate* isolate_ = nullptr

Definition at line 7324 of file v8.h.

The documentation for this class was generated from the following file: