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

#include <memory-chunk.h>

Collaboration diagram for v8::internal::MemoryChunk:

Public Types

enum  Flag : uintptr_t {
  NO_FLAGS = 0u , IN_WRITABLE_SHARED_SPACE = 1u << 0 , POINTERS_TO_HERE_ARE_INTERESTING = 1u << 1 , POINTERS_FROM_HERE_ARE_INTERESTING = 1u << 2 ,
  FROM_PAGE = 1u << 3 , TO_PAGE = 1u << 4 , INCREMENTAL_MARKING = 1u << 5 , READ_ONLY_HEAP = 1u << 6 ,
  IS_MAJOR_GC_IN_PROGRESS = 1u << 7 , CONTAINS_ONLY_OLD = 1u << 8 , BLACK_ALLOCATED = 1u << 9 , LARGE_PAGE = 1u << 10 ,
  EVACUATION_CANDIDATE = 1u << 11 , NEVER_EVACUATE = 1u << 12 , PAGE_NEW_OLD_PROMOTION = 1u << 13 , FORCE_EVACUATION_CANDIDATE_FOR_TESTING = 1u << 14 ,
  NEVER_ALLOCATE_ON_PAGE = 1u << 15 , PRE_FREED = 1u << 16 , COMPACTION_WAS_ABORTED = 1u << 17 , NEW_SPACE_BELOW_AGE_MARK = 1u << 18 ,
  UNREGISTERED = 1u << 19 , PINNED = 1u << 20 , IS_EXECUTABLE = 1u << 21 , IS_TRUSTED = 1u << 22 ,
  IS_QUARANTINED = 1u << 23 , WILL_BE_PROMOTED = 1u << 24
}
 
using MainThreadFlags = base::Flags<Flag, uintptr_t>
 

Public Member Functions

 MemoryChunk (MainThreadFlags flags, MemoryChunkMetadata *metadata)
 
V8_INLINE Address address () const
 
V8_INLINE MemoryChunkMetadataMetadata ()
 
V8_INLINE const MemoryChunkMetadataMetadata () const
 
V8_INLINE bool IsFlagSet (Flag flag) const
 
V8_INLINE bool IsMarking () const
 
V8_INLINE bool InWritableSharedSpace () const
 
V8_INLINE bool InYoungGeneration () const
 
V8_INLINE bool IsYoungOrSharedChunk () const
 
void SetFlagSlow (Flag flag)
 
void ClearFlagSlow (Flag flag)
 
V8_INLINE MainThreadFlags GetFlags () const
 
V8_INLINE void SetFlagUnlocked (Flag flag)
 
V8_INLINE void ClearFlagUnlocked (Flag flag)
 
V8_INLINE void ClearFlagsUnlocked (MainThreadFlags flags)
 
V8_INLINE void SetFlagsUnlocked (MainThreadFlags flags, MainThreadFlags mask=kAllFlagsMask)
 
V8_INLINE void SetFlagNonExecutable (Flag flag)
 
V8_INLINE void ClearFlagNonExecutable (Flag flag)
 
V8_INLINE void SetFlagsNonExecutable (MainThreadFlags flags, MainThreadFlags mask=kAllFlagsMask)
 
V8_INLINE void ClearFlagsNonExecutable (MainThreadFlags flags)
 
V8_INLINE void SetMajorGCInProgress ()
 
V8_INLINE void ResetMajorGCInProgress ()
 
V8_INLINE HeapGetHeap ()
 
void InitializationMemoryFence ()
 
V8_INLINE bool InReadOnlySpace () const
 
V8_INLINE bool InCodeSpace () const
 
V8_INLINE bool InTrustedSpace () const
 
bool NeverEvacuate () const
 
void MarkNeverEvacuate ()
 
bool CanAllocate () const
 
bool IsEvacuationCandidate () const
 
bool ShouldSkipEvacuationSlotRecording () const
 
Executability executable () const
 
bool IsFromPage () const
 
bool IsToPage () const
 
bool IsLargePage () const
 
bool InNewSpace () const
 
bool InNewLargeObjectSpace () const
 
bool IsPinned () const
 
bool IsOnlyOldOrMajorMarkingOn () const
 
bool IsQuarantined () const
 
void SetOldGenerationPageFlags (MarkingMode marking_mode, AllocationSpace space)
 
void SetYoungGenerationPageFlags (MarkingMode marking_mode)
 
bool IsTrusted () const
 
size_t Offset (Address addr) const
 
size_t OffsetMaybeOutOfRange (Address addr) const
 

Static Public Member Functions

static constexpr Address BaseAddress (Address a)
 
static V8_INLINE MemoryChunkFromAddress (Address addr)
 
template<typename HeapObject >
static V8_INLINE MemoryChunkFromHeapObject (Tagged< HeapObject > object)
 
static V8_INLINE constexpr bool IsAligned (Address address)
 
static MainThreadFlags OldGenerationPageFlags (MarkingMode marking_mode, AllocationSpace space)
 
static MainThreadFlags YoungGenerationPageFlags (MarkingMode marking_mode)
 
static intptr_t GetAlignmentForAllocation ()
 
static constexpr intptr_t GetAlignmentMaskForAssembler ()
 
static constexpr uint32_t AddressToOffset (Address address)
 

Static Public Attributes

static constexpr MainThreadFlags kAllFlagsMask = ~MainThreadFlags(NO_FLAGS)
 
static constexpr MainThreadFlags kPointersToHereAreInterestingMask
 
static constexpr MainThreadFlags kPointersFromHereAreInterestingMask
 
static constexpr MainThreadFlags kEvacuationCandidateMask
 
static constexpr MainThreadFlags kIsInYoungGenerationMask
 
static constexpr MainThreadFlags kIsInReadOnlyHeapMask = READ_ONLY_HEAP
 
static constexpr MainThreadFlags kIsLargePageMask = LARGE_PAGE
 
static constexpr MainThreadFlags kInSharedHeap = IN_WRITABLE_SHARED_SPACE
 
static constexpr MainThreadFlags kIncrementalMarking = INCREMENTAL_MARKING
 
static constexpr MainThreadFlags kSkipEvacuationSlotsRecordingMask
 
static constexpr MainThreadFlags kIsOnlyOldOrMajorGCInProgressMask
 

Static Private Member Functions

static constexpr intptr_t FlagsOffset ()
 
static constexpr intptr_t MetadataOffset ()
 

Private Attributes

MainThreadFlags main_thread_flags_
 
MemoryChunkMetadatametadata_
 

Static Private Attributes

static constexpr intptr_t kAlignment
 
static constexpr intptr_t kAlignmentMask = kAlignment - 1
 

Friends

class CodeStubAssembler
 
class MacroAssembler
 

Detailed Description

Definition at line 40 of file memory-chunk.h.

Member Typedef Documentation

◆ MainThreadFlags

Definition at line 142 of file memory-chunk.h.

Member Enumeration Documentation

◆ Flag

Enumerator
NO_FLAGS 
IN_WRITABLE_SHARED_SPACE 
POINTERS_TO_HERE_ARE_INTERESTING 
POINTERS_FROM_HERE_ARE_INTERESTING 
FROM_PAGE 
TO_PAGE 
INCREMENTAL_MARKING 
READ_ONLY_HEAP 
IS_MAJOR_GC_IN_PROGRESS 
CONTAINS_ONLY_OLD 
BLACK_ALLOCATED 
LARGE_PAGE 
EVACUATION_CANDIDATE 
NEVER_EVACUATE 
PAGE_NEW_OLD_PROMOTION 
FORCE_EVACUATION_CANDIDATE_FOR_TESTING 
NEVER_ALLOCATE_ON_PAGE 
PRE_FREED 
COMPACTION_WAS_ABORTED 
NEW_SPACE_BELOW_AGE_MARK 
UNREGISTERED 
PINNED 
IS_EXECUTABLE 
IS_TRUSTED 
IS_QUARANTINED 
WILL_BE_PROMOTED 

Definition at line 45 of file memory-chunk.h.

Constructor & Destructor Documentation

◆ MemoryChunk()

v8::internal::MemoryChunk::MemoryChunk ( MainThreadFlags flags,
MemoryChunkMetadata * metadata )

Definition at line 43 of file memory-chunk.cc.

Here is the call graph for this function:

Member Function Documentation

◆ address()

V8_INLINE Address v8::internal::MemoryChunk::address ( ) const
inline

Definition at line 166 of file memory-chunk.h.

Here is the caller graph for this function:

◆ AddressToOffset()

static constexpr uint32_t v8::internal::MemoryChunk::AddressToOffset ( Address address)
inlinestaticconstexpr

Definition at line 343 of file memory-chunk.h.

Here is the caller graph for this function:

◆ BaseAddress()

static constexpr Address v8::internal::MemoryChunk::BaseAddress ( Address a)
inlinestaticconstexpr

Definition at line 168 of file memory-chunk.h.

◆ CanAllocate()

bool v8::internal::MemoryChunk::CanAllocate ( ) const
inline

Definition at line 277 of file memory-chunk.h.

Here is the caller graph for this function:

◆ ClearFlagNonExecutable()

V8_INLINE void v8::internal::MemoryChunk::ClearFlagNonExecutable ( Flag flag)
inline

Definition at line 233 of file memory-chunk.h.

Here is the caller graph for this function:

◆ ClearFlagSlow()

void v8::internal::MemoryChunk::ClearFlagSlow ( Flag flag)

Definition at line 189 of file memory-chunk.cc.

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

◆ ClearFlagsNonExecutable()

V8_INLINE void v8::internal::MemoryChunk::ClearFlagsNonExecutable ( MainThreadFlags flags)
inline

Definition at line 240 of file memory-chunk.h.

Here is the caller graph for this function:

◆ ClearFlagsUnlocked()

V8_INLINE void v8::internal::MemoryChunk::ClearFlagsUnlocked ( MainThreadFlags flags)
inline

Definition at line 222 of file memory-chunk.h.

Here is the caller graph for this function:

◆ ClearFlagUnlocked()

V8_INLINE void v8::internal::MemoryChunk::ClearFlagUnlocked ( Flag flag)
inline

Definition at line 217 of file memory-chunk.h.

Here is the caller graph for this function:

◆ executable()

Executability v8::internal::MemoryChunk::executable ( ) const
inline

Definition at line 292 of file memory-chunk.h.

Here is the caller graph for this function:

◆ FlagsOffset()

static constexpr intptr_t v8::internal::MemoryChunk::FlagsOffset ( )
inlinestaticconstexprprivate

Definition at line 364 of file memory-chunk.h.

Here is the caller graph for this function:

◆ FromAddress()

static V8_INLINE MemoryChunk * v8::internal::MemoryChunk::FromAddress ( Address addr)
inlinestatic

Definition at line 175 of file memory-chunk.h.

Here is the caller graph for this function:

◆ FromHeapObject()

template<typename HeapObject >
static V8_INLINE MemoryChunk * v8::internal::MemoryChunk::FromHeapObject ( Tagged< HeapObject > object)
inlinestatic

Definition at line 180 of file memory-chunk.h.

◆ GetAlignmentForAllocation()

static intptr_t v8::internal::MemoryChunk::GetAlignmentForAllocation ( )
inlinestatic

Definition at line 334 of file memory-chunk.h.

Here is the caller graph for this function:

◆ GetAlignmentMaskForAssembler()

static constexpr intptr_t v8::internal::MemoryChunk::GetAlignmentMaskForAssembler ( )
inlinestaticconstexpr

Definition at line 339 of file memory-chunk.h.

Here is the caller graph for this function:

◆ GetFlags()

V8_INLINE MainThreadFlags v8::internal::MemoryChunk::GetFlags ( ) const
inline

Definition at line 214 of file memory-chunk.h.

Here is the caller graph for this function:

◆ GetHeap()

Heap * v8::internal::MemoryChunk::GetHeap ( )

Definition at line 40 of file memory-chunk-inl.h.

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

◆ InCodeSpace()

V8_INLINE bool v8::internal::MemoryChunk::InCodeSpace ( ) const
inline

Definition at line 270 of file memory-chunk.h.

Here is the caller graph for this function:

◆ InitializationMemoryFence()

void v8::internal::MemoryChunk::InitializationMemoryFence ( )

Definition at line 100 of file memory-chunk.cc.

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

◆ InNewLargeObjectSpace()

bool v8::internal::MemoryChunk::InNewLargeObjectSpace ( ) const
inline

Definition at line 306 of file memory-chunk.h.

◆ InNewSpace()

bool v8::internal::MemoryChunk::InNewSpace ( ) const
inline

Definition at line 305 of file memory-chunk.h.

Here is the caller graph for this function:

◆ InReadOnlySpace()

V8_INLINE bool v8::internal::MemoryChunk::InReadOnlySpace ( ) const
inline

Definition at line 260 of file memory-chunk.h.

Here is the caller graph for this function:

◆ InTrustedSpace()

V8_INLINE bool v8::internal::MemoryChunk::InTrustedSpace ( ) const
inline

Definition at line 272 of file memory-chunk.h.

Here is the caller graph for this function:

◆ InWritableSharedSpace()

V8_INLINE bool v8::internal::MemoryChunk::InWritableSharedSpace ( ) const
inline

Definition at line 194 of file memory-chunk.h.

Here is the caller graph for this function:

◆ InYoungGeneration()

V8_INLINE bool v8::internal::MemoryChunk::InYoungGeneration ( ) const
inline

Definition at line 198 of file memory-chunk.h.

Here is the caller graph for this function:

◆ IsAligned()

static V8_INLINE constexpr bool v8::internal::MemoryChunk::IsAligned ( Address address)
inlinestaticconstexpr

Definition at line 316 of file memory-chunk.h.

Here is the caller graph for this function:

◆ IsEvacuationCandidate()

bool v8::internal::MemoryChunk::IsEvacuationCandidate ( ) const
inline

Definition at line 281 of file memory-chunk.h.

Here is the caller graph for this function:

◆ IsFlagSet()

V8_INLINE bool v8::internal::MemoryChunk::IsFlagSet ( Flag flag) const
inline

Definition at line 188 of file memory-chunk.h.

Here is the caller graph for this function:

◆ IsFromPage()

bool v8::internal::MemoryChunk::IsFromPage ( ) const
inline

Definition at line 296 of file memory-chunk.h.

Here is the caller graph for this function:

◆ IsLargePage()

bool v8::internal::MemoryChunk::IsLargePage ( ) const
inline

Definition at line 304 of file memory-chunk.h.

Here is the caller graph for this function:

◆ IsMarking()

V8_INLINE bool v8::internal::MemoryChunk::IsMarking ( ) const
inline

Definition at line 192 of file memory-chunk.h.

Here is the caller graph for this function:

◆ IsOnlyOldOrMajorMarkingOn()

bool v8::internal::MemoryChunk::IsOnlyOldOrMajorMarkingOn ( ) const
inline

Definition at line 310 of file memory-chunk.h.

Here is the caller graph for this function:

◆ IsPinned()

bool v8::internal::MemoryChunk::IsPinned ( ) const
inline

Definition at line 309 of file memory-chunk.h.

Here is the caller graph for this function:

◆ IsQuarantined()

bool v8::internal::MemoryChunk::IsQuarantined ( ) const
inline

Definition at line 314 of file memory-chunk.h.

Here is the caller graph for this function:

◆ IsToPage()

bool v8::internal::MemoryChunk::IsToPage ( ) const
inline

Definition at line 300 of file memory-chunk.h.

Here is the caller graph for this function:

◆ IsTrusted()

bool v8::internal::MemoryChunk::IsTrusted ( ) const
inline

Definition at line 331 of file memory-chunk.h.

Here is the caller graph for this function:

◆ IsYoungOrSharedChunk()

V8_INLINE bool v8::internal::MemoryChunk::IsYoungOrSharedChunk ( ) const
inline

Definition at line 205 of file memory-chunk.h.

Here is the caller graph for this function:

◆ MarkNeverEvacuate()

void v8::internal::MemoryChunk::MarkNeverEvacuate ( )
inline

Definition at line 275 of file memory-chunk.h.

Here is the caller graph for this function:

◆ Metadata() [1/2]

MemoryChunkMetadata * v8::internal::MemoryChunk::Metadata ( )

Definition at line 17 of file memory-chunk-inl.h.

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

◆ Metadata() [2/2]

const MemoryChunkMetadata * v8::internal::MemoryChunk::Metadata ( ) const

Definition at line 36 of file memory-chunk-inl.h.

Here is the call graph for this function:

◆ MetadataOffset()

static constexpr intptr_t v8::internal::MemoryChunk::MetadataOffset ( )
inlinestaticconstexprprivate

Definition at line 396 of file memory-chunk.h.

◆ NeverEvacuate()

bool v8::internal::MemoryChunk::NeverEvacuate ( ) const
inline

Definition at line 274 of file memory-chunk.h.

Here is the caller graph for this function:

◆ Offset()

size_t v8::internal::MemoryChunk::Offset ( Address addr) const
inline

Definition at line 353 of file memory-chunk.h.

Here is the caller graph for this function:

◆ OffsetMaybeOutOfRange()

size_t v8::internal::MemoryChunk::OffsetMaybeOutOfRange ( Address addr) const
inline

Definition at line 354 of file memory-chunk.h.

Here is the caller graph for this function:

◆ OldGenerationPageFlags()

MemoryChunk::MainThreadFlags v8::internal::MemoryChunk::OldGenerationPageFlags ( MarkingMode marking_mode,
AllocationSpace space )
static

Definition at line 199 of file memory-chunk.cc.

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

◆ ResetMajorGCInProgress()

V8_INLINE void v8::internal::MemoryChunk::ResetMajorGCInProgress ( )
inline

Definition at line 246 of file memory-chunk.h.

◆ SetFlagNonExecutable()

V8_INLINE void v8::internal::MemoryChunk::SetFlagNonExecutable ( Flag flag)
inline

Definition at line 230 of file memory-chunk.h.

Here is the caller graph for this function:

◆ SetFlagSlow()

void v8::internal::MemoryChunk::SetFlagSlow ( Flag flag)

Definition at line 180 of file memory-chunk.cc.

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

◆ SetFlagsNonExecutable()

V8_INLINE void v8::internal::MemoryChunk::SetFlagsNonExecutable ( MainThreadFlags flags,
MainThreadFlags mask = kAllFlagsMask )
inline

Definition at line 236 of file memory-chunk.h.

Here is the caller graph for this function:

◆ SetFlagsUnlocked()

V8_INLINE void v8::internal::MemoryChunk::SetFlagsUnlocked ( MainThreadFlags flags,
MainThreadFlags mask = kAllFlagsMask )
inline

Definition at line 225 of file memory-chunk.h.

Here is the caller graph for this function:

◆ SetFlagUnlocked()

V8_INLINE void v8::internal::MemoryChunk::SetFlagUnlocked ( Flag flag)
inline

Definition at line 216 of file memory-chunk.h.

Here is the caller graph for this function:

◆ SetMajorGCInProgress()

V8_INLINE void v8::internal::MemoryChunk::SetMajorGCInProgress ( )
inline

Definition at line 243 of file memory-chunk.h.

◆ SetOldGenerationPageFlags()

void v8::internal::MemoryChunk::SetOldGenerationPageFlags ( MarkingMode marking_mode,
AllocationSpace space )

Definition at line 239 of file memory-chunk.cc.

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

◆ SetYoungGenerationPageFlags()

void v8::internal::MemoryChunk::SetYoungGenerationPageFlags ( MarkingMode marking_mode)

Definition at line 261 of file memory-chunk.cc.

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

◆ ShouldSkipEvacuationSlotRecording()

bool v8::internal::MemoryChunk::ShouldSkipEvacuationSlotRecording ( ) const
inline

Definition at line 286 of file memory-chunk.h.

Here is the caller graph for this function:

◆ YoungGenerationPageFlags()

MemoryChunk::MainThreadFlags v8::internal::MemoryChunk::YoungGenerationPageFlags ( MarkingMode marking_mode)
static

Definition at line 226 of file memory-chunk.cc.

Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ CodeStubAssembler

friend class CodeStubAssembler
friend

Definition at line 414 of file memory-chunk.h.

◆ MacroAssembler

friend class MacroAssembler
friend

Definition at line 415 of file memory-chunk.h.

Member Data Documentation

◆ kAlignment

intptr_t v8::internal::MemoryChunk::kAlignment
staticconstexprprivate
Initial value:
=
(static_cast<uintptr_t>(1) << kPageSizeBits)
constexpr int kPageSizeBits

Definition at line 368 of file memory-chunk.h.

◆ kAlignmentMask

intptr_t v8::internal::MemoryChunk::kAlignmentMask = kAlignment - 1
staticconstexprprivate

Definition at line 370 of file memory-chunk.h.

◆ kAllFlagsMask

MemoryChunk::MainThreadFlags v8::internal::MemoryChunk::kAllFlagsMask = ~MainThreadFlags(NO_FLAGS)
staticconstexpr

Definition at line 144 of file memory-chunk.h.

◆ kEvacuationCandidateMask

MemoryChunk::MainThreadFlags v8::internal::MemoryChunk::kEvacuationCandidateMask
staticconstexpr
Initial value:

Definition at line 149 of file memory-chunk.h.

◆ kIncrementalMarking

MainThreadFlags v8::internal::MemoryChunk::kIncrementalMarking = INCREMENTAL_MARKING
staticconstexpr

Definition at line 156 of file memory-chunk.h.

◆ kInSharedHeap

MainThreadFlags v8::internal::MemoryChunk::kInSharedHeap = IN_WRITABLE_SHARED_SPACE
staticconstexpr

Definition at line 155 of file memory-chunk.h.

◆ kIsInReadOnlyHeapMask

MainThreadFlags v8::internal::MemoryChunk::kIsInReadOnlyHeapMask = READ_ONLY_HEAP
staticconstexpr

Definition at line 153 of file memory-chunk.h.

◆ kIsInYoungGenerationMask

MemoryChunk::MainThreadFlags v8::internal::MemoryChunk::kIsInYoungGenerationMask
staticconstexpr
Initial value:

Definition at line 151 of file memory-chunk.h.

◆ kIsLargePageMask

MemoryChunk::MainThreadFlags v8::internal::MemoryChunk::kIsLargePageMask = LARGE_PAGE
staticconstexpr

Definition at line 154 of file memory-chunk.h.

◆ kIsOnlyOldOrMajorGCInProgressMask

MainThreadFlags v8::internal::MemoryChunk::kIsOnlyOldOrMajorGCInProgressMask
staticconstexpr

◆ kPointersFromHereAreInterestingMask

MemoryChunk::MainThreadFlags v8::internal::MemoryChunk::kPointersFromHereAreInterestingMask
staticconstexpr
Initial value:

Definition at line 147 of file memory-chunk.h.

◆ kPointersToHereAreInterestingMask

MemoryChunk::MainThreadFlags v8::internal::MemoryChunk::kPointersToHereAreInterestingMask
staticconstexpr
Initial value:

Definition at line 145 of file memory-chunk.h.

◆ kSkipEvacuationSlotsRecordingMask

MemoryChunk::MainThreadFlags v8::internal::MemoryChunk::kSkipEvacuationSlotsRecordingMask
staticconstexpr
Initial value:
=
static constexpr MainThreadFlags kIsInYoungGenerationMask
static constexpr MainThreadFlags kEvacuationCandidateMask

Definition at line 157 of file memory-chunk.h.

◆ main_thread_flags_

MainThreadFlags v8::internal::MemoryChunk::main_thread_flags_
private

Definition at line 404 of file memory-chunk.h.

◆ metadata_

MemoryChunkMetadata* v8::internal::MemoryChunk::metadata_
private

Definition at line 409 of file memory-chunk.h.


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