V8 Project
v8::internal::Page Class Reference

#include <spaces.h>

+ Inheritance diagram for v8::internal::Page:
+ Collaboration diagram for v8::internal::Page:

Public Member Functions

 INLINE (static Page *FromAddress(Address a))
 
 INLINE (static Page *FromAllocationTop(Address top))
 
Pagenext_page ()
 
Pageprev_page ()
 
void set_next_page (Page *page)
 
void set_prev_page (Page *page)
 
 INLINE (int Offset(Address a))
 
Address OffsetToAddress (int offset)
 
void ClearGCFields ()
 
void InitializeAsAnchor (PagedSpace *owner)
 
bool WasSwept ()
 
void SetWasSwept ()
 
void ClearWasSwept ()
 
void ResetFreeListStatistics ()
 
- Public Member Functions inherited from v8::internal::MemoryChunk
Address address ()
 
bool is_valid ()
 
MemoryChunknext_chunk () const
 
MemoryChunkprev_chunk () const
 
void set_next_chunk (MemoryChunk *next)
 
void set_prev_chunk (MemoryChunk *prev)
 
Spaceowner () const
 
void set_owner (Space *space)
 
base::VirtualMemoryreserved_memory ()
 
void InitializeReservedMemory ()
 
void set_reserved_memory (base::VirtualMemory *reservation)
 
bool scan_on_scavenge ()
 
void initialize_scan_on_scavenge (bool scan)
 
void set_scan_on_scavenge (bool scan)
 
int store_buffer_counter ()
 
void set_store_buffer_counter (int counter)
 
bool Contains (Address addr)
 
bool ContainsLimit (Address addr)
 
void SetFlag (int flag)
 
void ClearFlag (int flag)
 
void SetFlagTo (int flag, bool value)
 
bool IsFlagSet (int flag)
 
void SetFlags (intptr_t flags, intptr_t mask)
 
intptr_t GetFlags ()
 
ParallelSweepingState parallel_sweeping ()
 
void set_parallel_sweeping (ParallelSweepingState state)
 
bool TryParallelSweeping ()
 
bool SweepingCompleted ()
 
void ResetLiveBytes ()
 
void IncrementLiveBytes (int by)
 
int LiveBytes ()
 
int write_barrier_counter ()
 
void set_write_barrier_counter (int counter)
 
int progress_bar ()
 
void set_progress_bar (int progress_bar)
 
void ResetProgressBar ()
 
bool IsLeftOfProgressBar (Object **slot)
 
size_t size () const
 
void set_size (size_t size)
 
void SetArea (Address area_start, Address area_end)
 
Executability executable ()
 
bool ContainsOnlyData ()
 
bool InNewSpace ()
 
bool InToSpace ()
 
bool InFromSpace ()
 
Bitmapmarkbits ()
 
void PrintMarkbits ()
 
uint32_t AddressToMarkbitIndex (Address addr)
 
Address MarkbitIndexToAddress (uint32_t index)
 
void InsertAfter (MemoryChunk *other)
 
void Unlink ()
 
Heapheap () const
 
bool IsEvacuationCandidate ()
 
bool ShouldSkipEvacuationSlotRecording ()
 
SkipListskip_list ()
 
void set_skip_list (SkipList *skip_list)
 
SlotsBufferslots_buffer ()
 
SlotsBuffer ** slots_buffer_address ()
 
void MarkEvacuationCandidate ()
 
void ClearEvacuationCandidate ()
 
Address area_start ()
 
Address area_end ()
 
int area_size ()
 
bool CommitArea (size_t requested)
 
size_t CommittedPhysicalMemory ()
 

Static Public Member Functions

static bool IsAlignedToPageSize (Address a)
 
static PageInitialize (Heap *heap, MemoryChunk *chunk, Executability executable, PagedSpace *owner)
 
- Static Public Member Functions inherited from v8::internal::MemoryChunk
static MemoryChunkFromAddress (Address a)
 
static const MemoryChunkFromAddress (const byte *a)
 
static MemoryChunkFromAnyPointerAddress (Heap *heap, Address addr)
 
static void IncrementLiveBytesFromGC (Address address, int by)
 
static void IncrementLiveBytesFromMutator (Address address, int by)
 
static uint32_t FastAddressToMarkbitIndex (Address addr)
 
static void UpdateHighWaterMark (Address mark)
 

Static Public Attributes

static const int kPageSize = 1 << kPageSizeBits
 
static const int kMaxRegularHeapObjectSize = kPageSize - kObjectStartOffset
 
static const intptr_t kPageAlignmentMask = (1 << kPageSizeBits) - 1
 
- Static Public Attributes inherited from v8::internal::MemoryChunk
static const int kWriteBarrierCounterGranularity = 500
 
static const int kPointersToHereAreInterestingMask
 
static const int kPointersFromHereAreInterestingMask
 
static const int kEvacuationCandidateMask = 1 << EVACUATION_CANDIDATE
 
static const int kSkipEvacuationSlotsRecordingMask
 
static const intptr_t kAlignment
 
static const intptr_t kAlignmentMask = kAlignment - 1
 
static const intptr_t kSizeOffset = 0
 
static const intptr_t kLiveBytesOffset
 
static const size_t kSlotsBufferOffset = kLiveBytesOffset + kIntSize
 
static const size_t kWriteBarrierCounterOffset
 
static const size_t kHeaderSize
 
static const int kBodyOffset
 
static const int kObjectStartAlignment = 32 * kPointerSize
 
static const int kObjectStartOffset
 
static const int kFlagsOffset = kPointerSize
 

Friends

class MemoryAllocator
 

Additional Inherited Members

- Public Types inherited from v8::internal::MemoryChunk
enum  MemoryChunkFlags {
  IS_EXECUTABLE , ABOUT_TO_BE_FREED , POINTERS_TO_HERE_ARE_INTERESTING , POINTERS_FROM_HERE_ARE_INTERESTING ,
  SCAN_ON_SCAVENGE , IN_FROM_SPACE , IN_TO_SPACE , NEW_SPACE_BELOW_AGE_MARK ,
  CONTAINS_ONLY_DATA , EVACUATION_CANDIDATE , RESCAN_ON_EVACUATION , WAS_SWEPT ,
  HAS_PROGRESS_BAR , NUM_MEMORY_CHUNK_FLAGS
}
 
enum  ParallelSweepingState { SWEEPING_DONE , SWEEPING_FINALIZE , SWEEPING_IN_PROGRESS , SWEEPING_PENDING }
 
- Static Protected Member Functions inherited from v8::internal::MemoryChunk
static MemoryChunkInitialize (Heap *heap, Address base, size_t size, Address area_start, Address area_end, Executability executable, Space *owner)
 
- Protected Attributes inherited from v8::internal::MemoryChunk
size_t size_
 
intptr_t flags_
 
Address area_start_
 
Address area_end_
 
base::VirtualMemory reservation_
 
Address owner_
 
Heapheap_
 
int store_buffer_counter_
 
int live_byte_count_
 
SlotsBufferslots_buffer_
 
SkipListskip_list_
 
intptr_t write_barrier_counter_
 
int progress_bar_
 
int high_water_mark_
 
base::AtomicWord parallel_sweeping_
 
intptr_t available_in_small_free_list_
 
intptr_t available_in_medium_free_list_
 
intptr_t available_in_large_free_list_
 
intptr_t available_in_huge_free_list_
 
intptr_t non_available_small_blocks_
 

Detailed Description

Definition at line 703 of file spaces.h.

Member Function Documentation

◆ ClearGCFields()

void v8::internal::Page::ClearGCFields ( )
inline

◆ ClearWasSwept()

void v8::internal::Page::ClearWasSwept ( )
inline

Definition at line 768 of file spaces.h.

References v8::internal::MemoryChunk::ClearFlag(), and v8::internal::MemoryChunk::WAS_SWEPT.

Referenced by v8::internal::MarkCompactCollector::SweepSpace().

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

◆ Initialize()

Page * v8::internal::Page::Initialize ( Heap heap,
MemoryChunk chunk,
Executability  executable,
PagedSpace owner 
)
inlinestatic

Definition at line 136 of file spaces-inl.h.

137  {
138  Page* page = reinterpret_cast<Page*>(chunk);
139  DCHECK(page->area_size() <= kMaxRegularHeapObjectSize);
140  DCHECK(chunk->owner() == owner);
141  owner->IncreaseCapacity(page->area_size());
142  owner->Free(page->area_start(), page->area_size());
143 
145 
146  return page;
147 }
IncrementalMarking * incremental_marking()
Definition: heap.h:1205
void SetOldSpacePageFlags(MemoryChunk *chunk)
Heap * heap() const
Definition: spaces.h:603
Space * owner() const
Definition: spaces.h:307
static const int kMaxRegularHeapObjectSize
Definition: spaces.h:754
#define DCHECK(condition)
Definition: logging.h:205

References v8::internal::MemoryChunk::area_size(), v8::internal::MemoryChunk::area_start(), DCHECK, v8::internal::MemoryChunk::heap(), v8::internal::Heap::incremental_marking(), kMaxRegularHeapObjectSize, v8::internal::MemoryChunk::owner(), and v8::internal::IncrementalMarking::SetOldSpacePageFlags().

Referenced by v8::internal::MemoryAllocator::AllocatePage(), and v8::internal::PagedSpace::UseEmergencyMemory().

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

◆ InitializeAsAnchor()

void v8::internal::Page::InitializeAsAnchor ( PagedSpace owner)

Definition at line 391 of file spaces.cc.

391  {
392  set_owner(owner);
393  set_prev_page(this);
394  set_next_page(this);
395 }
void set_owner(Space *space)
Definition: spaces.h:317
void set_next_page(Page *page)
Definition: spaces-inl.h:221
void set_prev_page(Page *page)
Definition: spaces-inl.h:227

References v8::internal::MemoryChunk::owner(), set_next_page(), v8::internal::MemoryChunk::set_owner(), and set_prev_page().

Referenced by v8::internal::PagedSpace::PagedSpace().

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

◆ INLINE() [1/3]

v8::internal::Page::INLINE ( int   OffsetAddress a)
inline

Definition at line 734 of file spaces.h.

734  {
735  int offset = static_cast<int>(a - address());
736  return offset;
737  }

References v8::internal::MemoryChunk::address().

+ Here is the call graph for this function:

◆ INLINE() [2/3]

v8::internal::Page::INLINE ( static Page FromAddressAddress a)
inline

Definition at line 709 of file spaces.h.

709  {
710  return reinterpret_cast<Page*>(OffsetFrom(a) & ~kPageAlignmentMask);
711  }
static const intptr_t kPageAlignmentMask
Definition: spaces.h:757
intptr_t OffsetFrom(T x)
Definition: macros.h:383

References kPageAlignmentMask, and OffsetFrom().

+ Here is the call graph for this function:

◆ INLINE() [3/3]

v8::internal::Page::INLINE ( static Page FromAllocationTopAddress top)
inline

Definition at line 717 of file spaces.h.

717  {
718  Page* p = FromAddress(top - kPointerSize);
719  return p;
720  }
static MemoryChunk * FromAddress(Address a)
Definition: spaces.h:276
const int kPointerSize
Definition: globals.h:129

References v8::internal::MemoryChunk::FromAddress(), and v8::internal::kPointerSize.

+ Here is the call graph for this function:

◆ IsAlignedToPageSize()

static bool v8::internal::Page::IsAlignedToPageSize ( Address  a)
inlinestatic

Definition at line 729 of file spaces.h.

729  {
730  return 0 == (OffsetFrom(a) & kPageAlignmentMask);
731  }

References kPageAlignmentMask, and OffsetFrom().

+ Here is the call graph for this function:

◆ next_page()

Page * v8::internal::Page::next_page ( )
inline

Definition at line 209 of file spaces-inl.h.

209  {
210  DCHECK(next_chunk()->owner() == owner());
211  return static_cast<Page*>(next_chunk());
212 }
MemoryChunk * next_chunk() const
Definition: spaces.h:291

References DCHECK, v8::internal::MemoryChunk::next_chunk(), and v8::internal::MemoryChunk::owner().

Referenced by v8::internal::HeapObjectIterator::AdvanceToNextPage(), v8::internal::PagedSpace::Expand(), and v8::internal::PagedSpace::FirstPage().

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

◆ OffsetToAddress()

Address v8::internal::Page::OffsetToAddress ( int  offset)
inline

Definition at line 740 of file spaces.h.

740  {
741  DCHECK_PAGE_OFFSET(offset);
742  return address() + offset;
743  }
#define DCHECK_PAGE_OFFSET(offset)
Definition: spaces.h:87

References v8::internal::MemoryChunk::address(), and DCHECK_PAGE_OFFSET.

+ Here is the call graph for this function:

◆ prev_page()

Page * v8::internal::Page::prev_page ( )
inline

Definition at line 215 of file spaces-inl.h.

215  {
216  DCHECK(prev_chunk()->owner() == owner());
217  return static_cast<Page*>(prev_chunk());
218 }
MemoryChunk * prev_chunk() const
Definition: spaces.h:295

References DCHECK, v8::internal::MemoryChunk::owner(), and v8::internal::MemoryChunk::prev_chunk().

Referenced by v8::internal::PagedSpace::Expand(), v8::internal::PagedSpace::LastPage(), and v8::internal::PagedSpace::UseEmergencyMemory().

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

◆ ResetFreeListStatistics()

void v8::internal::Page::ResetFreeListStatistics ( )

◆ set_next_page()

void v8::internal::Page::set_next_page ( Page page)
inline

Definition at line 221 of file spaces-inl.h.

221  {
222  DCHECK(page->owner() == owner());
223  set_next_chunk(page);
224 }
void set_next_chunk(MemoryChunk *next)
Definition: spaces.h:299

References DCHECK, v8::internal::MemoryChunk::owner(), and v8::internal::MemoryChunk::set_next_chunk().

Referenced by InitializeAsAnchor(), and v8::internal::PagedSpace::TearDown().

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

◆ set_prev_page()

void v8::internal::Page::set_prev_page ( Page page)
inline

Definition at line 227 of file spaces-inl.h.

227  {
228  DCHECK(page->owner() == owner());
229  set_prev_chunk(page);
230 }
void set_prev_chunk(MemoryChunk *prev)
Definition: spaces.h:303

References DCHECK, v8::internal::MemoryChunk::owner(), and v8::internal::MemoryChunk::set_prev_chunk().

Referenced by InitializeAsAnchor(), and v8::internal::PagedSpace::TearDown().

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

◆ SetWasSwept()

void v8::internal::Page::SetWasSwept ( )
inline

Definition at line 767 of file spaces.h.

767 { SetFlag(WAS_SWEPT); }
void SetFlag(int flag)
Definition: spaces.h:405

References v8::internal::MemoryChunk::SetFlag(), and v8::internal::MemoryChunk::WAS_SWEPT.

Referenced by v8::internal::MarkCompactCollector::EvacuateLiveObjectsFromPage(), v8::internal::MarkCompactCollector::ParallelSweepSpaceComplete(), and v8::internal::Sweep().

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

◆ WasSwept()

bool v8::internal::Page::WasSwept ( )
inline

Friends And Related Function Documentation

◆ MemoryAllocator

friend class MemoryAllocator
friend

Definition at line 789 of file spaces.h.

Member Data Documentation

◆ kMaxRegularHeapObjectSize

◆ kPageAlignmentMask

◆ kPageSize


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