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

#include <heap.h>

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

Public Member Functions

 Heap (std::shared_ptr< cppgc::Platform > platform, cppgc::Heap::HeapOptions options)
 
 ~Heap () final
 
HeapBase & AsBase ()
 
const HeapBase & AsBase () const
 
void CollectGarbage (GCConfig) final
 
void StartIncrementalGarbageCollection (GCConfig) final
 
void FinalizeIncrementalGarbageCollectionIfRunning (GCConfig)
 
size_t epoch () const final
 
std::optional< EmbedderStackState > overridden_stack_state () const final
 
void set_override_stack_state (EmbedderStackState state) final
 
void clear_overridden_stack_state () final
 
void EnableGenerationalGC ()
 
void DisableHeapGrowingForTesting ()
 
- Public Member Functions inherited from cppgc::internal::HeapBase
 HeapBase (std::shared_ptr< cppgc::Platform > platform, const std::vector< std::unique_ptr< CustomSpaceBase > > &custom_spaces, StackSupport stack_support, MarkingType marking_support, SweepingType sweeping_support, GarbageCollector &garbage_collector)
 
virtual ~HeapBase ()
 
 HeapBase (const HeapBase &)=delete
 
HeapBase & operator= (const HeapBase &)=delete
 
RawHeap & raw_heap ()
 
const RawHeap & raw_heap () const
 
cppgc::Platform * platform ()
 
const cppgc::Platform * platform () const
 
FatalOutOfMemoryHandler & oom_handler ()
 
const FatalOutOfMemoryHandler & oom_handler () const
 
PageBackend * page_backend ()
 
const PageBackend * page_backend () const
 
StatsCollector * stats_collector ()
 
const StatsCollector * stats_collector () const
 
PreFinalizerHandler * prefinalizer_handler ()
 
const PreFinalizerHandler * prefinalizer_handler () const
 
MarkerBase * marker () const
 
std::unique_ptr< MarkerBase > & GetMarkerRefForTesting ()
 
Compactor & compactor ()
 
ObjectAllocator & object_allocator ()
 
const ObjectAllocator & object_allocator () const
 
Sweeper & sweeper ()
 
const Sweeper & sweeper () const
 
PersistentRegion & GetStrongPersistentRegion ()
 
const PersistentRegion & GetStrongPersistentRegion () const
 
PersistentRegion & GetWeakPersistentRegion ()
 
const PersistentRegion & GetWeakPersistentRegion () const
 
CrossThreadPersistentRegion & GetStrongCrossThreadPersistentRegion ()
 
const CrossThreadPersistentRegion & GetStrongCrossThreadPersistentRegion () const
 
CrossThreadPersistentRegion & GetWeakCrossThreadPersistentRegion ()
 
const CrossThreadPersistentRegion & GetWeakCrossThreadPersistentRegion () const
 
size_t ObjectPayloadSize () const
 
virtual heap::base::Stack * stack ()
 
StackSupport stack_support () const
 
void Terminate ()
 
virtual bool IsGCForbidden () const
 
bool in_atomic_pause () const
 
HeapStatistics CollectStatistics (HeapStatistics::DetailLevel)
 
EmbedderStackState stack_state_of_prev_gc () const
 
void SetStackStateOfPrevGC (EmbedderStackState stack_state)
 
void SetInAtomicPauseForTesting (bool value)
 
void SetMetricRecorder (std::unique_ptr< MetricRecorder > histogram_recorder)
 
virtual bool CurrentThreadIsHeapThread () const
 
MarkingType marking_support () const
 
SweepingType sweeping_support () const
 
bool incremental_marking_supported () const
 
bool generational_gc_supported () const
 
StickyBits sticky_bits () const
 
HeapObjectNameForUnnamedObject name_of_unnamed_object () const
 
void set_name_of_unnamed_object (HeapObjectNameForUnnamedObject value)
 
bool HasMoveListeners () const
 
void CallMoveListeners (Address from, Address to, size_t size_including_header)
 
void RegisterMoveListener (MoveListener *listener)
 
void UnregisterMoveListener (MoveListener *listener)
 
void set_incremental_marking_in_progress (bool value)
 
void EnterNoGCScope ()
 
void LeaveNoGCScope ()
 
void EnterDisallowGCScope ()
 
void LeaveDisallowGCScope ()
 
- Public Member Functions inherited from cppgc::HeapHandle
 HeapHandle (const HeapHandle &)=delete
 
HeapHandle & operator= (const HeapHandle &)=delete
 
- Public Member Functions inherited from cppgc::Heap
void ForceGarbageCollectionSlow (const char *source, const char *reason, StackState stack_state=StackState::kMayContainHeapPointers)
 
AllocationHandle & GetAllocationHandle ()
 
HeapHandle & GetHeapHandle ()
 
- Public Member Functions inherited from cppgc::internal::GarbageCollector

Static Public Member Functions

static Heap * From (cppgc::Heap *heap)
 
static const Heap * From (const cppgc::Heap *heap)
 
- Static Public Member Functions inherited from cppgc::internal::HeapBase
static HeapBase & From (cppgc::HeapHandle &heap_handle)
 
static const HeapBase & From (const cppgc::HeapHandle &heap_handle)
 
- Static Public Member Functions inherited from cppgc::Heap
static std::unique_ptr< Heap > Create (std::shared_ptr< Platform > platform, HeapOptions options=HeapOptions::Default())
 

Private Member Functions

void StartGarbageCollection (GCConfig)
 
void FinalizeGarbageCollection (StackState)
 
void FinalizeGarbageCollectionImpl (StackState)
 
void FinalizeIncrementalGarbageCollectionIfNeeded (StackState) final
 
void StartIncrementalGarbageCollectionForTesting () final
 
void FinalizeIncrementalGarbageCollectionForTesting (EmbedderStackState) final
 

Private Attributes

GCConfig config_
 
GCInvoker gc_invoker_
 
HeapGrowing growing_
 
bool generational_gc_enabled_ = false
 
size_t epoch_ = 0
 
std::optional< cppgc::EmbedderStackState > override_stack_state_
 

Additional Inherited Members

- Public Types inherited from cppgc::internal::HeapBase
using StackSupport = cppgc::Heap::StackSupport
 
using MarkingType = cppgc::Heap::MarkingType
 
using SweepingType = cppgc::Heap::SweepingType
 
- Public Types inherited from cppgc::Heap
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
 
- Protected Member Functions inherited from cppgc::internal::HeapBase
virtual bool IsGCAllowed () const
 
bool in_no_gc_scope () const
 
bool IsMarking () const
 
size_t ExecutePreFinalizers ()
 
PageAllocator * page_allocator () const
 
- Static Protected Member Functions inherited from cppgc::internal::HeapBase
static std::unique_ptr< PageBackend > InitializePageBackend (PageAllocator &allocator)
 
- Protected Attributes inherited from cppgc::internal::HeapBase
int heap_thread_id_ = v8::base::OS::GetCurrentThreadId()
 
RawHeap raw_heap_
 
std::shared_ptr< cppgc::Platform > platform_
 
std::unique_ptr< FatalOutOfMemoryHandler > oom_handler_
 
std::unique_ptr< PageBackend > page_backend_
 
HeapRegistry::Subscription heap_registry_subscription_ {*this}
 
std::unique_ptr< StatsCollector > stats_collector_
 
std::unique_ptr< heap::base::Stack > stack_
 
std::unique_ptr< PreFinalizerHandler > prefinalizer_handler_
 
std::unique_ptr< MarkerBase > marker_
 
Compactor compactor_
 
ObjectAllocator object_allocator_
 
Sweeper sweeper_
 
PersistentRegion strong_persistent_region_
 
PersistentRegion weak_persistent_region_
 
CrossThreadPersistentRegion strong_cross_thread_persistent_region_
 
CrossThreadPersistentRegion weak_cross_thread_persistent_region_
 
ProcessHeapStatisticsUpdater::AllocationObserverImpl allocation_observer_for_PROCESS_HEAP_STATISTICS_
 
size_t no_gc_scope_ = 0
 
size_t disallow_gc_scope_ = 0
 
const StackSupport stack_support_
 
EmbedderStackState stack_state_of_prev_gc_
 
bool in_atomic_pause_ = false
 
MarkingType marking_support_
 
SweepingType sweeping_support_
 
HeapObjectNameForUnnamedObject name_for_unnamed_object_
 
std::vector< MoveListener * > move_listeners_
 

Detailed Description

Definition at line 21 of file heap.h.

Constructor & Destructor Documentation

◆ Heap()

cppgc::internal::Heap::Heap ( std::shared_ptr< cppgc::Platform > platform,
cppgc::Heap::HeapOptions options )

Definition at line 75 of file heap.cc.

Here is the call graph for this function:

◆ ~Heap()

cppgc::internal::Heap::~Heap ( )
finalvirtual

Reimplemented from cppgc::Heap.

Definition at line 92 of file heap.cc.

Here is the call graph for this function:

Member Function Documentation

◆ AsBase() [1/2]

HeapBase & cppgc::internal::Heap::AsBase ( )
inline

Definition at line 34 of file heap.h.

Here is the caller graph for this function:

◆ AsBase() [2/2]

const HeapBase & cppgc::internal::Heap::AsBase ( ) const
inline

Definition at line 35 of file heap.h.

◆ clear_overridden_stack_state()

void cppgc::internal::Heap::clear_overridden_stack_state ( )
inlinefinalvirtual

Implements cppgc::internal::HeapBase.

Definition at line 50 of file heap.h.

◆ CollectGarbage()

void cppgc::internal::Heap::CollectGarbage ( GCConfig config)
finalvirtual

Implements cppgc::internal::GarbageCollector.

Definition at line 104 of file heap.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DisableHeapGrowingForTesting()

void cppgc::internal::Heap::DisableHeapGrowingForTesting ( )

Definition at line 230 of file heap.cc.

Here is the call graph for this function:

◆ EnableGenerationalGC()

void cppgc::internal::Heap::EnableGenerationalGC ( )

Definition at line 224 of file heap.cc.

Here is the call graph for this function:

◆ epoch()

size_t cppgc::internal::Heap::epoch ( ) const
inlinefinalvirtual

Implements cppgc::internal::GarbageCollector.

Definition at line 41 of file heap.h.

◆ FinalizeGarbageCollection()

void cppgc::internal::Heap::FinalizeGarbageCollection ( StackState stack_state)
private

Definition at line 170 of file heap.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FinalizeGarbageCollectionImpl()

void cppgc::internal::Heap::FinalizeGarbageCollectionImpl ( StackState stack_state)
private

Definition at line 175 of file heap.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FinalizeIncrementalGarbageCollectionForTesting()

void cppgc::internal::Heap::FinalizeIncrementalGarbageCollectionForTesting ( EmbedderStackState stack_state)
finalprivatevirtual

Implements cppgc::internal::HeapBase.

Definition at line 247 of file heap.cc.

Here is the call graph for this function:

◆ FinalizeIncrementalGarbageCollectionIfNeeded()

void cppgc::internal::Heap::FinalizeIncrementalGarbageCollectionIfNeeded ( StackState stack_state)
finalprivatevirtual

Implements cppgc::internal::HeapBase.

Definition at line 232 of file heap.cc.

Here is the call graph for this function:

◆ FinalizeIncrementalGarbageCollectionIfRunning()

void cppgc::internal::Heap::FinalizeIncrementalGarbageCollectionIfRunning ( GCConfig config)

Definition at line 133 of file heap.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ From() [1/2]

static const Heap * cppgc::internal::Heap::From ( const cppgc::Heap * heap)
inlinestatic

Definition at line 26 of file heap.h.

◆ From() [2/2]

static Heap * cppgc::internal::Heap::From ( cppgc::Heap * heap)
inlinestatic

Definition at line 25 of file heap.h.

Here is the caller graph for this function:

◆ overridden_stack_state()

std::optional< EmbedderStackState > cppgc::internal::Heap::overridden_stack_state ( ) const
inlinefinalvirtual

Implements cppgc::internal::GarbageCollector.

Definition at line 43 of file heap.h.

◆ set_override_stack_state()

void cppgc::internal::Heap::set_override_stack_state ( EmbedderStackState state)
inlinefinalvirtual

Implements cppgc::internal::HeapBase.

Definition at line 46 of file heap.h.

◆ StartGarbageCollection()

void cppgc::internal::Heap::StartGarbageCollection ( GCConfig config)
private

Definition at line 145 of file heap.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StartIncrementalGarbageCollection()

void cppgc::internal::Heap::StartIncrementalGarbageCollection ( GCConfig config)
finalvirtual

Implements cppgc::internal::GarbageCollector.

Definition at line 121 of file heap.cc.

Here is the call graph for this function:

◆ StartIncrementalGarbageCollectionForTesting()

void cppgc::internal::Heap::StartIncrementalGarbageCollectionForTesting ( )
finalprivatevirtual

Implements cppgc::internal::HeapBase.

Definition at line 239 of file heap.cc.

Here is the call graph for this function:

Member Data Documentation

◆ config_

GCConfig cppgc::internal::Heap::config_
private

Definition at line 70 of file heap.h.

◆ epoch_

size_t cppgc::internal::Heap::epoch_ = 0
private

Definition at line 75 of file heap.h.

◆ gc_invoker_

GCInvoker cppgc::internal::Heap::gc_invoker_
private

Definition at line 71 of file heap.h.

◆ generational_gc_enabled_

bool cppgc::internal::Heap::generational_gc_enabled_ = false
private

Definition at line 73 of file heap.h.

◆ growing_

HeapGrowing cppgc::internal::Heap::growing_
private

Definition at line 72 of file heap.h.

◆ override_stack_state_

std::optional<cppgc::EmbedderStackState> cppgc::internal::Heap::override_stack_state_
private

Definition at line 77 of file heap.h.


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