v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::internal::SegmentedTable< Entry, size > Class Template Reference

#include <segmented-table.h>

Inheritance diagram for v8::internal::SegmentedTable< Entry, size >:
Collaboration diagram for v8::internal::SegmentedTable< Entry, size >:

Classes

struct  FreelistHead
 
struct  Segment
 
class  WriteIterator
 

Protected Member Functions

 SegmentedTable ()=default
 
 SegmentedTable (const SegmentedTable &)=delete
 
SegmentedTableoperator= (const SegmentedTable &)=delete
 
Entry & at (uint32_t index)
 
const Entry & at (uint32_t index) const
 
WriteIterator iter_at (uint32_t index)
 
bool is_initialized () const
 
Address base () const
 
std::pair< Segment, FreelistHeadAllocateAndInitializeSegment ()
 
std::optional< std::pair< Segment, FreelistHead > > TryAllocateAndInitializeSegment ()
 
FreelistHead InitializeFreeList (Segment segment, uint32_t start_offset=0)
 
void FreeTableSegment (Segment segment)
 
void Initialize ()
 
void TearDown ()
 

Protected Attributes

Entry * base_ = nullptr
 
VirtualAddressSpacevas_ = nullptr
 

Static Protected Attributes

static constexpr bool kIsWriteProtected = Entry::IsWriteProtected
 
static constexpr int kEntrySize = sizeof(Entry)
 
static constexpr bool kUseContiguousMemory = false
 
static constexpr size_t kSegmentSize = 64 * KB
 
static constexpr size_t kEntriesPerSegment = kSegmentSize / kEntrySize
 

Detailed Description

template<typename Entry, size_t size>
class v8::internal::SegmentedTable< Entry, size >

A thread-safe table with a fixed maximum size split into segments.

The table provides thread-safe methods to allocate and free of segments and an inline freelist implementation. Allocation and Freeing of entries is implemented in subclasses since it depends on if the table is manually managed or GCed.

For the purpose of memory management, the table is partitioned into Segments (for example 64kb memory chunks) that are grouped together in "Spaces". All segments in a space share a freelist, and so entry allocation and garbage collection happen on the level of spaces.

The Entry type defines how the freelist is represented. For that, it must implement the following methods:

  • void MakeFreelistEntry(uint32_t next_entry_index)
  • uint32_t GetNextFreelistEntry()

Definition at line 34 of file segmented-table.h.

Constructor & Destructor Documentation

◆ SegmentedTable() [1/2]

template<typename Entry , size_t size>
v8::internal::SegmentedTable< Entry, size >::SegmentedTable ( )
protecteddefault

◆ SegmentedTable() [2/2]

template<typename Entry , size_t size>
v8::internal::SegmentedTable< Entry, size >::SegmentedTable ( const SegmentedTable< Entry, size > & )
protecteddelete

Member Function Documentation

◆ AllocateAndInitializeSegment()

template<typename Entry , size_t size>
std::pair< typename SegmentedTable< Entry, size >::Segment, typename SegmentedTable< Entry, size >::FreelistHead > v8::internal::SegmentedTable< Entry, size >::AllocateAndInitializeSegment ( )
protected

Definition at line 141 of file segmented-table-inl.h.

Here is the call graph for this function:

◆ at() [1/2]

template<typename Entry , size_t size>
Entry & v8::internal::SegmentedTable< Entry, size >::at ( uint32_t index)
protected

Definition at line 34 of file segmented-table-inl.h.

Here is the caller graph for this function:

◆ at() [2/2]

template<typename Entry , size_t size>
const Entry & v8::internal::SegmentedTable< Entry, size >::at ( uint32_t index) const
protected

Definition at line 39 of file segmented-table-inl.h.

◆ base()

template<typename Entry , size_t size>
Address v8::internal::SegmentedTable< Entry, size >::base ( ) const
protected

Definition at line 56 of file segmented-table-inl.h.

Here is the call graph for this function:

◆ FreeTableSegment()

template<typename Entry , size_t size>
void v8::internal::SegmentedTable< Entry, size >::FreeTableSegment ( Segment segment)
protected

Definition at line 168 of file segmented-table-inl.h.

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

◆ Initialize()

template<typename Entry , size_t size>
void v8::internal::SegmentedTable< Entry, size >::Initialize ( )
protected

Definition at line 62 of file segmented-table-inl.h.

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

◆ InitializeFreeList()

template<typename Entry , size_t size>
SegmentedTable< Entry, size >::FreelistHead v8::internal::SegmentedTable< Entry, size >::InitializeFreeList ( Segment segment,
uint32_t start_offset = 0 )
protected

Definition at line 119 of file segmented-table-inl.h.

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

◆ is_initialized()

template<typename Entry , size_t size>
bool v8::internal::SegmentedTable< Entry, size >::is_initialized ( ) const
protected

Definition at line 50 of file segmented-table-inl.h.

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

◆ iter_at()

template<typename Entry , size_t size>
SegmentedTable< Entry, size >::WriteIterator v8::internal::SegmentedTable< Entry, size >::iter_at ( uint32_t index)
protected

Definition at line 45 of file segmented-table-inl.h.

Here is the caller graph for this function:

◆ operator=()

template<typename Entry , size_t size>
SegmentedTable & v8::internal::SegmentedTable< Entry, size >::operator= ( const SegmentedTable< Entry, size > & )
protecteddelete

◆ TearDown()

template<typename Entry , size_t size>
void v8::internal::SegmentedTable< Entry, size >::TearDown ( )
protected

Definition at line 107 of file segmented-table-inl.h.

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

◆ TryAllocateAndInitializeSegment()

template<typename Entry , size_t size>
std::optional< std::pair< typename SegmentedTable< Entry, size >::Segment, typename SegmentedTable< Entry, size >::FreelistHead > > v8::internal::SegmentedTable< Entry, size >::TryAllocateAndInitializeSegment ( )
protected

Definition at line 152 of file segmented-table-inl.h.

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

Member Data Documentation

◆ base_

template<typename Entry , size_t size>
Entry* v8::internal::SegmentedTable< Entry, size >::base_ = nullptr
protected

Definition at line 221 of file segmented-table.h.

◆ kEntriesPerSegment

template<typename Entry , size_t size>
size_t v8::internal::SegmentedTable< Entry, size >::kEntriesPerSegment = kSegmentSize / kEntrySize
staticconstexprprotected

Definition at line 57 of file segmented-table.h.

◆ kEntrySize

template<typename Entry , size_t size>
int v8::internal::SegmentedTable< Entry, size >::kEntrySize = sizeof(Entry)
staticconstexprprotected

Definition at line 37 of file segmented-table.h.

◆ kIsWriteProtected

template<typename Entry , size_t size>
bool v8::internal::SegmentedTable< Entry, size >::kIsWriteProtected = Entry::IsWriteProtected
staticconstexprprotected

Definition at line 36 of file segmented-table.h.

◆ kSegmentSize

template<typename Entry , size_t size>
size_t v8::internal::SegmentedTable< Entry, size >::kSegmentSize = 64 * KB
staticconstexprprotected

Definition at line 56 of file segmented-table.h.

◆ kUseContiguousMemory

template<typename Entry , size_t size>
bool v8::internal::SegmentedTable< Entry, size >::kUseContiguousMemory = false
staticconstexprprotected

Definition at line 46 of file segmented-table.h.

◆ vas_

template<typename Entry , size_t size>
VirtualAddressSpace* v8::internal::SegmentedTable< Entry, size >::vas_ = nullptr
protected

Definition at line 226 of file segmented-table.h.


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