v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
cppgc::Heap Class Reference

#include <heap.h>

Inheritance diagram for cppgc::Heap:
Collaboration diagram for cppgc::Heap:

Classes

struct  HeapOptions
 
struct  ResourceConstraints
 

Public Types

enum class  StackSupport : uint8_t { kSupportsConservativeStackScan , kNoConservativeStackScan }
 
enum class  MarkingType : uint8_t { kAtomic , kIncremental , kIncrementalAndConcurrent }
 
enum class  SweepingType : uint8_t { kAtomic , kIncremental , kIncrementalAndConcurrent }
 
using StackState = EmbedderStackState
 

Public Member Functions

virtual ~Heap ()=default
 
void ForceGarbageCollectionSlow (const char *source, const char *reason, StackState stack_state=StackState::kMayContainHeapPointers)
 
AllocationHandleGetAllocationHandle ()
 
HeapHandleGetHeapHandle ()
 

Static Public Member Functions

static std::unique_ptr< HeapCreate (std::shared_ptr< Platform > platform, HeapOptions options=HeapOptions::Default())
 

Private Member Functions

 Heap ()=default
 

Friends

class internal::Heap
 

Detailed Description

Definition at line 35 of file heap.h.

Member Typedef Documentation

◆ StackState

Specifies the stack state the embedder is in.

Definition at line 40 of file heap.h.

Member Enumeration Documentation

◆ MarkingType

enum class cppgc::Heap::MarkingType : uint8_t
strong

Specifies supported marking types.

Enumerator
kAtomic 

Atomic stop-the-world marking. This option does not require any write barriers but is the most intrusive in terms of jank.

kIncremental 

Incremental marking interleaves marking with the rest of the application workload on the same thread.

kIncrementalAndConcurrent 

Incremental and concurrent marking.

Definition at line 60 of file heap.h.

◆ StackSupport

enum class cppgc::Heap::StackSupport : uint8_t
strong

Specifies whether conservative stack scanning is supported.

Enumerator
kSupportsConservativeStackScan 

Conservative stack scan is supported.

kNoConservativeStackScan 

Conservative stack scan is not supported. Embedders may use this option when using custom infrastructure that is unsupported by the library.

Definition at line 45 of file heap.h.

◆ SweepingType

enum class cppgc::Heap::SweepingType : uint8_t
strong

Specifies supported sweeping types.

Enumerator
kAtomic 

Atomic stop-the-world sweeping. All of sweeping is performed at once.

kIncremental 

Incremental sweeping interleaves sweeping with the rest of the application workload on the same thread.

kIncrementalAndConcurrent 

Incremental and concurrent sweeping. Sweeping is split and interleaved with the rest of the application.

Definition at line 80 of file heap.h.

Constructor & Destructor Documentation

◆ ~Heap()

virtual cppgc::Heap::~Heap ( )
virtualdefault

Reimplemented in cppgc::internal::Heap.

◆ Heap()

cppgc::Heap::Heap ( )
privatedefault

Member Function Documentation

◆ Create()

std::unique_ptr< Heap > cppgc::Heap::Create ( std::shared_ptr< Platform > platform,
HeapOptions options = HeapOptions::Default() )
static

Creates a new heap that can be used for object allocation.

Parameters
platformimplemented and provided by the embedder.
optionsHeapOptions specifying various properties for the Heap.
Returns
a new Heap instance.

Definition at line 38 of file heap.cc.

◆ ForceGarbageCollectionSlow()

void cppgc::Heap::ForceGarbageCollectionSlow ( const char * source,
const char * reason,
Heap::StackState stack_state = StackState::kMayContainHeapPointers )

Forces garbage collection.

Parameters
sourceString specifying the source (or caller) triggering a forced garbage collection.
reasonString specifying the reason for the forced garbage collection.
stack_stateThe embedder stack state, see StackState.

Definition at line 46 of file heap.cc.

Here is the call graph for this function:

◆ GetAllocationHandle()

AllocationHandle & cppgc::Heap::GetAllocationHandle ( )
Returns
the opaque handle for allocating objects using MakeGarbageCollected().

Definition at line 55 of file heap.cc.

Here is the call graph for this function:

◆ GetHeapHandle()

HeapHandle & cppgc::Heap::GetHeapHandle ( )
Returns
the opaque heap handle which may be used to refer to this heap in other APIs. Valid as long as the underlying Heap is alive.

Definition at line 59 of file heap.cc.

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ internal::Heap

friend class internal::Heap
friend

Definition at line 197 of file heap.h.


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