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

#include <main-allocator.h>

Collaboration diagram for v8::internal::MainAllocator:

Classes

struct  InGCTag
 

Public Types

enum class  IsNewGeneration { kNo , kYes }
 

Public Member Functions

V8_EXPORT_PRIVATE MainAllocator (LocalHeap *heap, SpaceWithLinearArea *space, IsNewGeneration is_new_generation, LinearAllocationArea *allocation_info=nullptr)
 
V8_EXPORT_PRIVATE MainAllocator (Heap *heap, SpaceWithLinearArea *space, InGCTag)
 
Address start () const
 
Address top () const
 
Address limit () const
 
Addressallocation_top_address () const
 
Addressallocation_limit_address () const
 
Address original_top_acquire () const
 
Address original_limit_relaxed () const
 
void MoveOriginalTopForward ()
 
V8_EXPORT_PRIVATE void ResetLab (Address start, Address end, Address extended_end)
 
V8_EXPORT_PRIVATE bool IsPendingAllocation (Address object_address)
 
LinearAllocationAreaallocation_info ()
 
const LinearAllocationAreaallocation_info () const
 
AllocationCounterallocation_counter ()
 
const AllocationCounterallocation_counter () const
 
V8_WARN_UNUSED_RESULT V8_INLINE AllocationResult AllocateRaw (int size_in_bytes, AllocationAlignment alignment, AllocationOrigin origin)
 
V8_WARN_UNUSED_RESULT V8_EXPORT_PRIVATE AllocationResult AllocateRawForceAlignmentForTesting (int size_in_bytes, AllocationAlignment alignment, AllocationOrigin)
 
V8_EXPORT_PRIVATE void AddAllocationObserver (AllocationObserver *observer)
 
V8_EXPORT_PRIVATE void RemoveAllocationObserver (AllocationObserver *observer)
 
void PauseAllocationObservers ()
 
void ResumeAllocationObservers ()
 
V8_EXPORT_PRIVATE void AdvanceAllocationObservers ()
 
V8_EXPORT_PRIVATE void InvokeAllocationObservers (Address soon_object, size_t size_in_bytes, size_t aligned_size_in_bytes, size_t allocation_size)
 
V8_EXPORT_PRIVATE void MakeLinearAllocationAreaIterable ()
 
V8_EXPORT_PRIVATE void MarkLinearAllocationAreaBlack ()
 
V8_EXPORT_PRIVATE void UnmarkLinearAllocationArea ()
 
V8_EXPORT_PRIVATE void FreeLinearAllocationAreaAndResetFreeList ()
 
V8_EXPORT_PRIVATE Address AlignTopForTesting (AllocationAlignment alignment, int offset)
 
V8_INLINE bool TryFreeLast (Address object_address, int object_size)
 
Address ComputeLimit (Address start, Address end, size_t min_size) const
 
V8_INLINE bool IsLabValid () const
 
V8_EXPORT_PRIVATE void FreeLinearAllocationArea ()
 
void ExtendLAB (Address limit)
 
V8_EXPORT_PRIVATE bool EnsureAllocationForTesting (int size_in_bytes, AllocationAlignment alignment, AllocationOrigin origin)
 

Static Public Attributes

static constexpr InGCTag kInGC {}
 

Private Types

enum class  BlackAllocation { kAlwaysEnabled , kAlwaysDisabled , kEnabledOnMarking }
 

Private Member Functions

V8_WARN_UNUSED_RESULT V8_INLINE AllocationResult AllocateFastUnaligned (int size_in_bytes, AllocationOrigin origin)
 
V8_WARN_UNUSED_RESULT V8_INLINE AllocationResult AllocateFastAligned (int size_in_bytes, int *result_aligned_size_in_bytes, AllocationAlignment alignment, AllocationOrigin origin)
 
V8_WARN_UNUSED_RESULT V8_EXPORT_PRIVATE AllocationResult AllocateRawSlow (int size_in_bytes, AllocationAlignment alignment, AllocationOrigin origin)
 
V8_WARN_UNUSED_RESULT AllocationResult AllocateRawSlowUnaligned (int size_in_bytes, AllocationOrigin origin=AllocationOrigin::kRuntime)
 
V8_WARN_UNUSED_RESULT AllocationResult AllocateRawSlowAligned (int size_in_bytes, AllocationAlignment alignment, AllocationOrigin origin=AllocationOrigin::kRuntime)
 
bool EnsureAllocation (int size_in_bytes, AllocationAlignment alignment, AllocationOrigin origin)
 
void MarkLabStartInitialized ()
 
bool IsBlackAllocationEnabled () const
 
LinearAreaOriginalDatalinear_area_original_data ()
 
const LinearAreaOriginalDatalinear_area_original_data () const
 
int ObjectAlignment () const
 
AllocationSpace identity () const
 
bool SupportsAllocationObserver () const
 
bool SupportsPendingAllocation () const
 
bool in_gc () const
 
bool in_gc_for_space () const
 
bool supports_extending_lab () const
 
V8_EXPORT_PRIVATE bool is_main_thread () const
 
LocalHeaplocal_heap () const
 
Heapisolate_heap () const
 
V8_EXPORT_PRIVATE Heapspace_heap () const
 

Static Private Member Functions

static constexpr BlackAllocation ComputeBlackAllocation (IsNewGeneration)
 

Private Attributes

LocalHeap *const local_heap_
 
Heap *const isolate_heap_
 
SpaceWithLinearArea *const space_
 
std::optional< AllocationCounterallocation_counter_
 
LinearAllocationArea *const allocation_info_
 
LinearAllocationArea owned_allocation_info_
 
std::optional< LinearAreaOriginalDatalinear_area_original_data_
 
std::unique_ptr< AllocatorPolicyallocator_policy_
 
const bool supports_extending_lab_
 
const BlackAllocation black_allocation_
 

Friends

class AllocatorPolicy
 
class PagedSpaceAllocatorPolicy
 
class SemiSpaceNewSpaceAllocatorPolicy
 

Detailed Description

Definition at line 148 of file main-allocator.h.

Member Enumeration Documentation

◆ BlackAllocation

Enumerator
kAlwaysEnabled 
kAlwaysDisabled 
kEnabledOnMarking 

Definition at line 265 of file main-allocator.h.

◆ IsNewGeneration

Enumerator
kNo 
kYes 

Definition at line 153 of file main-allocator.h.

Constructor & Destructor Documentation

◆ MainAllocator() [1/2]

v8::internal::MainAllocator::MainAllocator ( LocalHeap * heap,
SpaceWithLinearArea * space,
IsNewGeneration is_new_generation,
LinearAllocationArea * allocation_info = nullptr )

Definition at line 39 of file main-allocator.cc.

Here is the call graph for this function:

◆ MainAllocator() [2/2]

v8::internal::MainAllocator::MainAllocator ( Heap * heap,
SpaceWithLinearArea * space,
InGCTag  )

Definition at line 57 of file main-allocator.cc.

Member Function Documentation

◆ AddAllocationObserver()

void v8::internal::MainAllocator::AddAllocationObserver ( AllocationObserver * observer)

Definition at line 102 of file main-allocator.cc.

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

◆ AdvanceAllocationObservers()

void v8::internal::MainAllocator::AdvanceAllocationObservers ( )

Definition at line 122 of file main-allocator.cc.

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

◆ AlignTopForTesting()

Address v8::internal::MainAllocator::AlignTopForTesting ( AllocationAlignment alignment,
int offset )

Definition at line 69 of file main-allocator.cc.

Here is the call graph for this function:

◆ AllocateFastAligned()

AllocationResult v8::internal::MainAllocator::AllocateFastAligned ( int size_in_bytes,
int * result_aligned_size_in_bytes,
AllocationAlignment alignment,
AllocationOrigin origin )
private

Definition at line 60 of file main-allocator-inl.h.

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

◆ AllocateFastUnaligned()

AllocationResult v8::internal::MainAllocator::AllocateFastUnaligned ( int size_in_bytes,
AllocationOrigin origin )
private

Definition at line 43 of file main-allocator-inl.h.

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

◆ AllocateRaw()

AllocationResult v8::internal::MainAllocator::AllocateRaw ( int size_in_bytes,
AllocationAlignment alignment,
AllocationOrigin origin )

Definition at line 18 of file main-allocator-inl.h.

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

◆ AllocateRawForceAlignmentForTesting()

AllocationResult v8::internal::MainAllocator::AllocateRawForceAlignmentForTesting ( int size_in_bytes,
AllocationAlignment alignment,
AllocationOrigin origin )

Definition at line 83 of file main-allocator.cc.

Here is the call graph for this function:

◆ AllocateRawSlow()

AllocationResult v8::internal::MainAllocator::AllocateRawSlow ( int size_in_bytes,
AllocationAlignment alignment,
AllocationOrigin origin )
private

Definition at line 195 of file main-allocator.cc.

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

◆ AllocateRawSlowAligned()

AllocationResult v8::internal::MainAllocator::AllocateRawSlowAligned ( int size_in_bytes,
AllocationAlignment alignment,
AllocationOrigin origin = AllocationOrigin::kRuntime )
private

Definition at line 225 of file main-allocator.cc.

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

◆ AllocateRawSlowUnaligned()

AllocationResult v8::internal::MainAllocator::AllocateRawSlowUnaligned ( int size_in_bytes,
AllocationOrigin origin = AllocationOrigin::kRuntime )
private

Definition at line 210 of file main-allocator.cc.

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

◆ allocation_counter() [1/2]

AllocationCounter & v8::internal::MainAllocator::allocation_counter ( )
inline

Definition at line 201 of file main-allocator.h.

Here is the caller graph for this function:

◆ allocation_counter() [2/2]

const AllocationCounter & v8::internal::MainAllocator::allocation_counter ( ) const
inline

Definition at line 205 of file main-allocator.h.

◆ allocation_info() [1/2]

LinearAllocationArea & v8::internal::MainAllocator::allocation_info ( )
inline

Definition at line 195 of file main-allocator.h.

Here is the caller graph for this function:

◆ allocation_info() [2/2]

const LinearAllocationArea & v8::internal::MainAllocator::allocation_info ( ) const
inline

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

◆ allocation_limit_address()

Address * v8::internal::MainAllocator::allocation_limit_address ( ) const
inline

Definition at line 178 of file main-allocator.h.

◆ allocation_top_address()

Address * v8::internal::MainAllocator::allocation_top_address ( ) const
inline

Definition at line 173 of file main-allocator.h.

◆ ComputeBlackAllocation()

MainAllocator::BlackAllocation v8::internal::MainAllocator::ComputeBlackAllocation ( MainAllocator::IsNewGeneration is_new_generation)
staticconstexprprivate

Definition at line 27 of file main-allocator.cc.

◆ ComputeLimit()

Address v8::internal::MainAllocator::ComputeLimit ( Address start,
Address end,
size_t min_size ) const

Definition at line 353 of file main-allocator.cc.

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

◆ EnsureAllocation()

bool v8::internal::MainAllocator::EnsureAllocation ( int size_in_bytes,
AllocationAlignment alignment,
AllocationOrigin origin )
private

Definition at line 319 of file main-allocator.cc.

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

◆ EnsureAllocationForTesting()

bool v8::internal::MainAllocator::EnsureAllocationForTesting ( int size_in_bytes,
AllocationAlignment alignment,
AllocationOrigin origin )

Definition at line 418 of file main-allocator.cc.

Here is the call graph for this function:

◆ ExtendLAB()

void v8::internal::MainAllocator::ExtendLAB ( Address limit)

Definition at line 347 of file main-allocator.cc.

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

◆ FreeLinearAllocationArea()

void v8::internal::MainAllocator::FreeLinearAllocationArea ( )

Definition at line 336 of file main-allocator.cc.

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

◆ FreeLinearAllocationAreaAndResetFreeList()

void v8::internal::MainAllocator::FreeLinearAllocationAreaAndResetFreeList ( )

Definition at line 279 of file main-allocator.cc.

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

◆ identity()

AllocationSpace v8::internal::MainAllocator::identity ( ) const
private

Definition at line 434 of file main-allocator.cc.

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

◆ in_gc()

bool v8::internal::MainAllocator::in_gc ( ) const
inlineprivate

Definition at line 330 of file main-allocator.h.

Here is the caller graph for this function:

◆ in_gc_for_space()

bool v8::internal::MainAllocator::in_gc_for_space ( ) const
private

Definition at line 440 of file main-allocator.cc.

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

◆ InvokeAllocationObservers()

void v8::internal::MainAllocator::InvokeAllocationObservers ( Address soon_object,
size_t size_in_bytes,
size_t aligned_size_in_bytes,
size_t allocation_size )

Definition at line 148 of file main-allocator.cc.

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

◆ is_main_thread()

bool v8::internal::MainAllocator::is_main_thread ( ) const
private

Definition at line 436 of file main-allocator.cc.

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

◆ IsBlackAllocationEnabled()

bool v8::internal::MainAllocator::IsBlackAllocationEnabled ( ) const
private

Definition at line 95 of file main-allocator.cc.

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

◆ IsLabValid()

V8_INLINE bool v8::internal::MainAllocator::IsLabValid ( ) const
inline

Definition at line 252 of file main-allocator.h.

Here is the caller graph for this function:

◆ isolate_heap()

Heap * v8::internal::MainAllocator::isolate_heap ( ) const
inlineprivate

Definition at line 346 of file main-allocator.h.

Here is the caller graph for this function:

◆ IsPendingAllocation()

bool v8::internal::MainAllocator::IsPendingAllocation ( Address object_address)

Definition at line 310 of file main-allocator.cc.

Here is the call graph for this function:

◆ limit()

Address v8::internal::MainAllocator::limit ( ) const
inline

Definition at line 170 of file main-allocator.h.

Here is the caller graph for this function:

◆ linear_area_original_data() [1/2]

LinearAreaOriginalData & v8::internal::MainAllocator::linear_area_original_data ( )
inlineprivate

Definition at line 309 of file main-allocator.h.

Here is the caller graph for this function:

◆ linear_area_original_data() [2/2]

const LinearAreaOriginalData & v8::internal::MainAllocator::linear_area_original_data ( ) const
inlineprivate

Definition at line 313 of file main-allocator.h.

◆ local_heap()

LocalHeap * v8::internal::MainAllocator::local_heap ( ) const
inlineprivate

Definition at line 342 of file main-allocator.h.

Here is the caller graph for this function:

◆ MakeLinearAllocationAreaIterable()

void v8::internal::MainAllocator::MakeLinearAllocationAreaIterable ( )

Definition at line 245 of file main-allocator.cc.

Here is the call graph for this function:

◆ MarkLabStartInitialized()

void v8::internal::MainAllocator::MarkLabStartInitialized ( )
private

Definition at line 133 of file main-allocator.cc.

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

◆ MarkLinearAllocationAreaBlack()

void v8::internal::MainAllocator::MarkLinearAllocationAreaBlack ( )

Definition at line 260 of file main-allocator.cc.

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

◆ MoveOriginalTopForward()

void v8::internal::MainAllocator::MoveOriginalTopForward ( )

Definition at line 285 of file main-allocator.cc.

Here is the call graph for this function:

◆ ObjectAlignment()

int v8::internal::MainAllocator::ObjectAlignment ( ) const
private

Definition at line 424 of file main-allocator.cc.

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

◆ original_limit_relaxed()

Address v8::internal::MainAllocator::original_limit_relaxed ( ) const
inline

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

Here is the caller graph for this function:

◆ original_top_acquire()

Address v8::internal::MainAllocator::original_top_acquire ( ) const
inline

Definition at line 182 of file main-allocator.h.

Here is the caller graph for this function:

◆ PauseAllocationObservers()

void v8::internal::MainAllocator::PauseAllocationObservers ( )

Definition at line 118 of file main-allocator.cc.

Here is the call graph for this function:

◆ RemoveAllocationObserver()

void v8::internal::MainAllocator::RemoveAllocationObserver ( AllocationObserver * observer)

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

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

◆ ResetLab()

void v8::internal::MainAllocator::ResetLab ( Address start,
Address end,
Address extended_end )

Definition at line 293 of file main-allocator.cc.

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

◆ ResumeAllocationObservers()

void v8::internal::MainAllocator::ResumeAllocationObservers ( )

Definition at line 120 of file main-allocator.cc.

Here is the call graph for this function:

◆ space_heap()

Heap * v8::internal::MainAllocator::space_heap ( ) const
private

Definition at line 444 of file main-allocator.cc.

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

◆ start()

Address v8::internal::MainAllocator::start ( ) const
inline

Definition at line 168 of file main-allocator.h.

Here is the caller graph for this function:

◆ supports_extending_lab()

bool v8::internal::MainAllocator::supports_extending_lab ( ) const
inlineprivate

Definition at line 338 of file main-allocator.h.

Here is the caller graph for this function:

◆ SupportsAllocationObserver()

bool v8::internal::MainAllocator::SupportsAllocationObserver ( ) const
inlineprivate

Definition at line 321 of file main-allocator.h.

Here is the caller graph for this function:

◆ SupportsPendingAllocation()

bool v8::internal::MainAllocator::SupportsPendingAllocation ( ) const
inlineprivate

Definition at line 325 of file main-allocator.h.

Here is the caller graph for this function:

◆ top()

Address v8::internal::MainAllocator::top ( ) const
inline

Definition at line 169 of file main-allocator.h.

Here is the caller graph for this function:

◆ TryFreeLast()

bool v8::internal::MainAllocator::TryFreeLast ( Address object_address,
int object_size )

Definition at line 87 of file main-allocator-inl.h.

Here is the call graph for this function:

◆ UnmarkLinearAllocationArea()

void v8::internal::MainAllocator::UnmarkLinearAllocationArea ( )

Definition at line 270 of file main-allocator.cc.

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

Friends And Related Symbol Documentation

◆ AllocatorPolicy

friend class AllocatorPolicy
friend

Definition at line 367 of file main-allocator.h.

◆ PagedSpaceAllocatorPolicy

friend class PagedSpaceAllocatorPolicy
friend

Definition at line 368 of file main-allocator.h.

◆ SemiSpaceNewSpaceAllocatorPolicy

friend class SemiSpaceNewSpaceAllocatorPolicy
friend

Definition at line 369 of file main-allocator.h.

Member Data Documentation

◆ allocation_counter_

std::optional<AllocationCounter> v8::internal::MainAllocator::allocation_counter_
private

Definition at line 357 of file main-allocator.h.

◆ allocation_info_

LinearAllocationArea* const v8::internal::MainAllocator::allocation_info_
private

Definition at line 358 of file main-allocator.h.

◆ allocator_policy_

std::unique_ptr<AllocatorPolicy> v8::internal::MainAllocator::allocator_policy_
private

Definition at line 362 of file main-allocator.h.

◆ black_allocation_

const BlackAllocation v8::internal::MainAllocator::black_allocation_
private

Definition at line 365 of file main-allocator.h.

◆ isolate_heap_

Heap* const v8::internal::MainAllocator::isolate_heap_
private

Definition at line 354 of file main-allocator.h.

◆ kInGC

InGCTag v8::internal::MainAllocator::kInGC {}
staticconstexpr

Definition at line 151 of file main-allocator.h.

◆ linear_area_original_data_

std::optional<LinearAreaOriginalData> v8::internal::MainAllocator::linear_area_original_data_
private

Definition at line 361 of file main-allocator.h.

◆ local_heap_

LocalHeap* const v8::internal::MainAllocator::local_heap_
private

Definition at line 353 of file main-allocator.h.

◆ owned_allocation_info_

LinearAllocationArea v8::internal::MainAllocator::owned_allocation_info_
private

Definition at line 360 of file main-allocator.h.

◆ space_

SpaceWithLinearArea* const v8::internal::MainAllocator::space_
private

Definition at line 355 of file main-allocator.h.

◆ supports_extending_lab_

const bool v8::internal::MainAllocator::supports_extending_lab_
private

Definition at line 364 of file main-allocator.h.


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