V8 Project
v8::internal::FreeListCategory Class Reference

#include <spaces.h>

+ Collaboration diagram for v8::internal::FreeListCategory:

Public Member Functions

 FreeListCategory ()
 
intptr_t Concatenate (FreeListCategory *category)
 
void Reset ()
 
void Free (FreeListNode *node, int size_in_bytes)
 
FreeListNodePickNodeFromList (int *node_size)
 
FreeListNodePickNodeFromList (int size_in_bytes, int *node_size)
 
intptr_t EvictFreeListItemsInList (Page *p)
 
bool ContainsPageFreeListItemsInList (Page *p)
 
void RepairFreeList (Heap *heap)
 
FreeListNodetop () const
 
void set_top (FreeListNode *top)
 
FreeListNode ** GetEndAddress ()
 
FreeListNodeend () const
 
void set_end (FreeListNode *end)
 
intGetAvailableAddress ()
 
int available () const
 
void set_available (int available)
 
base::Mutex * mutex ()
 
bool IsEmpty ()
 

Private Attributes

base::AtomicWord top_
 
FreeListNodeend_
 
base::Mutex mutex_
 
int available_
 

Detailed Description

Definition at line 1438 of file spaces.h.

Constructor & Destructor Documentation

◆ FreeListCategory()

v8::internal::FreeListCategory::FreeListCategory ( )
inline

Definition at line 1440 of file spaces.h.

1440 : top_(0), end_(NULL), available_(0) {}
base::AtomicWord top_
Definition: spaces.h:1483
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

Member Function Documentation

◆ available()

int v8::internal::FreeListCategory::available ( ) const
inline

Definition at line 1469 of file spaces.h.

1469 { return available_; }

References available_.

Referenced by v8::internal::FreeList::available(), Concatenate(), v8::internal::FreeList::FindNodeFor(), and set_available().

+ Here is the caller graph for this function:

◆ Concatenate()

intptr_t v8::internal::FreeListCategory::Concatenate ( FreeListCategory category)

Definition at line 2028 of file spaces.cc.

2028  {
2029  intptr_t free_bytes = 0;
2030  if (category->top() != NULL) {
2031  // This is safe (not going to deadlock) since Concatenate operations
2032  // are never performed on the same free lists at the same time in
2033  // reverse order.
2034  base::LockGuard<base::Mutex> target_lock_guard(mutex());
2035  base::LockGuard<base::Mutex> source_lock_guard(category->mutex());
2036  DCHECK(category->end_ != NULL);
2037  free_bytes = category->available();
2038  if (end_ == NULL) {
2039  end_ = category->end();
2040  } else {
2041  category->end()->set_next(top());
2042  }
2043  set_top(category->top());
2044  base::NoBarrier_Store(&top_, category->top_);
2045  available_ += category->available();
2046  category->Reset();
2047  }
2048  return free_bytes;
2049 }
FreeListNode * top() const
Definition: spaces.h:1456
void set_top(FreeListNode *top)
Definition: spaces.h:1460
void set_next(FreeListNode *next)
Definition: spaces.cc:2010
#define DCHECK(condition)
Definition: logging.h:205
void NoBarrier_Store(volatile Atomic8 *ptr, Atomic8 value)

References available(), available_, DCHECK, end(), end_, mutex(), v8::base::NoBarrier_Store(), NULL, Reset(), v8::internal::FreeListNode::set_next(), set_top(), top(), and top_.

Referenced by v8::internal::FreeList::Concatenate().

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

◆ ContainsPageFreeListItemsInList()

bool v8::internal::FreeListCategory::ContainsPageFreeListItemsInList ( Page p)

Definition at line 2081 of file spaces.cc.

2081  {
2082  FreeListNode* node = top();
2083  while (node != NULL) {
2084  if (Page::FromAddress(node->address()) == p) return true;
2085  node = node->next();
2086  }
2087  return false;
2088 }
static MemoryChunk * FromAddress(Address a)
Definition: spaces.h:276

References v8::internal::HeapObject::address(), v8::internal::MemoryChunk::FromAddress(), v8::internal::FreeListNode::next(), NULL, and top().

+ Here is the call graph for this function:

◆ end()

FreeListNode* v8::internal::FreeListCategory::end ( ) const
inline

Definition at line 1465 of file spaces.h.

1465 { return end_; }

References end_.

Referenced by Concatenate(), and set_end().

+ Here is the caller graph for this function:

◆ EvictFreeListItemsInList()

intptr_t v8::internal::FreeListCategory::EvictFreeListItemsInList ( Page p)

Definition at line 2059 of file spaces.cc.

2059  {
2060  int sum = 0;
2061  FreeListNode* t = top();
2062  FreeListNode** n = &t;
2063  while (*n != NULL) {
2064  if (Page::FromAddress((*n)->address()) == p) {
2065  FreeSpace* free_space = reinterpret_cast<FreeSpace*>(*n);
2066  sum += free_space->Size();
2067  *n = (*n)->next();
2068  } else {
2069  n = (*n)->next_address();
2070  }
2071  }
2072  set_top(t);
2073  if (top() == NULL) {
2074  set_end(NULL);
2075  }
2076  available_ -= sum;
2077  return sum;
2078 }
void set_end(FreeListNode *end)
Definition: spaces.h:1466

References available_, v8::internal::MemoryChunk::FromAddress(), v8::internal::FreeListNode::next(), v8::internal::FreeListNode::next_address(), NULL, set_end(), set_top(), v8::internal::FreeSpace::Size(), and top().

Referenced by v8::internal::FreeList::ContainsPageFreeListItems(), and v8::internal::FreeList::EvictFreeListItems().

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

◆ Free()

void v8::internal::FreeListCategory::Free ( FreeListNode node,
int  size_in_bytes 
)

Definition at line 2130 of file spaces.cc.

2130  {
2131  node->set_next(top());
2132  set_top(node);
2133  if (end_ == NULL) {
2134  end_ = node;
2135  }
2136  available_ += size_in_bytes;
2137 }

References available_, end_, NULL, v8::internal::FreeListNode::set_next(), set_top(), and top().

Referenced by v8::internal::FreeList::Free(), and PickNodeFromList().

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

◆ GetAvailableAddress()

int* v8::internal::FreeListCategory::GetAvailableAddress ( )
inline

Definition at line 1468 of file spaces.h.

1468 { return &available_; }

References available_.

◆ GetEndAddress()

FreeListNode** v8::internal::FreeListCategory::GetEndAddress ( )
inline

Definition at line 1464 of file spaces.h.

1464 { return &end_; }

References end_.

◆ IsEmpty()

bool v8::internal::FreeListCategory::IsEmpty ( )
inline

Definition at line 1474 of file spaces.h.

1474 { return top() == 0; }

References top().

Referenced by v8::internal::FreeList::IsEmpty().

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

◆ mutex()

base::Mutex* v8::internal::FreeListCategory::mutex ( )
inline

Definition at line 1472 of file spaces.h.

1472 { return &mutex_; }

References mutex_.

Referenced by Concatenate().

+ Here is the caller graph for this function:

◆ PickNodeFromList() [1/2]

FreeListNode * v8::internal::FreeListCategory::PickNodeFromList ( int node_size)

Definition at line 2091 of file spaces.cc.

2091  {
2092  FreeListNode* node = top();
2093 
2094  if (node == NULL) return NULL;
2095 
2096  while (node != NULL &&
2097  Page::FromAddress(node->address())->IsEvacuationCandidate()) {
2098  available_ -= reinterpret_cast<FreeSpace*>(node)->Size();
2099  node = node->next();
2100  }
2101 
2102  if (node != NULL) {
2103  set_top(node->next());
2104  *node_size = reinterpret_cast<FreeSpace*>(node)->Size();
2105  available_ -= *node_size;
2106  } else {
2107  set_top(NULL);
2108  }
2109 
2110  if (top() == NULL) {
2111  set_end(NULL);
2112  }
2113 
2114  return node;
2115 }
bool IsEvacuationCandidate()
Definition: spaces.h:607

References v8::internal::HeapObject::address(), available_, v8::internal::MemoryChunk::FromAddress(), v8::internal::MemoryChunk::IsEvacuationCandidate(), v8::internal::FreeListNode::next(), NULL, set_end(), set_top(), and top().

Referenced by v8::internal::FreeList::FindNodeFor(), and PickNodeFromList().

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

◆ PickNodeFromList() [2/2]

FreeListNode * v8::internal::FreeListCategory::PickNodeFromList ( int  size_in_bytes,
int node_size 
)

Definition at line 2118 of file spaces.cc.

2119  {
2120  FreeListNode* node = PickNodeFromList(node_size);
2121  if (node != NULL && *node_size < size_in_bytes) {
2122  Free(node, *node_size);
2123  *node_size = 0;
2124  return NULL;
2125  }
2126  return node;
2127 }
void Free(FreeListNode *node, int size_in_bytes)
Definition: spaces.cc:2130
FreeListNode * PickNodeFromList(int *node_size)
Definition: spaces.cc:2091

References Free(), NULL, and PickNodeFromList().

+ Here is the call graph for this function:

◆ RepairFreeList()

void v8::internal::FreeListCategory::RepairFreeList ( Heap heap)

Definition at line 2140 of file spaces.cc.

2140  {
2141  FreeListNode* n = top();
2142  while (n != NULL) {
2143  Map** map_location = reinterpret_cast<Map**>(n->address());
2144  if (*map_location == NULL) {
2145  *map_location = heap->free_space_map();
2146  } else {
2147  DCHECK(*map_location == heap->free_space_map());
2148  }
2149  n = n->next();
2150  }
2151 }

References v8::internal::HeapObject::address(), DCHECK, v8::internal::FreeListNode::next(), NULL, and top().

Referenced by v8::internal::FreeList::RepairLists().

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

◆ Reset()

void v8::internal::FreeListCategory::Reset ( )

Definition at line 2052 of file spaces.cc.

2052  {
2053  set_top(NULL);
2054  set_end(NULL);
2055  set_available(0);
2056 }
void set_available(int available)
Definition: spaces.h:1470

References NULL, set_available(), set_end(), and set_top().

Referenced by Concatenate(), and v8::internal::FreeList::Reset().

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

◆ set_available()

void v8::internal::FreeListCategory::set_available ( int  available)
inline

Definition at line 1470 of file spaces.h.

1470 { available_ = available; }

References available(), and available_.

Referenced by v8::internal::FreeList::FindNodeFor(), and Reset().

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

◆ set_end()

void v8::internal::FreeListCategory::set_end ( FreeListNode end)
inline

Definition at line 1466 of file spaces.h.

1466 { end_ = end; }
FreeListNode * end() const
Definition: spaces.h:1465

References end(), and end_.

Referenced by EvictFreeListItemsInList(), v8::internal::FreeList::FindNodeFor(), PickNodeFromList(), and Reset().

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

◆ set_top()

void v8::internal::FreeListCategory::set_top ( FreeListNode top)
inline

Definition at line 1460 of file spaces.h.

1460  {
1461  base::NoBarrier_Store(&top_, reinterpret_cast<base::AtomicWord>(top));
1462  }
intptr_t AtomicWord
Definition: atomicops.h:57

References v8::base::NoBarrier_Store(), top(), and top_.

Referenced by Concatenate(), EvictFreeListItemsInList(), v8::internal::FreeList::FindNodeFor(), Free(), PickNodeFromList(), and Reset().

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

◆ top()

FreeListNode* v8::internal::FreeListCategory::top ( ) const
inline

Definition at line 1456 of file spaces.h.

1456  {
1457  return reinterpret_cast<FreeListNode*>(base::NoBarrier_Load(&top_));
1458  }
Atomic8 NoBarrier_Load(volatile const Atomic8 *ptr)

References v8::base::NoBarrier_Load(), and top_.

Referenced by Concatenate(), ContainsPageFreeListItemsInList(), EvictFreeListItemsInList(), v8::internal::FreeList::FindNodeFor(), Free(), IsEmpty(), PickNodeFromList(), RepairFreeList(), and set_top().

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

Member Data Documentation

◆ available_

int v8::internal::FreeListCategory::available_
private

◆ end_

FreeListNode* v8::internal::FreeListCategory::end_
private

Definition at line 1484 of file spaces.h.

Referenced by Concatenate(), end(), Free(), GetEndAddress(), and set_end().

◆ mutex_

base::Mutex v8::internal::FreeListCategory::mutex_
private

Definition at line 1485 of file spaces.h.

Referenced by mutex().

◆ top_

base::AtomicWord v8::internal::FreeListCategory::top_
private

Definition at line 1483 of file spaces.h.

Referenced by Concatenate(), set_top(), and top().


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