V8 Project
v8::internal::NewSpacePage Class Reference

#include <spaces.h>

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

Public Member Functions

NewSpacePagenext_page () const
 
void set_next_page (NewSpacePage *page)
 
NewSpacePageprev_page () const
 
void set_prev_page (NewSpacePage *page)
 
SemiSpacesemi_space ()
 
bool is_anchor ()
 
Address address ()
 
- 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 IsAtStart (Address addr)
 
static bool IsAtEnd (Address addr)
 
static NewSpacePageFromAddress (Address address_in_page)
 
static NewSpacePageFromLimit (Address address_limit)
 
static bool OnSamePage (Address address1, Address address2)
 
- 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 intptr_t kCopyOnFlipFlagsMask
 
static const int kAreaSize = Page::kMaxRegularHeapObjectSize
 
- 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
 

Private Member Functions

 NewSpacePage (SemiSpace *owner)
 
void InitializeAsAnchor (SemiSpace *owner)
 

Static Private Member Functions

static NewSpacePageInitialize (Heap *heap, Address start, SemiSpace *semi_space)
 

Friends

class SemiSpace
 
class SemiSpaceIterator
 

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 1982 of file spaces.h.

Constructor & Destructor Documentation

◆ NewSpacePage()

v8::internal::NewSpacePage::NewSpacePage ( SemiSpace owner)
inlineexplicitprivate

Definition at line 2044 of file spaces.h.

Space * owner() const
Definition: spaces.h:307
void InitializeAsAnchor(SemiSpace *owner)
Definition: spaces.cc:420

References InitializeAsAnchor(), and v8::internal::MemoryChunk::owner().

+ Here is the call graph for this function:

Member Function Documentation

◆ address()

Address v8::internal::NewSpacePage::address ( )
inline

Definition at line 2018 of file spaces.h.

2018 { return reinterpret_cast<Address>(this); }
byte * Address
Definition: globals.h:101

◆ FromAddress()

static NewSpacePage* v8::internal::NewSpacePage::FromAddress ( Address  address_in_page)
inlinestatic

Definition at line 2021 of file spaces.h.

2021  {
2022  Address page_start =
2023  reinterpret_cast<Address>(reinterpret_cast<uintptr_t>(address_in_page) &
2025  NewSpacePage* page = reinterpret_cast<NewSpacePage*>(page_start);
2026  return page;
2027  }
NewSpacePage(SemiSpace *owner)
Definition: spaces.h:2044
static const intptr_t kPageAlignmentMask
Definition: spaces.h:757

References v8::internal::Page::kPageAlignmentMask.

Referenced by FromLimit(), v8::internal::PromotionQueue::insert(), OnSamePage(), v8::internal::PromotionQueue::remove(), v8::internal::Heap::ShouldBePromoted(), and v8::internal::SemiSpace::ShrinkTo().

+ Here is the caller graph for this function:

◆ FromLimit()

static NewSpacePage* v8::internal::NewSpacePage::FromLimit ( Address  address_limit)
inlinestatic

Definition at line 2031 of file spaces.h.

2031  {
2032  return NewSpacePage::FromAddress(address_limit - 1);
2033  }
static NewSpacePage * FromAddress(Address address_in_page)
Definition: spaces.h:2021

References FromAddress().

Referenced by v8::internal::NewSpace::AddFreshPage(), v8::internal::Heap::DoScavenge(), v8::internal::SemiSpaceIterator::Next(), and v8::internal::SemiSpace::set_age_mark().

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

◆ Initialize()

NewSpacePage * v8::internal::NewSpacePage::Initialize ( Heap heap,
Address  start,
SemiSpace semi_space 
)
staticprivate

Definition at line 398 of file spaces.cc.

399  {
401  Address area_end = start + Page::kPageSize;
402 
403  MemoryChunk* chunk =
406  chunk->set_next_chunk(NULL);
407  chunk->set_prev_chunk(NULL);
408  chunk->initialize_scan_on_scavenge(true);
409  bool in_to_space = (semi_space->id() != kFromSpace);
410  chunk->SetFlag(in_to_space ? MemoryChunk::IN_TO_SPACE
412  DCHECK(!chunk->IsFlagSet(in_to_space ? MemoryChunk::IN_FROM_SPACE
414  NewSpacePage* page = static_cast<NewSpacePage*>(chunk);
416  return page;
417 }
IncrementalMarking * incremental_marking()
Definition: heap.h:1205
void SetNewSpacePageFlags(NewSpacePage *chunk)
Heap * heap() const
Definition: spaces.h:603
static const int kObjectStartOffset
Definition: spaces.h:550
static MemoryChunk * Initialize(Heap *heap, Address base, size_t size, Address area_start, Address area_end, Executability executable, Space *owner)
Definition: spaces.cc:430
SemiSpace * semi_space()
Definition: spaces.h:2005
static const int kPageSize
Definition: spaces.h:748
SemiSpaceId id()
Definition: spaces.h:2177
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
Definition: logging.h:205
@ NOT_EXECUTABLE
Definition: globals.h:391

References v8::internal::MemoryChunk::area_end(), v8::internal::MemoryChunk::area_start(), DCHECK, v8::internal::MemoryChunk::heap(), v8::internal::SemiSpace::id(), v8::internal::MemoryChunk::IN_FROM_SPACE, v8::internal::MemoryChunk::IN_TO_SPACE, v8::internal::Heap::incremental_marking(), v8::internal::MemoryChunk::Initialize(), v8::internal::MemoryChunk::initialize_scan_on_scavenge(), v8::internal::MemoryChunk::IsFlagSet(), v8::internal::kFromSpace, v8::internal::MemoryChunk::kObjectStartOffset, v8::internal::Page::kPageSize, v8::internal::NOT_EXECUTABLE, NULL, semi_space(), v8::internal::MemoryChunk::set_next_chunk(), v8::internal::MemoryChunk::set_prev_chunk(), v8::internal::MemoryChunk::SetFlag(), and v8::internal::IncrementalMarking::SetNewSpacePageFlags().

Referenced by v8::internal::SemiSpace::Commit(), and v8::internal::SemiSpace::GrowTo().

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

◆ InitializeAsAnchor()

void v8::internal::NewSpacePage::InitializeAsAnchor ( SemiSpace owner)
private

Definition at line 420 of file spaces.cc.

420  {
422  set_next_chunk(this);
423  set_prev_chunk(this);
424  // Flags marks this invalid page as not being in new-space.
425  // All real new-space pages will be in new-space.
426  SetFlags(0, ~0);
427 }
void set_owner(Space *space)
Definition: spaces.h:317
void SetFlags(intptr_t flags, intptr_t mask)
Definition: spaces.h:424
void set_next_chunk(MemoryChunk *next)
Definition: spaces.h:299
void set_prev_chunk(MemoryChunk *prev)
Definition: spaces.h:303

References semi_space(), v8::internal::MemoryChunk::set_next_chunk(), v8::internal::MemoryChunk::set_owner(), v8::internal::MemoryChunk::set_prev_chunk(), and v8::internal::MemoryChunk::SetFlags().

Referenced by NewSpacePage().

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

◆ is_anchor()

bool v8::internal::NewSpacePage::is_anchor ( )
inline

Definition at line 2007 of file spaces.h.

2007 { return !this->InNewSpace(); }

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

Referenced by v8::internal::PromotionQueue::insert(), v8::internal::SemiSpaceIterator::Next(), and v8::internal::PromotionQueue::remove().

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

◆ IsAtEnd()

static bool v8::internal::NewSpacePage::IsAtEnd ( Address  addr)
inlinestatic

Definition at line 2014 of file spaces.h.

2014  {
2015  return (reinterpret_cast<intptr_t>(addr) & Page::kPageAlignmentMask) == 0;
2016  }

References v8::internal::Page::kPageAlignmentMask.

Referenced by v8::internal::Heap::DoScavenge(), and v8::internal::SemiSpaceIterator::Next().

+ Here is the caller graph for this function:

◆ IsAtStart()

static bool v8::internal::NewSpacePage::IsAtStart ( Address  addr)
inlinestatic

Definition at line 2009 of file spaces.h.

2009  {
2010  return (reinterpret_cast<intptr_t>(addr) & Page::kPageAlignmentMask) ==
2012  }

References v8::internal::MemoryChunk::kObjectStartOffset, and v8::internal::Page::kPageAlignmentMask.

Referenced by v8::internal::NewSpace::AddFreshPage(), v8::internal::PromotionQueue::insert(), and v8::internal::PromotionQueue::remove().

+ Here is the caller graph for this function:

◆ next_page()

NewSpacePage* v8::internal::NewSpacePage::next_page ( ) const
inline

Definition at line 1993 of file spaces.h.

1993  {
1994  return static_cast<NewSpacePage*>(next_chunk());
1995  }
MemoryChunk * next_chunk() const
Definition: spaces.h:291

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

Referenced by v8::internal::SemiSpace::AdvancePage(), v8::internal::Heap::DoScavenge(), v8::internal::SemiSpace::first_page(), v8::internal::SemiSpace::FlipPages(), v8::internal::SemiSpaceIterator::Next(), v8::internal::SemiSpace::Reset(), v8::internal::SemiSpace::space_start(), and v8::internal::SemiSpace::Swap().

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

◆ OnSamePage()

static bool v8::internal::NewSpacePage::OnSamePage ( Address  address1,
Address  address2 
)
inlinestatic

Definition at line 2036 of file spaces.h.

2036  {
2037  return NewSpacePage::FromAddress(address1) ==
2038  NewSpacePage::FromAddress(address2);
2039  }

References FromAddress().

Referenced by v8::internal::Heap::FindAllocationMemento().

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

◆ prev_page()

NewSpacePage* v8::internal::NewSpacePage::prev_page ( ) const
inline

Definition at line 1999 of file spaces.h.

1999  {
2000  return static_cast<NewSpacePage*>(prev_chunk());
2001  }
MemoryChunk * prev_chunk() const
Definition: spaces.h:295

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

Referenced by v8::internal::SemiSpace::FlipPages(), v8::internal::SemiSpace::GrowTo(), v8::internal::PromotionQueue::insert(), v8::internal::PromotionQueue::remove(), and v8::internal::SemiSpace::space_end().

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

◆ semi_space()

SemiSpace* v8::internal::NewSpacePage::semi_space ( )
inline

Definition at line 2005 of file spaces.h.

2005 { return reinterpret_cast<SemiSpace*>(owner()); }
friend class SemiSpace
Definition: spaces.h:2054

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

Referenced by Initialize(), and InitializeAsAnchor().

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

◆ set_next_page()

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

Definition at line 1997 of file spaces.h.

1997 { set_next_chunk(page); }

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

Referenced by v8::internal::SemiSpace::FlipPages(), v8::internal::SemiSpace::ShrinkTo(), and v8::internal::SemiSpace::Uncommit().

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

◆ set_prev_page()

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

Definition at line 2003 of file spaces.h.

2003 { set_prev_chunk(page); }

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

Referenced by v8::internal::SemiSpace::FlipPages(), v8::internal::SemiSpace::ShrinkTo(), and v8::internal::SemiSpace::Uncommit().

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

Friends And Related Function Documentation

◆ SemiSpace

friend class SemiSpace
friend

Definition at line 2054 of file spaces.h.

◆ SemiSpaceIterator

friend class SemiSpaceIterator
friend

Definition at line 2055 of file spaces.h.

Member Data Documentation

◆ kAreaSize

const int v8::internal::NewSpacePage::kAreaSize = Page::kMaxRegularHeapObjectSize
static

Definition at line 1991 of file spaces.h.

Referenced by v8::internal::NewSpace::Capacity(), and v8::internal::NewSpace::Size().

◆ kCopyOnFlipFlagsMask

const intptr_t v8::internal::NewSpacePage::kCopyOnFlipFlagsMask
static

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