v8 10.2.154 (node 18.16.0)
V8 is Google's open source JavaScript engine
|
#include <v8-embedder-heap.h>
Data Structures | |
class | TracedGlobalHandleVisitor |
struct | TraceSummary |
Public Types | |
enum | TraceFlags : uint64_t { kNoFlags = 0 , kReduceMemory = 1 << 0 , kForced = 1 << 2 } |
using | EmbedderStackState = cppgc::EmbedderStackState |
Public Member Functions | |
virtual | ~EmbedderHeapTracer ()=default |
void | IterateTracedGlobalHandles (TracedGlobalHandleVisitor *visitor) |
void | SetStackStart (void *stack_start) |
virtual void | RegisterV8References (const std::vector< std::pair< void *, void * > > &embedder_fields)=0 |
void | RegisterEmbedderReference (const BasicTracedReference< v8::Data > &ref) |
virtual void | TracePrologue (TraceFlags flags) |
virtual bool | AdvanceTracing (double deadline_in_ms)=0 |
virtual bool | IsTracingDone ()=0 |
virtual void | TraceEpilogue (TraceSummary *trace_summary) |
virtual void | EnterFinalPause (EmbedderStackState stack_state)=0 |
void | FinalizeTracing () |
virtual bool | IsRootForNonTracingGC (const v8::TracedReference< v8::Value > &handle) |
virtual void | ResetHandleInNonTracingGC (const v8::TracedReference< v8::Value > &handle) |
void | IncreaseAllocatedSize (size_t bytes) |
void | DecreaseAllocatedSize (size_t bytes) |
v8::Isolate * | isolate () const |
Protected Attributes | |
v8::Isolate * | isolate_ = nullptr |
Friends | |
class | internal::LocalEmbedderHeapTracer |
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 72 of file v8-embedder-heap.h.
Definition at line 74 of file v8-embedder-heap.h.
enum TraceFlags : uint64_t |
Enumerator | |
---|---|
kNoFlags | |
kReduceMemory | |
kForced |
Definition at line 76 of file v8-embedder-heap.h.
|
virtualdefault |
|
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.
void DecreaseAllocatedSize | ( | size_t | bytes | ) |
|
pure virtual |
Called upon entering the final marking pause. No more incremental marking steps will follow this call.
void FinalizeTracing | ( | ) |
void IncreaseAllocatedSize | ( | size_t | bytes | ) |
|
inline |
Definition at line 208 of file v8-embedder-heap.h.
|
virtual |
See documentation on EmbedderRootsHandler.
|
pure virtual |
void IterateTracedGlobalHandles | ( | TracedGlobalHandleVisitor * | visitor | ) |
Iterates all |TracedReference| handles created for the |v8::Isolate| the tracer is attached to.
void RegisterEmbedderReference | ( | const BasicTracedReference< v8::Data > & | ref | ) |
|
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|.
|
virtual |
See documentation on EmbedderRootsHandler.
void SetStackStart | ( | void * | stack_start | ) |
Called by the embedder to set the start of the stack which is e.g. used by V8 to determine whether handles are used from stack or heap.
|
inlinevirtual |
Called at the end of a GC cycle.
Note that allocation is not allowed within |TraceEpilogue|. Can be overriden to fill a |TraceSummary| that is used by V8 to schedule future garbage collections.
Definition at line 164 of file v8-embedder-heap.h.
|
inlinevirtual |
Called at the beginning of a GC cycle.
Definition at line 137 of file v8-embedder-heap.h.
|
friend |
Definition at line 213 of file v8-embedder-heap.h.
|
protected |
Definition at line 211 of file v8-embedder-heap.h.