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

#include <local-heap.h>

Collaboration diagram for v8::internal::LocalHeap:

Classes

class  AtomicThreadState
 
class  ThreadState
 

Public Types

using GCEpilogueCallback = void(void*)
 

Public Member Functions

 LocalHeap (Heap *heap, ThreadKind kind, std::unique_ptr< PersistentHandles > persistent_handles=nullptr)
 
 ~LocalHeap ()
 
void Safepoint ()
 
LocalHandleshandles ()
 
template<typename T >
IndirectHandle< TNewPersistentHandle (Tagged< T > object)
 
template<typename T , template< typename > typename HandleType>
requires (std::is_convertible_v<HandleType<T>, DirectHandle<T>>)
IndirectHandle< TNewPersistentHandle (HandleType< T > object)
 
template<typename T >
IndirectHandle< TNewPersistentHandle (T object)
 
template<typename T , template< typename > typename MaybeHandleType>
requires (std::is_convertible_v<MaybeHandleType<T>, MaybeDirectHandle<T>>)
MaybeIndirectHandle< TNewPersistentMaybeHandle (MaybeHandleType< T > maybe_handle)
 
void AttachPersistentHandles (std::unique_ptr< PersistentHandles > persistent_handles)
 
std::unique_ptr< PersistentHandlesDetachPersistentHandles ()
 
bool IsParked () const
 
bool IsRunning () const
 
bool IsRetryOfFailedAllocation () const
 
void SetRetryOfFailedAllocation (bool value)
 
Heapheap () const
 
HeapAsHeap () const
 
MarkingBarriermarking_barrier ()
 
void FreeLinearAllocationAreas ()
 
void MakeLinearAllocationAreasIterable ()
 
void MarkLinearAllocationAreasBlack ()
 
void UnmarkLinearAllocationsArea ()
 
void MarkSharedLinearAllocationAreasBlack ()
 
void UnmarkSharedLinearAllocationsArea ()
 
void FreeLinearAllocationAreasAndResetFreeLists ()
 
void FreeSharedLinearAllocationAreasAndResetFreeLists ()
 
V8_WARN_UNUSED_RESULT AllocationResult AllocateRaw (int size_in_bytes, AllocationType allocation, AllocationOrigin origin=AllocationOrigin::kRuntime, AllocationAlignment alignment=kTaggedAligned)
 
template<HeapAllocator::AllocationRetryMode mode>
Tagged< HeapObjectAllocateRawWith (int size_in_bytes, AllocationType allocation, AllocationOrigin origin=AllocationOrigin::kRuntime, AllocationAlignment alignment=kTaggedAligned)
 
V8_WARN_UNUSED_RESULT Address AllocateRawOrFail (int size_in_bytes, AllocationType allocation, AllocationOrigin origin=AllocationOrigin::kRuntime, AllocationAlignment alignment=kTaggedAligned)
 
void NotifyObjectSizeChange (Tagged< HeapObject > object, int old_size, int new_size, ClearRecordedSlots clear_recorded_slots)
 
bool is_main_thread () const
 
bool is_main_thread_for (Heap *heap) const
 
V8_INLINE bool is_in_trampoline () const
 
bool deserialization_complete () const
 
ReadOnlySpaceread_only_space ()
 
void AddGCEpilogueCallback (GCEpilogueCallback *callback, void *data, GCCallbacksInSafepoint::GCType gc_type=GCCallbacksInSafepoint::GCType::kAll)
 
void RemoveGCEpilogueCallback (GCEpilogueCallback *callback, void *data)
 
void WeakenDescriptorArrays (GlobalHandleVector< DescriptorArray > strong_descriptor_arrays)
 
void SetUpMainThreadForTesting ()
 
template<typename Callback >
V8_INLINE void ExecuteWhileParked (Callback callback)
 
template<typename Callback >
V8_INLINE void ExecuteMainThreadWhileParked (Callback callback)
 
template<typename Callback >
V8_INLINE void ExecuteBackgroundThreadWhileParked (Callback callback)
 
HeapAllocatorallocator ()
 

Static Public Member Functions

static void SetCurrent (LocalHeap *local_heap)
 

Private Types

using ParkedBit = base::BitField8<bool, 0, 1>
 
using SafepointRequestedBit = ParkedBit::Next<bool, 1>
 
using CollectionRequestedBit = SafepointRequestedBit::Next<bool, 1>
 

Private Member Functions

template<typename Callback >
V8_INLINE void ExecuteWithStackMarker (Callback callback)
 
void Park ()
 
void Unpark ()
 
void ParkSlowPath ()
 
void UnparkSlowPath ()
 
void EnsureParkedBeforeDestruction ()
 
void SafepointSlowPath ()
 
void SleepInSafepoint ()
 
void SleepInUnpark ()
 
template<typename Callback >
V8_INLINE void ParkAndExecuteCallback (Callback callback)
 
void EnsurePersistentHandles ()
 
void InvokeGCEpilogueCallbacksInSafepoint (GCCallbacksInSafepoint::GCType gc_type)
 
void SetUpMainThread (LinearAllocationArea &new_allocation_info, LinearAllocationArea &old_allocation_info)
 
void SetUpMarkingBarrier ()
 
void SetUpSharedMarking ()
 

Private Attributes

Heapheap_
 
V8_NO_UNIQUE_ADDRESS PtrComprCageAccessScope ptr_compr_cage_access_scope_
 
bool is_main_thread_
 
AtomicThreadState state_
 
bool allocation_failed_
 
int nested_parked_scopes_
 
Isolatesaved_current_isolate_ = nullptr
 
LocalHeapprev_
 
LocalHeapnext_
 
std::unique_ptr< LocalHandleshandles_
 
std::unique_ptr< PersistentHandlespersistent_handles_
 
std::unique_ptr< MarkingBarriermarking_barrier_
 
GCCallbacksInSafepoint gc_epilogue_callbacks_
 
HeapAllocator heap_allocator_
 
MarkingBarriersaved_marking_barrier_ = nullptr
 
::heap::base::Stack stack_
 

Friends

class CollectionBarrier
 
class GlobalSafepoint
 
class Heap
 
class Isolate
 
class IsolateSafepoint
 
class IsolateSafepointScope
 
class ParkedScope
 
class UnparkedScope
 

Detailed Description

Definition at line 50 of file local-heap.h.

Member Typedef Documentation

◆ CollectionRequestedBit

◆ GCEpilogueCallback

Definition at line 52 of file local-heap.h.

◆ ParkedBit

Definition at line 241 of file local-heap.h.

◆ SafepointRequestedBit

Definition at line 242 of file local-heap.h.

Constructor & Destructor Documentation

◆ LocalHeap()

v8::internal::LocalHeap::LocalHeap ( Heap * heap,
ThreadKind kind,
std::unique_ptr< PersistentHandles > persistent_handles = nullptr )
explicit

Definition at line 51 of file local-heap.cc.

Here is the call graph for this function:

◆ ~LocalHeap()

v8::internal::LocalHeap::~LocalHeap ( )

Definition at line 102 of file local-heap.cc.

Here is the call graph for this function:

Member Function Documentation

◆ AddGCEpilogueCallback()

void v8::internal::LocalHeap::AddGCEpilogueCallback ( GCEpilogueCallback * callback,
void * data,
GCCallbacksInSafepoint::GCType gc_type = GCCallbacksInSafepoint::GCType::kAll )

Definition at line 456 of file local-heap.cc.

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

◆ AllocateRaw()

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

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

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

◆ AllocateRawOrFail()

Address v8::internal::LocalHeap::AllocateRawOrFail ( int size_in_bytes,
AllocationType allocation,
AllocationOrigin origin = AllocationOrigin::kRuntime,
AllocationAlignment alignment = kTaggedAligned )
inline

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

Here is the call graph for this function:

◆ AllocateRawWith()

template<typename HeapAllocator::AllocationRetryMode mode>
Tagged< HeapObject > v8::internal::LocalHeap::AllocateRawWith ( int size_in_bytes,
AllocationType allocation,
AllocationOrigin origin = AllocationOrigin::kRuntime,
AllocationAlignment alignment = kTaggedAligned )

Definition at line 36 of file local-heap-inl.h.

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

◆ allocator()

HeapAllocator * v8::internal::LocalHeap::allocator ( )
inline

Definition at line 238 of file local-heap.h.

◆ AsHeap()

Heap * v8::internal::LocalHeap::AsHeap ( ) const
inline

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

Here is the caller graph for this function:

◆ AttachPersistentHandles()

void v8::internal::LocalHeap::AttachPersistentHandles ( std::unique_ptr< PersistentHandles > persistent_handles)

Definition at line 183 of file local-heap.cc.

Here is the caller graph for this function:

◆ deserialization_complete()

bool v8::internal::LocalHeap::deserialization_complete ( ) const
inline

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

◆ DetachPersistentHandles()

std::unique_ptr< PersistentHandles > v8::internal::LocalHeap::DetachPersistentHandles ( )

Definition at line 190 of file local-heap.cc.

Here is the caller graph for this function:

◆ EnsureParkedBeforeDestruction()

void v8::internal::LocalHeap::EnsureParkedBeforeDestruction ( )
private

Definition at line 332 of file local-heap.cc.

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

◆ EnsurePersistentHandles()

void v8::internal::LocalHeap::EnsurePersistentHandles ( )
private

Definition at line 176 of file local-heap.cc.

Here is the call graph for this function:

◆ ExecuteBackgroundThreadWhileParked()

template<typename Callback >
V8_INLINE void v8::internal::LocalHeap::ExecuteBackgroundThreadWhileParked ( Callback callback)

Definition at line 95 of file local-heap-inl.h.

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

◆ ExecuteMainThreadWhileParked()

template<typename Callback >
V8_INLINE void v8::internal::LocalHeap::ExecuteMainThreadWhileParked ( Callback callback)

Definition at line 88 of file local-heap-inl.h.

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

◆ ExecuteWhileParked()

template<typename Callback >
V8_INLINE void v8::internal::LocalHeap::ExecuteWhileParked ( Callback callback)

Definition at line 82 of file local-heap-inl.h.

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

◆ ExecuteWithStackMarker()

template<typename Callback >
V8_INLINE void v8::internal::LocalHeap::ExecuteWithStackMarker ( Callback callback)
private

Definition at line 72 of file local-heap-inl.h.

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

◆ FreeLinearAllocationAreas()

void v8::internal::LocalHeap::FreeLinearAllocationAreas ( )

Definition at line 411 of file local-heap.cc.

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

◆ FreeLinearAllocationAreasAndResetFreeLists()

void v8::internal::LocalHeap::FreeLinearAllocationAreasAndResetFreeLists ( )

Definition at line 445 of file local-heap.cc.

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

◆ FreeSharedLinearAllocationAreasAndResetFreeLists()

void v8::internal::LocalHeap::FreeSharedLinearAllocationAreasAndResetFreeLists ( )

Definition at line 449 of file local-heap.cc.

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

◆ handles()

LocalHandles * v8::internal::LocalHeap::handles ( )
inline

Definition at line 70 of file local-heap.h.

Here is the caller graph for this function:

◆ heap()

Heap * v8::internal::LocalHeap::heap ( ) const
inline

Definition at line 122 of file local-heap.h.

Here is the caller graph for this function:

◆ InvokeGCEpilogueCallbacksInSafepoint()

void v8::internal::LocalHeap::InvokeGCEpilogueCallbacksInSafepoint ( GCCallbacksInSafepoint::GCType gc_type)
private

Definition at line 468 of file local-heap.cc.

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

◆ is_in_trampoline()

V8_INLINE bool v8::internal::LocalHeap::is_in_trampoline ( ) const

Definition at line 103 of file local-heap-inl.h.

Here is the call graph for this function:

◆ is_main_thread()

bool v8::internal::LocalHeap::is_main_thread ( ) const
inline

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

Here is the caller graph for this function:

◆ is_main_thread_for()

bool v8::internal::LocalHeap::is_main_thread_for ( Heap * heap) const
inline

Definition at line 195 of file local-heap.h.

Here is the caller graph for this function:

◆ IsParked()

bool v8::internal::LocalHeap::IsParked ( ) const

Definition at line 210 of file local-heap.cc.

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

◆ IsRetryOfFailedAllocation()

bool v8::internal::LocalHeap::IsRetryOfFailedAllocation ( ) const
inline

Definition at line 118 of file local-heap.h.

Here is the caller graph for this function:

◆ IsRunning()

bool v8::internal::LocalHeap::IsRunning ( ) const

Definition at line 217 of file local-heap.cc.

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

◆ MakeLinearAllocationAreasIterable()

void v8::internal::LocalHeap::MakeLinearAllocationAreasIterable ( )

Definition at line 421 of file local-heap.cc.

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

◆ marking_barrier()

MarkingBarrier * v8::internal::LocalHeap::marking_barrier ( )
inline

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

Here is the caller graph for this function:

◆ MarkLinearAllocationAreasBlack()

void v8::internal::LocalHeap::MarkLinearAllocationAreasBlack ( )

Definition at line 425 of file local-heap.cc.

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

◆ MarkSharedLinearAllocationAreasBlack()

void v8::internal::LocalHeap::MarkSharedLinearAllocationAreasBlack ( )

Definition at line 433 of file local-heap.cc.

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

◆ NewPersistentHandle() [1/3]

template<typename T , template< typename > typename HandleType>
requires (std::is_convertible_v<HandleType<T>, DirectHandle<T>>)
IndirectHandle< T > v8::internal::LocalHeap::NewPersistentHandle ( HandleType< T > object)
inline

Definition at line 81 of file local-heap.h.

◆ NewPersistentHandle() [2/3]

template<typename T >
IndirectHandle< T > v8::internal::LocalHeap::NewPersistentHandle ( T object)
inline

Definition at line 88 of file local-heap.h.

◆ NewPersistentHandle() [3/3]

template<typename T >
IndirectHandle< T > v8::internal::LocalHeap::NewPersistentHandle ( Tagged< T > object)
inline

Definition at line 73 of file local-heap.h.

Here is the caller graph for this function:

◆ NewPersistentMaybeHandle()

template<typename T , template< typename > typename MaybeHandleType>
requires (std::is_convertible_v<MaybeHandleType<T>, MaybeDirectHandle<T>>)
MaybeIndirectHandle< T > v8::internal::LocalHeap::NewPersistentMaybeHandle ( MaybeHandleType< T > maybe_handle)
inline

Definition at line 94 of file local-heap.h.

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

◆ NotifyObjectSizeChange()

void v8::internal::LocalHeap::NotifyObjectSizeChange ( Tagged< HeapObject > object,
int old_size,
int new_size,
ClearRecordedSlots clear_recorded_slots )

Definition at line 473 of file local-heap.cc.

Here is the call graph for this function:

◆ Park()

void v8::internal::LocalHeap::Park ( )
inlineprivate

Definition at line 337 of file local-heap.h.

◆ ParkAndExecuteCallback()

template<typename Callback >
V8_INLINE void v8::internal::LocalHeap::ParkAndExecuteCallback ( Callback callback)
private

Definition at line 54 of file local-heap-inl.h.

Here is the caller graph for this function:

◆ ParkSlowPath()

void v8::internal::LocalHeap::ParkSlowPath ( )
private

Definition at line 224 of file local-heap.cc.

Here is the call graph for this function:

◆ read_only_space()

ReadOnlySpace * v8::internal::LocalHeap::read_only_space ( )
inline

Definition at line 203 of file local-heap.h.

◆ RemoveGCEpilogueCallback()

void v8::internal::LocalHeap::RemoveGCEpilogueCallback ( GCEpilogueCallback * callback,
void * data )

Definition at line 462 of file local-heap.cc.

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

◆ Safepoint()

void v8::internal::LocalHeap::Safepoint ( )
inline

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

Here is the caller graph for this function:

◆ SafepointSlowPath()

void v8::internal::LocalHeap::SafepointSlowPath ( )
private

Definition at line 336 of file local-heap.cc.

Here is the call graph for this function:

◆ SetCurrent()

void v8::internal::LocalHeap::SetCurrent ( LocalHeap * local_heap)
static

Definition at line 36 of file local-heap.cc.

Here is the caller graph for this function:

◆ SetRetryOfFailedAllocation()

void v8::internal::LocalHeap::SetRetryOfFailedAllocation ( bool value)
inline

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

Here is the caller graph for this function:

◆ SetUpMainThread()

void v8::internal::LocalHeap::SetUpMainThread ( LinearAllocationArea & new_allocation_info,
LinearAllocationArea & old_allocation_info )
private

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

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

◆ SetUpMainThreadForTesting()

void v8::internal::LocalHeap::SetUpMainThreadForTesting ( )

Definition at line 129 of file local-heap.cc.

Here is the call graph for this function:

◆ SetUpMarkingBarrier()

void v8::internal::LocalHeap::SetUpMarkingBarrier ( )
private

Definition at line 147 of file local-heap.cc.

Here is the caller graph for this function:

◆ SetUpSharedMarking()

void v8::internal::LocalHeap::SetUpSharedMarking ( )
private

Definition at line 152 of file local-heap.cc.

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

◆ SleepInSafepoint()

void v8::internal::LocalHeap::SleepInSafepoint ( )
private

Definition at line 359 of file local-heap.cc.

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

◆ SleepInUnpark()

void v8::internal::LocalHeap::SleepInUnpark ( )
private

Definition at line 316 of file local-heap.cc.

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

◆ UnmarkLinearAllocationsArea()

void v8::internal::LocalHeap::UnmarkLinearAllocationsArea ( )

Definition at line 429 of file local-heap.cc.

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

◆ UnmarkSharedLinearAllocationsArea()

void v8::internal::LocalHeap::UnmarkSharedLinearAllocationsArea ( )

Definition at line 439 of file local-heap.cc.

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

◆ Unpark()

void v8::internal::LocalHeap::Unpark ( )
inlineprivate

Definition at line 346 of file local-heap.h.

Here is the caller graph for this function:

◆ UnparkSlowPath()

void v8::internal::LocalHeap::UnparkSlowPath ( )
private

Definition at line 276 of file local-heap.cc.

Here is the call graph for this function:

◆ WeakenDescriptorArrays()

void v8::internal::LocalHeap::WeakenDescriptorArrays ( GlobalHandleVector< DescriptorArray > strong_descriptor_arrays)

Definition at line 480 of file local-heap.cc.

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ CollectionBarrier

friend class CollectionBarrier
friend

Definition at line 407 of file local-heap.h.

◆ GlobalSafepoint

friend class GlobalSafepoint
friend

Definition at line 408 of file local-heap.h.

◆ Heap

friend class Heap
friend

Definition at line 409 of file local-heap.h.

◆ Isolate

friend class Isolate
friend

Definition at line 410 of file local-heap.h.

◆ IsolateSafepoint

friend class IsolateSafepoint
friend

Definition at line 411 of file local-heap.h.

◆ IsolateSafepointScope

friend class IsolateSafepointScope
friend

Definition at line 412 of file local-heap.h.

◆ ParkedScope

friend class ParkedScope
friend

Definition at line 413 of file local-heap.h.

◆ UnparkedScope

friend class UnparkedScope
friend

Definition at line 414 of file local-heap.h.

Member Data Documentation

◆ allocation_failed_

bool v8::internal::LocalHeap::allocation_failed_
private

Definition at line 386 of file local-heap.h.

◆ gc_epilogue_callbacks_

GCCallbacksInSafepoint v8::internal::LocalHeap::gc_epilogue_callbacks_
private

Definition at line 398 of file local-heap.h.

◆ handles_

std::unique_ptr<LocalHandles> v8::internal::LocalHeap::handles_
private

Definition at line 394 of file local-heap.h.

◆ heap_

Heap* v8::internal::LocalHeap::heap_
private

Definition at line 376 of file local-heap.h.

◆ heap_allocator_

HeapAllocator v8::internal::LocalHeap::heap_allocator_
private

Definition at line 400 of file local-heap.h.

◆ is_main_thread_

bool v8::internal::LocalHeap::is_main_thread_
private

Definition at line 378 of file local-heap.h.

◆ marking_barrier_

std::unique_ptr<MarkingBarrier> v8::internal::LocalHeap::marking_barrier_
private

Definition at line 396 of file local-heap.h.

◆ nested_parked_scopes_

int v8::internal::LocalHeap::nested_parked_scopes_
private

Definition at line 387 of file local-heap.h.

◆ next_

LocalHeap* v8::internal::LocalHeap::next_
private

Definition at line 392 of file local-heap.h.

◆ persistent_handles_

std::unique_ptr<PersistentHandles> v8::internal::LocalHeap::persistent_handles_
private

Definition at line 395 of file local-heap.h.

◆ prev_

LocalHeap* v8::internal::LocalHeap::prev_
private

Definition at line 391 of file local-heap.h.

◆ ptr_compr_cage_access_scope_

V8_NO_UNIQUE_ADDRESS PtrComprCageAccessScope v8::internal::LocalHeap::ptr_compr_cage_access_scope_
private

Definition at line 377 of file local-heap.h.

◆ saved_current_isolate_

Isolate* v8::internal::LocalHeap::saved_current_isolate_ = nullptr
private

Definition at line 389 of file local-heap.h.

◆ saved_marking_barrier_

MarkingBarrier* v8::internal::LocalHeap::saved_marking_barrier_ = nullptr
private

Definition at line 402 of file local-heap.h.

◆ stack_

::heap::base::Stack v8::internal::LocalHeap::stack_
private

Definition at line 405 of file local-heap.h.

◆ state_

AtomicThreadState v8::internal::LocalHeap::state_
private

Definition at line 380 of file local-heap.h.


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