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

#include <heap-allocator.h>

Collaboration diagram for v8::internal::HeapAllocator:

Public Types

enum  AllocationRetryMode { kLightRetry , kRetryOrFail }
 

Public Member Functions

 HeapAllocator (LocalHeap *)
 
void Setup (LinearAllocationArea *new_allocation_info=nullptr, LinearAllocationArea *old_allocation_info=nullptr)
 
void SetReadOnlySpace (ReadOnlySpace *)
 
V8_WARN_UNUSED_RESULT V8_INLINE AllocationResult AllocateRaw (int size_in_bytes, AllocationType allocation, AllocationOrigin origin=AllocationOrigin::kRuntime, AllocationAlignment alignment=kTaggedAligned)
 
template<AllocationType type>
V8_WARN_UNUSED_RESULT V8_INLINE AllocationResult AllocateRaw (int size_in_bytes, AllocationOrigin origin=AllocationOrigin::kRuntime, AllocationAlignment alignment=kTaggedAligned)
 
template<AllocationRetryMode mode>
V8_WARN_UNUSED_RESULT V8_INLINE Tagged< HeapObjectAllocateRawWith (int size, AllocationType allocation, AllocationOrigin origin=AllocationOrigin::kRuntime, AllocationAlignment alignment=kTaggedAligned)
 
V8_INLINE bool CanAllocateInReadOnlySpace () const
 
void FreeLinearAllocationAreas ()
 
void MakeLinearAllocationAreasIterable ()
 
void MarkLinearAllocationAreasBlack ()
 
void UnmarkLinearAllocationsArea ()
 
void MarkSharedLinearAllocationAreasBlack ()
 
void UnmarkSharedLinearAllocationAreas ()
 
void FreeLinearAllocationAreasAndResetFreeLists ()
 
void FreeSharedLinearAllocationAreasAndResetFreeLists ()
 
void PauseAllocationObservers ()
 
void ResumeAllocationObservers ()
 
void PublishPendingAllocations ()
 
void AddAllocationObserver (AllocationObserver *observer, AllocationObserver *new_space_observer)
 
void RemoveAllocationObserver (AllocationObserver *observer, AllocationObserver *new_space_observer)
 
MainAllocatornew_space_allocator ()
 
const MainAllocatornew_space_allocator () const
 
MainAllocatorold_space_allocator ()
 
MainAllocatortrusted_space_allocator ()
 
MainAllocatorcode_space_allocator ()
 
MainAllocatorshared_space_allocator ()
 
template<typename Function >
V8_WARN_UNUSED_RESULT V8_INLINE auto CustomAllocateWithRetryOrFail (Function &&Allocate, AllocationType allocation)
 
template<typename AllocateFunction , typename RetryFunction >
auto AllocateRawWithRetryOrFailSlowPath (AllocateFunction &&Allocate, RetryFunction &&RetryAllocate, AllocationType allocation)
 
template<typename Function >
V8_WARN_UNUSED_RESULT auto CustomAllocateWithRetryOrFail (Function &&Allocate, AllocationType allocation)
 

Private Member Functions

V8_INLINE PagedSpacecode_space () const
 
V8_INLINE CodeLargeObjectSpacecode_lo_space () const
 
V8_INLINE NewSpacenew_space () const
 
V8_INLINE NewLargeObjectSpacenew_lo_space () const
 
V8_INLINE OldLargeObjectSpacelo_space () const
 
V8_INLINE OldLargeObjectSpaceshared_lo_space () const
 
V8_INLINE OldLargeObjectSpaceshared_trusted_lo_space () const
 
V8_INLINE PagedSpaceold_space () const
 
V8_INLINE ReadOnlySpaceread_only_space () const
 
V8_INLINE PagedSpacetrusted_space () const
 
V8_INLINE OldLargeObjectSpacetrusted_lo_space () const
 
V8_WARN_UNUSED_RESULT AllocationResult AllocateRawLargeInternal (int size_in_bytes, AllocationType allocation, AllocationOrigin origin, AllocationAlignment alignment)
 
template<typename AllocateFunction , typename RetryFunction >
V8_WARN_UNUSED_RESULT auto AllocateRawWithRetryOrFailSlowPath (AllocateFunction &&Allocate, RetryFunction &&RetryAllocate, AllocationType allocation)
 
V8_WARN_UNUSED_RESULT AllocationResult AllocateRawWithRetryOrFailSlowPath (int size, AllocationType allocation, AllocationOrigin origin, AllocationAlignment alignment)
 
template<typename AllocateFunction , typename RetryFunction >
V8_WARN_UNUSED_RESULT auto AllocateRawWithLightRetrySlowPath (AllocateFunction &&Allocate, RetryFunction &&RetryAllocate, AllocationType allocation)
 
V8_WARN_UNUSED_RESULT AllocationResult AllocateRawWithLightRetrySlowPath (int size, AllocationType allocation, AllocationOrigin origin, AllocationAlignment alignment)
 
void CollectGarbage (AllocationType allocation)
 
void CollectAllAvailableGarbage (AllocationType allocation)
 
V8_WARN_UNUSED_RESULT AllocationResult RetryAllocateRaw (int size_in_bytes, AllocationType allocation, AllocationOrigin origin, AllocationAlignment alignment)
 
bool ReachedAllocationTimeout ()
 

Private Attributes

LocalHeaplocal_heap_
 
Heap *const heap_
 
Spacespaces_ [LAST_SPACE+1]
 
ReadOnlySpaceread_only_space_
 
std::optional< MainAllocatornew_space_allocator_
 
std::optional< MainAllocatorold_space_allocator_
 
std::optional< MainAllocatortrusted_space_allocator_
 
std::optional< MainAllocatorcode_space_allocator_
 
std::optional< MainAllocatorshared_space_allocator_
 
std::optional< MainAllocatorshared_trusted_space_allocator_
 
OldLargeObjectSpaceshared_lo_space_
 
SharedTrustedLargeObjectSpaceshared_trusted_lo_space_
 

Detailed Description

Definition at line 35 of file heap-allocator.h.

Member Enumeration Documentation

◆ AllocationRetryMode

Enumerator
kLightRetry 
kRetryOrFail 

Definition at line 61 of file heap-allocator.h.

Constructor & Destructor Documentation

◆ HeapAllocator()

v8::internal::HeapAllocator::HeapAllocator ( LocalHeap * local_heap)
explicit

Definition at line 19 of file heap-allocator.cc.

Member Function Documentation

◆ AddAllocationObserver()

void v8::internal::HeapAllocator::AddAllocationObserver ( AllocationObserver * observer,
AllocationObserver * new_space_observer )

Definition at line 296 of file heap-allocator.cc.

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

◆ AllocateRaw() [1/2]

template<AllocationType type>
V8_WARN_UNUSED_RESULT V8_INLINE AllocationResult v8::internal::HeapAllocator::AllocateRaw ( int size_in_bytes,
AllocationOrigin origin = AllocationOrigin::kRuntime,
AllocationAlignment alignment = kTaggedAligned )

Definition at line 74 of file heap-allocator-inl.h.

Here is the call graph for this function:

◆ AllocateRaw() [2/2]

AllocationResult v8::internal::HeapAllocator::AllocateRaw ( int size_in_bytes,
AllocationType allocation,
AllocationOrigin origin = AllocationOrigin::kRuntime,
AllocationAlignment alignment = kTaggedAligned )

Definition at line 177 of file heap-allocator-inl.h.

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

◆ AllocateRawLargeInternal()

AllocationResult v8::internal::HeapAllocator::AllocateRawLargeInternal ( int size_in_bytes,
AllocationType allocation,
AllocationOrigin origin,
AllocationAlignment alignment )
private

Definition at line 64 of file heap-allocator.cc.

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

◆ AllocateRawWith()

V8_WARN_UNUSED_RESULT V8_INLINE Tagged< HeapObject > v8::internal::HeapAllocator::AllocateRawWith ( int size,
AllocationType allocation,
AllocationOrigin origin = AllocationOrigin::kRuntime,
AllocationAlignment alignment = kTaggedAligned )

Definition at line 215 of file heap-allocator-inl.h.

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

◆ AllocateRawWithLightRetrySlowPath() [1/2]

template<typename AllocateFunction , typename RetryFunction >
V8_WARN_UNUSED_RESULT auto v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath ( AllocateFunction && Allocate,
RetryFunction && RetryAllocate,
AllocationType allocation )
inlineprivate

Definition at line 249 of file heap-allocator-inl.h.

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

◆ AllocateRawWithLightRetrySlowPath() [2/2]

AllocationResult v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath ( int size,
AllocationType allocation,
AllocationOrigin origin,
AllocationAlignment alignment )
private

Definition at line 110 of file heap-allocator.cc.

Here is the call graph for this function:

◆ AllocateRawWithRetryOrFailSlowPath() [1/3]

template<typename AllocateFunction , typename RetryFunction >
auto v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath ( AllocateFunction && Allocate,
RetryFunction && RetryAllocate,
AllocationType allocation )

Definition at line 266 of file heap-allocator-inl.h.

Here is the call graph for this function:

◆ AllocateRawWithRetryOrFailSlowPath() [2/3]

template<typename AllocateFunction , typename RetryFunction >
V8_WARN_UNUSED_RESULT auto v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath ( AllocateFunction && Allocate,
RetryFunction && RetryAllocate,
AllocationType allocation )
inlineprivate
Here is the caller graph for this function:

◆ AllocateRawWithRetryOrFailSlowPath() [3/3]

AllocationResult v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath ( int size,
AllocationType allocation,
AllocationOrigin origin,
AllocationAlignment alignment )
private

Definition at line 138 of file heap-allocator.cc.

Here is the call graph for this function:

◆ CanAllocateInReadOnlySpace()

bool v8::internal::HeapAllocator::CanAllocateInReadOnlySpace ( ) const

Definition at line 69 of file heap-allocator-inl.h.

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

◆ code_lo_space()

CodeLargeObjectSpace * v8::internal::HeapAllocator::code_lo_space ( ) const
private

Definition at line 29 of file heap-allocator-inl.h.

Here is the caller graph for this function:

◆ code_space()

PagedSpace * v8::internal::HeapAllocator::code_space ( ) const
private

Definition at line 25 of file heap-allocator-inl.h.

◆ code_space_allocator()

MainAllocator * v8::internal::HeapAllocator::code_space_allocator ( )
inline

Definition at line 127 of file heap-allocator.h.

◆ CollectAllAvailableGarbage()

void v8::internal::HeapAllocator::CollectAllAvailableGarbage ( AllocationType allocation)
private

Definition at line 151 of file heap-allocator.cc.

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

◆ CollectGarbage()

void v8::internal::HeapAllocator::CollectGarbage ( AllocationType allocation)
private

Definition at line 123 of file heap-allocator.cc.

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

◆ CustomAllocateWithRetryOrFail() [1/2]

template<typename Function >
V8_WARN_UNUSED_RESULT auto v8::internal::HeapAllocator::CustomAllocateWithRetryOrFail ( Function && Allocate,
AllocationType allocation )

Definition at line 284 of file heap-allocator-inl.h.

Here is the call graph for this function:

◆ CustomAllocateWithRetryOrFail() [2/2]

template<typename Function >
V8_WARN_UNUSED_RESULT V8_INLINE auto v8::internal::HeapAllocator::CustomAllocateWithRetryOrFail ( Function && Allocate,
AllocationType allocation )

◆ FreeLinearAllocationAreas()

void v8::internal::HeapAllocator::FreeLinearAllocationAreas ( )

Definition at line 264 of file heap-allocator.cc.

Here is the caller graph for this function:

◆ FreeLinearAllocationAreasAndResetFreeLists()

void v8::internal::HeapAllocator::FreeLinearAllocationAreasAndResetFreeLists ( )

Definition at line 247 of file heap-allocator.cc.

Here is the caller graph for this function:

◆ FreeSharedLinearAllocationAreasAndResetFreeLists()

void v8::internal::HeapAllocator::FreeSharedLinearAllocationAreasAndResetFreeLists ( )

Definition at line 254 of file heap-allocator.cc.

◆ lo_space()

OldLargeObjectSpace * v8::internal::HeapAllocator::lo_space ( ) const
private

Definition at line 33 of file heap-allocator-inl.h.

Here is the caller graph for this function:

◆ MakeLinearAllocationAreasIterable()

void v8::internal::HeapAllocator::MakeLinearAllocationAreasIterable ( )

Definition at line 177 of file heap-allocator.cc.

Here is the caller graph for this function:

◆ MarkLinearAllocationAreasBlack()

void v8::internal::HeapAllocator::MarkLinearAllocationAreasBlack ( )

Definition at line 213 of file heap-allocator.cc.

Here is the caller graph for this function:

◆ MarkSharedLinearAllocationAreasBlack()

void v8::internal::HeapAllocator::MarkSharedLinearAllocationAreasBlack ( )

Definition at line 227 of file heap-allocator.cc.

◆ new_lo_space()

NewLargeObjectSpace * v8::internal::HeapAllocator::new_lo_space ( ) const
private

Definition at line 45 of file heap-allocator-inl.h.

Here is the caller graph for this function:

◆ new_space()

NewSpace * v8::internal::HeapAllocator::new_space ( ) const
private

Definition at line 41 of file heap-allocator-inl.h.

◆ new_space_allocator() [1/2]

MainAllocator * v8::internal::HeapAllocator::new_space_allocator ( )
inline

Definition at line 119 of file heap-allocator.h.

Here is the caller graph for this function:

◆ new_space_allocator() [2/2]

const MainAllocator * v8::internal::HeapAllocator::new_space_allocator ( ) const
inline

Definition at line 120 of file heap-allocator.h.

◆ old_space()

PagedSpace * v8::internal::HeapAllocator::old_space ( ) const
private

Definition at line 49 of file heap-allocator-inl.h.

◆ old_space_allocator()

MainAllocator * v8::internal::HeapAllocator::old_space_allocator ( )
inline

Definition at line 123 of file heap-allocator.h.

◆ PauseAllocationObservers()

void v8::internal::HeapAllocator::PauseAllocationObservers ( )

Definition at line 328 of file heap-allocator.cc.

◆ PublishPendingAllocations()

void v8::internal::HeapAllocator::PublishPendingAllocations ( )

Definition at line 281 of file heap-allocator.cc.

Here is the call graph for this function:

◆ ReachedAllocationTimeout()

bool v8::internal::HeapAllocator::ReachedAllocationTimeout ( )
private
Here is the caller graph for this function:

◆ read_only_space()

ReadOnlySpace * v8::internal::HeapAllocator::read_only_space ( ) const
private

Definition at line 53 of file heap-allocator-inl.h.

Here is the caller graph for this function:

◆ RemoveAllocationObserver()

void v8::internal::HeapAllocator::RemoveAllocationObserver ( AllocationObserver * observer,
AllocationObserver * new_space_observer )

Definition at line 312 of file heap-allocator.cc.

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

◆ ResumeAllocationObservers()

void v8::internal::HeapAllocator::ResumeAllocationObservers ( )

Definition at line 337 of file heap-allocator.cc.

Here is the caller graph for this function:

◆ RetryAllocateRaw()

AllocationResult v8::internal::HeapAllocator::RetryAllocateRaw ( int size_in_bytes,
AllocationType allocation,
AllocationOrigin origin,
AllocationAlignment alignment )
private

Definition at line 164 of file heap-allocator.cc.

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

◆ SetReadOnlySpace()

void v8::internal::HeapAllocator::SetReadOnlySpace ( ReadOnlySpace * read_only_space)

Definition at line 60 of file heap-allocator.cc.

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

◆ Setup()

void v8::internal::HeapAllocator::Setup ( LinearAllocationArea * new_allocation_info = nullptr,
LinearAllocationArea * old_allocation_info = nullptr )

Definition at line 22 of file heap-allocator.cc.

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

◆ shared_lo_space()

OldLargeObjectSpace * v8::internal::HeapAllocator::shared_lo_space ( ) const
private

Definition at line 37 of file heap-allocator-inl.h.

Here is the caller graph for this function:

◆ shared_space_allocator()

MainAllocator * v8::internal::HeapAllocator::shared_space_allocator ( )
inline

Definition at line 130 of file heap-allocator.h.

Here is the caller graph for this function:

◆ shared_trusted_lo_space()

OldLargeObjectSpace * v8::internal::HeapAllocator::shared_trusted_lo_space ( ) const
private

Definition at line 65 of file heap-allocator-inl.h.

Here is the caller graph for this function:

◆ trusted_lo_space()

OldLargeObjectSpace * v8::internal::HeapAllocator::trusted_lo_space ( ) const
private

Definition at line 61 of file heap-allocator-inl.h.

Here is the caller graph for this function:

◆ trusted_space()

PagedSpace * v8::internal::HeapAllocator::trusted_space ( ) const
private

Definition at line 57 of file heap-allocator-inl.h.

◆ trusted_space_allocator()

MainAllocator * v8::internal::HeapAllocator::trusted_space_allocator ( )
inline

Definition at line 124 of file heap-allocator.h.

◆ UnmarkLinearAllocationsArea()

void v8::internal::HeapAllocator::UnmarkLinearAllocationsArea ( )

Definition at line 220 of file heap-allocator.cc.

Here is the caller graph for this function:

◆ UnmarkSharedLinearAllocationAreas()

void v8::internal::HeapAllocator::UnmarkSharedLinearAllocationAreas ( )

Definition at line 237 of file heap-allocator.cc.

Member Data Documentation

◆ code_space_allocator_

std::optional<MainAllocator> v8::internal::HeapAllocator::code_space_allocator_
private

Definition at line 194 of file heap-allocator.h.

◆ heap_

Heap* const v8::internal::HeapAllocator::heap_
private

Definition at line 187 of file heap-allocator.h.

◆ local_heap_

LocalHeap* v8::internal::HeapAllocator::local_heap_
private

Definition at line 186 of file heap-allocator.h.

◆ new_space_allocator_

std::optional<MainAllocator> v8::internal::HeapAllocator::new_space_allocator_
private

Definition at line 191 of file heap-allocator.h.

◆ old_space_allocator_

std::optional<MainAllocator> v8::internal::HeapAllocator::old_space_allocator_
private

Definition at line 192 of file heap-allocator.h.

◆ read_only_space_

ReadOnlySpace* v8::internal::HeapAllocator::read_only_space_
private

Definition at line 189 of file heap-allocator.h.

◆ shared_lo_space_

OldLargeObjectSpace* v8::internal::HeapAllocator::shared_lo_space_
private

Definition at line 199 of file heap-allocator.h.

◆ shared_space_allocator_

std::optional<MainAllocator> v8::internal::HeapAllocator::shared_space_allocator_
private

Definition at line 197 of file heap-allocator.h.

◆ shared_trusted_lo_space_

SharedTrustedLargeObjectSpace* v8::internal::HeapAllocator::shared_trusted_lo_space_
private

Definition at line 200 of file heap-allocator.h.

◆ shared_trusted_space_allocator_

std::optional<MainAllocator> v8::internal::HeapAllocator::shared_trusted_space_allocator_
private

Definition at line 198 of file heap-allocator.h.

◆ spaces_

Space* v8::internal::HeapAllocator::spaces_[LAST_SPACE+1]
private

Definition at line 188 of file heap-allocator.h.

◆ trusted_space_allocator_

std::optional<MainAllocator> v8::internal::HeapAllocator::trusted_space_allocator_
private

Definition at line 193 of file heap-allocator.h.


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