V8 Project
v8::internal::SemiSpace Class Reference

#include <spaces.h>

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

Public Member Functions

 SemiSpace (Heap *heap, SemiSpaceId semispace)
 
void SetUp (Address start, int initial_capacity, int maximum_capacity)
 
void TearDown ()
 
bool HasBeenSetUp ()
 
bool GrowTo (int new_capacity)
 
bool ShrinkTo (int new_capacity)
 
Address space_start ()
 
Address page_low ()
 
Address space_end ()
 
Address page_high ()
 
bool AdvancePage ()
 
void Reset ()
 
Address age_mark ()
 
void set_age_mark (Address mark)
 
bool Contains (Address a)
 
bool Contains (Object *o)
 
virtual intptr_t Size ()
 
bool is_committed ()
 
bool Commit ()
 
bool Uncommit ()
 
NewSpacePagefirst_page ()
 
NewSpacePagecurrent_page ()
 
int TotalCapacity ()
 
int MaximumTotalCapacity ()
 
int InitialTotalCapacity ()
 
SemiSpaceId id ()
 
size_t MaximumCommittedMemory ()
 
size_t CommittedPhysicalMemory ()
 
- Public Member Functions inherited from v8::internal::Space
 Space (Heap *heap, AllocationSpace id, Executability executable)
 
virtual ~Space ()
 
Heapheap () const
 
Executability executable ()
 
AllocationSpace identity ()
 
virtual intptr_t SizeOfObjects ()
 
virtual int RoundSizeDownToObjectAlignment (int size)
 
- Public Member Functions inherited from v8::internal::Malloced
void * operator new (size_t size)
 
void operator delete (void *p)
 

Static Public Member Functions

static void AssertValidRange (Address from, Address to)
 
static void Swap (SemiSpace *from, SemiSpace *to)
 
- Static Public Member Functions inherited from v8::internal::Malloced
static void FatalProcessOutOfMemory ()
 
static void * New (size_t size)
 
static void Delete (void *p)
 

Private Member Functions

void FlipPages (intptr_t flags, intptr_t flag_mask)
 
void SetCapacity (int new_capacity)
 
NewSpacePageanchor ()
 

Private Attributes

int total_capacity_
 
int maximum_total_capacity_
 
int initial_total_capacity_
 
intptr_t maximum_committed_
 
Address start_
 
Address age_mark_
 
uintptr_t address_mask_
 
uintptr_t object_mask_
 
uintptr_t object_expected_
 
bool committed_
 
SemiSpaceId id_
 
NewSpacePage anchor_
 
NewSpacePagecurrent_page_
 

Friends

class SemiSpaceIterator
 
class NewSpacePageIterator
 

Detailed Description

Definition at line 2066 of file spaces.h.

Constructor & Destructor Documentation

◆ SemiSpace()

v8::internal::SemiSpace::SemiSpace ( Heap heap,
SemiSpaceId  semispace 
)
inline

Definition at line 2069 of file spaces.h.

2071  start_(NULL),
2072  age_mark_(NULL),
2073  id_(semispace),
2074  anchor_(this),
2075  current_page_(NULL) {}
NewSpacePage * current_page_
Definition: spaces.h:2218
NewSpacePage anchor_
Definition: spaces.h:2217
Space(Heap *heap, AllocationSpace id, Executability executable)
Definition: spaces.h:818
Heap * heap() const
Definition: spaces.h:823
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
@ NOT_EXECUTABLE
Definition: globals.h:391

Member Function Documentation

◆ AdvancePage()

bool v8::internal::SemiSpace::AdvancePage ( )
inline

Definition at line 2112 of file spaces.h.

2112  {
2113  NewSpacePage* next_page = current_page_->next_page();
2114  if (next_page == anchor()) return false;
2115  current_page_ = next_page;
2116  return true;
2117  }
NewSpacePage * next_page() const
Definition: spaces.h:1993
NewSpacePage * anchor()
Definition: spaces.h:2195

References anchor(), current_page_, and v8::internal::NewSpacePage::next_page().

Referenced by v8::internal::NewSpace::AddFreshPage().

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

◆ age_mark()

Address v8::internal::SemiSpace::age_mark ( )
inline

Definition at line 2123 of file spaces.h.

2123 { return age_mark_; }

References age_mark_.

Referenced by v8::internal::NewSpace::age_mark().

+ Here is the caller graph for this function:

◆ anchor()

NewSpacePage* v8::internal::SemiSpace::anchor ( )
inlineprivate

Definition at line 2195 of file spaces.h.

2195 { return &anchor_; }

References anchor_.

Referenced by AdvancePage(), Commit(), GrowTo(), ShrinkTo(), and Uncommit().

+ Here is the caller graph for this function:

◆ AssertValidRange()

static void v8::internal::SemiSpace::AssertValidRange ( Address  from,
Address  to 
)
inlinestatic

Definition at line 2165 of file spaces.h.

2165 {}

Referenced by v8::internal::Heap::DoScavenge(), v8::internal::SemiSpaceIterator::Initialize(), v8::internal::PromotionQueue::insert(), and v8::internal::PromotionQueue::remove().

+ Here is the caller graph for this function:

◆ Commit()

bool v8::internal::SemiSpace::Commit ( )

Definition at line 1488 of file spaces.cc.

1488  {
1489  DCHECK(!is_committed());
1490  int pages = total_capacity_ / Page::kPageSize;
1491  if (!heap()->isolate()->memory_allocator()->CommitBlock(
1493  return false;
1494  }
1495 
1496  NewSpacePage* current = anchor();
1497  for (int i = 0; i < pages; i++) {
1498  NewSpacePage* new_page =
1500  new_page->InsertAfter(current);
1501  current = new_page;
1502  }
1503 
1505  committed_ = true;
1506  Reset();
1507  return true;
1508 }
static NewSpacePage * Initialize(Heap *heap, Address start, SemiSpace *semi_space)
Definition: spaces.cc:398
static const int kPageSize
Definition: spaces.h:748
void SetCapacity(int new_capacity)
Definition: spaces.cc:1656
Executability executable()
Definition: spaces.h:826
#define DCHECK(condition)
Definition: logging.h:205

References anchor(), committed_, DCHECK, v8::internal::Space::executable(), v8::internal::Space::heap(), v8::internal::NewSpacePage::Initialize(), v8::internal::MemoryChunk::InsertAfter(), is_committed(), v8::internal::Page::kPageSize, Reset(), SetCapacity(), start_, and total_capacity_.

Referenced by v8::internal::NewSpace::CommitFromSpaceIfNeeded(), GrowTo(), and v8::internal::NewSpace::SetUp().

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

◆ CommittedPhysicalMemory()

size_t v8::internal::SemiSpace::CommittedPhysicalMemory ( )

Definition at line 1526 of file spaces.cc.

1526  {
1527  if (!is_committed()) return 0;
1528  size_t size = 0;
1529  NewSpacePageIterator it(this);
1530  while (it.has_next()) {
1531  size += it.next()->CommittedPhysicalMemory();
1532  }
1533  return size;
1534 }
friend class NewSpacePageIterator
Definition: spaces.h:2221
enable harmony numeric enable harmony object literal extensions Optimize object size

References is_committed(), NewSpacePageIterator, and size.

Referenced by v8::internal::NewSpace::CommittedPhysicalMemory().

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

◆ Contains() [1/2]

bool v8::internal::SemiSpace::Contains ( Address  a)
inline

Definition at line 2128 of file spaces.h.

2128  {
2129  return (reinterpret_cast<uintptr_t>(a) & address_mask_) ==
2130  reinterpret_cast<uintptr_t>(start_);
2131  }
uintptr_t address_mask_
Definition: spaces.h:2210

References address_mask_, and start_.

Referenced by v8::internal::NewSpace::FromSpaceContains(), and v8::internal::NewSpace::ToSpaceContains().

+ Here is the caller graph for this function:

◆ Contains() [2/2]

bool v8::internal::SemiSpace::Contains ( Object o)
inline

Definition at line 2135 of file spaces.h.

2135  {
2136  return (reinterpret_cast<uintptr_t>(o) & object_mask_) == object_expected_;
2137  }
uintptr_t object_mask_
Definition: spaces.h:2211
uintptr_t object_expected_
Definition: spaces.h:2212

References object_expected_, and object_mask_.

◆ current_page()

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

Definition at line 2151 of file spaces.h.

2151 { return current_page_; }

References current_page_.

Referenced by v8::internal::NewSpace::limit(), v8::internal::NewSpace::set_top(), Swap(), and v8::internal::NewSpace::top().

+ Here is the caller graph for this function:

◆ first_page()

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

Definition at line 2150 of file spaces.h.

2150 { return anchor_.next_page(); }

References anchor_, and v8::internal::NewSpacePage::next_page().

Referenced by ShrinkTo().

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

◆ FlipPages()

void v8::internal::SemiSpace::FlipPages ( intptr_t  flags,
intptr_t  flag_mask 
)
private

Definition at line 1599 of file spaces.cc.

1599  {
1600  anchor_.set_owner(this);
1601  // Fixup back-pointers to anchor. Address of anchor changes
1602  // when we swap.
1605 
1606  bool becomes_to_space = (id_ == kFromSpace);
1607  id_ = becomes_to_space ? kToSpace : kFromSpace;
1608  NewSpacePage* page = anchor_.next_page();
1609  while (page != &anchor_) {
1610  page->set_owner(this);
1611  page->SetFlags(flags, mask);
1612  if (becomes_to_space) {
1613  page->ClearFlag(MemoryChunk::IN_FROM_SPACE);
1614  page->SetFlag(MemoryChunk::IN_TO_SPACE);
1615  page->ClearFlag(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK);
1616  page->ResetLiveBytes();
1617  } else {
1618  page->SetFlag(MemoryChunk::IN_FROM_SPACE);
1619  page->ClearFlag(MemoryChunk::IN_TO_SPACE);
1620  }
1621  DCHECK(page->IsFlagSet(MemoryChunk::SCAN_ON_SCAVENGE));
1622  DCHECK(page->IsFlagSet(MemoryChunk::IN_TO_SPACE) ||
1623  page->IsFlagSet(MemoryChunk::IN_FROM_SPACE));
1624  page = page->next_page();
1625  }
1626 }
void set_owner(Space *space)
Definition: spaces.h:317
NewSpacePage * prev_page() const
Definition: spaces.h:1999
void set_prev_page(NewSpacePage *page)
Definition: spaces.h:2003
void set_next_page(NewSpacePage *page)
Definition: spaces.h:1997

References anchor_, v8::internal::MemoryChunk::ClearFlag(), DCHECK, v8::internal::anonymous_namespace{flags.cc}::flags, id_, v8::internal::MemoryChunk::IN_FROM_SPACE, v8::internal::MemoryChunk::IN_TO_SPACE, v8::internal::MemoryChunk::IsFlagSet(), v8::internal::kFromSpace, v8::internal::kToSpace, v8::internal::MemoryChunk::NEW_SPACE_BELOW_AGE_MARK, v8::internal::NewSpacePage::next_page(), v8::internal::NewSpacePage::prev_page(), v8::internal::MemoryChunk::ResetLiveBytes(), v8::internal::MemoryChunk::SCAN_ON_SCAVENGE, v8::internal::NewSpacePage::set_next_page(), v8::internal::MemoryChunk::set_owner(), v8::internal::NewSpacePage::set_prev_page(), v8::internal::MemoryChunk::SetFlag(), and v8::internal::MemoryChunk::SetFlags().

Referenced by Swap().

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

◆ GrowTo()

bool v8::internal::SemiSpace::GrowTo ( int  new_capacity)

Definition at line 1537 of file spaces.cc.

1537  {
1538  if (!is_committed()) {
1539  if (!Commit()) return false;
1540  }
1541  DCHECK((new_capacity & Page::kPageAlignmentMask) == 0);
1542  DCHECK(new_capacity <= maximum_total_capacity_);
1543  DCHECK(new_capacity > total_capacity_);
1544  int pages_before = total_capacity_ / Page::kPageSize;
1545  int pages_after = new_capacity / Page::kPageSize;
1546 
1547  size_t delta = new_capacity - total_capacity_;
1548 
1550  if (!heap()->isolate()->memory_allocator()->CommitBlock(
1551  start_ + total_capacity_, delta, executable())) {
1552  return false;
1553  }
1554  SetCapacity(new_capacity);
1555  NewSpacePage* last_page = anchor()->prev_page();
1556  DCHECK(last_page != anchor());
1557  for (int i = pages_before; i < pages_after; i++) {
1558  Address page_address = start_ + i * Page::kPageSize;
1559  NewSpacePage* new_page =
1560  NewSpacePage::Initialize(heap(), page_address, this);
1561  new_page->InsertAfter(last_page);
1562  Bitmap::Clear(new_page);
1563  // Duplicate the flags that was set on the old page.
1564  new_page->SetFlags(last_page->GetFlags(),
1566  last_page = new_page;
1567  }
1568  return true;
1569 }
static size_t AllocateAlignment()
static void Clear(MemoryChunk *chunk)
Definition: spaces-inl.h:21
static const intptr_t kCopyOnFlipFlagsMask
Definition: spaces.h:1986
static const intptr_t kPageAlignmentMask
Definition: spaces.h:757
byte * Address
Definition: globals.h:101
bool IsAligned(T value, U alignment)
Definition: utils.h:123

References v8::base::OS::AllocateAlignment(), anchor(), v8::internal::Bitmap::Clear(), Commit(), DCHECK, v8::internal::Space::executable(), v8::internal::MemoryChunk::GetFlags(), v8::internal::Space::heap(), v8::internal::NewSpacePage::Initialize(), v8::internal::MemoryChunk::InsertAfter(), is_committed(), v8::internal::IsAligned(), v8::internal::NewSpacePage::kCopyOnFlipFlagsMask, v8::internal::Page::kPageAlignmentMask, v8::internal::Page::kPageSize, maximum_total_capacity_, v8::internal::NewSpacePage::prev_page(), SetCapacity(), v8::internal::MemoryChunk::SetFlags(), start_, and total_capacity_.

Referenced by v8::internal::NewSpace::Grow(), and v8::internal::NewSpace::Shrink().

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

◆ HasBeenSetUp()

bool v8::internal::SemiSpace::HasBeenSetUp ( )
inline

Definition at line 2085 of file spaces.h.

2085 { return start_ != NULL; }

References NULL, and start_.

Referenced by v8::internal::NewSpace::HasBeenSetUp().

+ Here is the caller graph for this function:

◆ id()

SemiSpaceId v8::internal::SemiSpace::id ( )
inline

Definition at line 2177 of file spaces.h.

2177 { return id_; }

References id_.

Referenced by v8::internal::NewSpacePage::Initialize().

+ Here is the caller graph for this function:

◆ InitialTotalCapacity()

int v8::internal::SemiSpace::InitialTotalCapacity ( )
inline

Definition at line 2175 of file spaces.h.

2175 { return initial_total_capacity_; }

References initial_total_capacity_.

Referenced by v8::internal::NewSpace::InitialTotalCapacity().

+ Here is the caller graph for this function:

◆ is_committed()

bool v8::internal::SemiSpace::is_committed ( )
inline

Definition at line 2146 of file spaces.h.

2146 { return committed_; }

References committed_.

Referenced by Commit(), v8::internal::NewSpace::CommitFromSpaceIfNeeded(), v8::internal::NewSpace::CommittedMemory(), CommittedPhysicalMemory(), v8::internal::NewSpace::CommittedPhysicalMemory(), GrowTo(), v8::internal::NewSpace::SetUp(), ShrinkTo(), Uncommit(), and v8::internal::NewSpace::UncommitFromSpace().

+ Here is the caller graph for this function:

◆ MaximumCommittedMemory()

size_t v8::internal::SemiSpace::MaximumCommittedMemory ( )
inline

Definition at line 2182 of file spaces.h.

2182 { return maximum_committed_; }
intptr_t maximum_committed_
Definition: spaces.h:2202

References maximum_committed_.

Referenced by v8::internal::NewSpace::MaximumCommittedMemory().

+ Here is the caller graph for this function:

◆ MaximumTotalCapacity()

int v8::internal::SemiSpace::MaximumTotalCapacity ( )
inline

Definition at line 2172 of file spaces.h.

2172 { return maximum_total_capacity_; }

References maximum_total_capacity_.

Referenced by v8::internal::NewSpace::MaximumCapacity().

+ Here is the caller graph for this function:

◆ page_high()

Address v8::internal::SemiSpace::page_high ( )
inline

Definition at line 2110 of file spaces.h.

2110 { return current_page_->area_end(); }

References v8::internal::MemoryChunk::area_end(), and current_page_.

Referenced by v8::internal::NewSpace::FromSpacePageHigh(), v8::internal::NewSpace::SlowAllocateRaw(), v8::internal::NewSpace::UpdateAllocationInfo(), and v8::internal::NewSpace::UpdateInlineAllocationLimit().

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

◆ page_low()

Address v8::internal::SemiSpace::page_low ( )
inline

Definition at line 2104 of file spaces.h.

2104 { return current_page_->area_start(); }

References v8::internal::MemoryChunk::area_start(), and current_page_.

Referenced by v8::internal::NewSpace::FromSpacePageLow(), v8::internal::NewSpace::Size(), v8::internal::NewSpace::SlowAllocateRaw(), and v8::internal::NewSpace::UpdateAllocationInfo().

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

◆ Reset()

void v8::internal::SemiSpace::Reset ( )

Definition at line 1629 of file spaces.cc.

1629  {
1632 }

References anchor_, current_page_, DCHECK, and v8::internal::NewSpacePage::next_page().

Referenced by Commit(), v8::internal::NewSpace::ResetAllocationInfo(), and v8::internal::NewSpace::Shrink().

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

◆ set_age_mark()

void v8::internal::SemiSpace::set_age_mark ( Address  mark)

Definition at line 1664 of file spaces.cc.

1664  {
1665  DCHECK(NewSpacePage::FromLimit(mark)->semi_space() == this);
1666  age_mark_ = mark;
1667  // Mark all pages up to the one containing mark.
1668  NewSpacePageIterator it(space_start(), mark);
1669  while (it.has_next()) {
1670  it.next()->SetFlag(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK);
1671  }
1672 }
static NewSpacePage * FromLimit(Address address_limit)
Definition: spaces.h:2031
Address space_start()
Definition: spaces.h:2098

References age_mark_, DCHECK, v8::internal::NewSpacePage::FromLimit(), v8::internal::MemoryChunk::NEW_SPACE_BELOW_AGE_MARK, NewSpacePageIterator, and space_start().

Referenced by v8::internal::NewSpace::set_age_mark().

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

◆ SetCapacity()

void v8::internal::SemiSpace::SetCapacity ( int  new_capacity)
private

Definition at line 1656 of file spaces.cc.

1656  {
1657  total_capacity_ = new_capacity;
1660  }
1661 }

References maximum_committed_, and total_capacity_.

Referenced by Commit(), GrowTo(), and ShrinkTo().

+ Here is the caller graph for this function:

◆ SetUp()

void v8::internal::SemiSpace::SetUp ( Address  start,
int  initial_capacity,
int  maximum_capacity 
)

Definition at line 1460 of file spaces.cc.

1461  {
1462  // Creates a space in the young generation. The constructor does not
1463  // allocate memory from the OS. A SemiSpace is given a contiguous chunk of
1464  // memory of size 'capacity' when set up, and does not grow or shrink
1465  // otherwise. In the mark-compact collector, the memory region of the from
1466  // space is used as the marking stack. It requires contiguous memory
1467  // addresses.
1468  DCHECK(maximum_capacity >= Page::kPageSize);
1469  initial_total_capacity_ = RoundDown(initial_capacity, Page::kPageSize);
1470  total_capacity_ = initial_capacity;
1471  maximum_total_capacity_ = RoundDown(maximum_capacity, Page::kPageSize);
1472  maximum_committed_ = 0;
1473  committed_ = false;
1474  start_ = start;
1475  address_mask_ = ~(maximum_capacity - 1);
1477  object_expected_ = reinterpret_cast<uintptr_t>(start) | kHeapObjectTag;
1478  age_mark_ = start_;
1479 }
T RoundDown(T x, intptr_t m)
Definition: macros.h:399
const intptr_t kHeapObjectTagMask
Definition: v8.h:5739
const int kHeapObjectTag
Definition: v8.h:5737

References address_mask_, age_mark_, committed_, DCHECK, initial_total_capacity_, v8::internal::kHeapObjectTag, v8::internal::kHeapObjectTagMask, v8::internal::Page::kPageSize, maximum_committed_, maximum_total_capacity_, object_expected_, object_mask_, RoundDown(), start_, and total_capacity_.

Referenced by v8::internal::NewSpace::SetUp().

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

◆ ShrinkTo()

bool v8::internal::SemiSpace::ShrinkTo ( int  new_capacity)

Definition at line 1572 of file spaces.cc.

1572  {
1573  DCHECK((new_capacity & Page::kPageAlignmentMask) == 0);
1574  DCHECK(new_capacity >= initial_total_capacity_);
1575  DCHECK(new_capacity < total_capacity_);
1576  if (is_committed()) {
1577  size_t delta = total_capacity_ - new_capacity;
1579 
1580  MemoryAllocator* allocator = heap()->isolate()->memory_allocator();
1581  if (!allocator->UncommitBlock(start_ + new_capacity, delta)) {
1582  return false;
1583  }
1584 
1585  int pages_after = new_capacity / Page::kPageSize;
1586  NewSpacePage* new_last_page =
1587  NewSpacePage::FromAddress(start_ + (pages_after - 1) * Page::kPageSize);
1588  new_last_page->set_next_page(anchor());
1589  anchor()->set_prev_page(new_last_page);
1590  DCHECK((current_page_ >= first_page()) && (current_page_ <= new_last_page));
1591  }
1592 
1593  SetCapacity(new_capacity);
1594 
1595  return true;
1596 }
Isolate * isolate()
Definition: heap-inl.h:589
MemoryAllocator * memory_allocator()
Definition: isolate.h:883
static NewSpacePage * FromAddress(Address address_in_page)
Definition: spaces.h:2021
NewSpacePage * first_page()
Definition: spaces.h:2150

References v8::base::OS::AllocateAlignment(), anchor(), current_page_, DCHECK, first_page(), v8::internal::NewSpacePage::FromAddress(), v8::internal::Space::heap(), initial_total_capacity_, is_committed(), v8::internal::IsAligned(), v8::internal::Heap::isolate(), v8::internal::Page::kPageAlignmentMask, v8::internal::Page::kPageSize, v8::internal::Isolate::memory_allocator(), v8::internal::NewSpacePage::set_next_page(), v8::internal::NewSpacePage::set_prev_page(), SetCapacity(), start_, total_capacity_, and v8::internal::MemoryAllocator::UncommitBlock().

Referenced by v8::internal::NewSpace::Grow(), and v8::internal::NewSpace::Shrink().

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

◆ Size()

virtual intptr_t v8::internal::SemiSpace::Size ( )
inlinevirtual

Implements v8::internal::Space.

Definition at line 2141 of file spaces.h.

2141  {
2142  UNREACHABLE();
2143  return 0;
2144  }
#define UNREACHABLE()
Definition: logging.h:30

References UNREACHABLE.

◆ space_end()

Address v8::internal::SemiSpace::space_end ( )
inline

Definition at line 2107 of file spaces.h.

2107 { return anchor_.prev_page()->area_end(); }

References anchor_, v8::internal::MemoryChunk::area_end(), and v8::internal::NewSpacePage::prev_page().

Referenced by v8::internal::NewSpace::FromSpaceEnd(), and v8::internal::NewSpace::ToSpaceEnd().

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

◆ space_start()

Address v8::internal::SemiSpace::space_start ( )
inline

Definition at line 2098 of file spaces.h.

2098  {
2100  return anchor_.next_page()->area_start();
2101  }

References anchor_, v8::internal::MemoryChunk::area_start(), DCHECK, and v8::internal::NewSpacePage::next_page().

Referenced by v8::internal::NewSpace::bottom(), v8::internal::NewSpace::FromSpaceStart(), set_age_mark(), and v8::internal::NewSpace::ToSpaceStart().

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

◆ Swap()

void v8::internal::SemiSpace::Swap ( SemiSpace from,
SemiSpace to 
)
static

Definition at line 1635 of file spaces.cc.

1635  {
1636  // We won't be swapping semispaces without data in them.
1637  DCHECK(from->anchor_.next_page() != &from->anchor_);
1638  DCHECK(to->anchor_.next_page() != &to->anchor_);
1639 
1640  // Swap bits.
1641  SemiSpace tmp = *from;
1642  *from = *to;
1643  *to = tmp;
1644 
1645  // Fixup back-pointers to the page list anchor now that its address
1646  // has changed.
1647  // Swap to/from-space bits on pages.
1648  // Copy GC flags from old active space (from-space) to new (to-space).
1649  intptr_t flags = from->current_page()->GetFlags();
1651 
1652  from->FlipPages(0, 0);
1653 }
SemiSpace(Heap *heap, SemiSpaceId semispace)
Definition: spaces.h:2069
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 expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file

References anchor_, current_page(), DCHECK, v8::internal::anonymous_namespace{flags.cc}::flags, FlipPages(), v8::internal::MemoryChunk::GetFlags(), v8::internal::NewSpacePage::kCopyOnFlipFlagsMask, v8::internal::NewSpacePage::next_page(), and to().

Referenced by v8::internal::NewSpace::Flip().

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

◆ TearDown()

void v8::internal::SemiSpace::TearDown ( )

Definition at line 1482 of file spaces.cc.

1482  {
1483  start_ = NULL;
1484  total_capacity_ = 0;
1485 }

References NULL, start_, and total_capacity_.

Referenced by v8::internal::NewSpace::TearDown().

+ Here is the caller graph for this function:

◆ TotalCapacity()

int v8::internal::SemiSpace::TotalCapacity ( )
inline

Definition at line 2169 of file spaces.h.

2169 { return total_capacity_; }

References total_capacity_.

Referenced by v8::internal::NewSpace::Capacity(), v8::internal::NewSpace::Grow(), v8::internal::NewSpace::Shrink(), and v8::internal::NewSpace::TotalCapacity().

+ Here is the caller graph for this function:

◆ Uncommit()

bool v8::internal::SemiSpace::Uncommit ( )

Definition at line 1511 of file spaces.cc.

1511  {
1512  DCHECK(is_committed());
1514  if (!heap()->isolate()->memory_allocator()->UncommitBlock(start,
1515  total_capacity_)) {
1516  return false;
1517  }
1518  anchor()->set_next_page(anchor());
1519  anchor()->set_prev_page(anchor());
1520 
1521  committed_ = false;
1522  return true;
1523 }

References anchor(), committed_, DCHECK, v8::internal::Space::heap(), is_committed(), maximum_total_capacity_, v8::internal::NewSpacePage::set_next_page(), v8::internal::NewSpacePage::set_prev_page(), start_, and total_capacity_.

Referenced by v8::internal::NewSpace::UncommitFromSpace().

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

Friends And Related Function Documentation

◆ NewSpacePageIterator

friend class NewSpacePageIterator
friend

Definition at line 2221 of file spaces.h.

Referenced by CommittedPhysicalMemory(), and set_age_mark().

◆ SemiSpaceIterator

friend class SemiSpaceIterator
friend

Definition at line 2220 of file spaces.h.

Member Data Documentation

◆ address_mask_

uintptr_t v8::internal::SemiSpace::address_mask_
private

Definition at line 2210 of file spaces.h.

Referenced by Contains(), and SetUp().

◆ age_mark_

Address v8::internal::SemiSpace::age_mark_
private

Definition at line 2207 of file spaces.h.

Referenced by age_mark(), set_age_mark(), and SetUp().

◆ anchor_

NewSpacePage v8::internal::SemiSpace::anchor_
private

Definition at line 2217 of file spaces.h.

Referenced by anchor(), first_page(), FlipPages(), Reset(), space_end(), space_start(), and Swap().

◆ committed_

bool v8::internal::SemiSpace::committed_
private

Definition at line 2214 of file spaces.h.

Referenced by Commit(), is_committed(), SetUp(), and Uncommit().

◆ current_page_

NewSpacePage* v8::internal::SemiSpace::current_page_
private

Definition at line 2218 of file spaces.h.

Referenced by AdvancePage(), current_page(), page_high(), page_low(), Reset(), and ShrinkTo().

◆ id_

SemiSpaceId v8::internal::SemiSpace::id_
private

Definition at line 2215 of file spaces.h.

Referenced by FlipPages(), and id().

◆ initial_total_capacity_

int v8::internal::SemiSpace::initial_total_capacity_
private

Definition at line 2200 of file spaces.h.

Referenced by InitialTotalCapacity(), SetUp(), and ShrinkTo().

◆ maximum_committed_

intptr_t v8::internal::SemiSpace::maximum_committed_
private

Definition at line 2202 of file spaces.h.

Referenced by MaximumCommittedMemory(), SetCapacity(), and SetUp().

◆ maximum_total_capacity_

int v8::internal::SemiSpace::maximum_total_capacity_
private

Definition at line 2199 of file spaces.h.

Referenced by GrowTo(), MaximumTotalCapacity(), SetUp(), and Uncommit().

◆ object_expected_

uintptr_t v8::internal::SemiSpace::object_expected_
private

Definition at line 2212 of file spaces.h.

Referenced by Contains(), and SetUp().

◆ object_mask_

uintptr_t v8::internal::SemiSpace::object_mask_
private

Definition at line 2211 of file spaces.h.

Referenced by Contains(), and SetUp().

◆ start_

Address v8::internal::SemiSpace::start_
private

Definition at line 2205 of file spaces.h.

Referenced by Commit(), Contains(), GrowTo(), HasBeenSetUp(), SetUp(), ShrinkTo(), TearDown(), and Uncommit().

◆ total_capacity_

int v8::internal::SemiSpace::total_capacity_
private

Definition at line 2198 of file spaces.h.

Referenced by Commit(), GrowTo(), SetCapacity(), SetUp(), ShrinkTo(), TearDown(), TotalCapacity(), and Uncommit().


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