![]() |
v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
|
#include <segmented-table.h>
Classes | |
struct | FreelistHead |
struct | Segment |
class | WriteIterator |
Protected Member Functions | |
SegmentedTable ()=default | |
SegmentedTable (const SegmentedTable &)=delete | |
SegmentedTable & | operator= (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, FreelistHead > | AllocateAndInitializeSegment () |
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 |
VirtualAddressSpace * | vas_ = 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 |
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:
Definition at line 34 of file segmented-table.h.
|
protecteddefault |
|
protecteddelete |
|
protected |
|
protected |
|
protected |
Definition at line 39 of file segmented-table-inl.h.
|
protected |
|
protected |
Definition at line 168 of file segmented-table-inl.h.
|
protected |
Definition at line 62 of file segmented-table-inl.h.
|
protected |
Definition at line 119 of file segmented-table-inl.h.
|
protected |
Definition at line 50 of file segmented-table-inl.h.
|
protected |
|
protecteddelete |
|
protected |
Definition at line 107 of file segmented-table-inl.h.
|
protected |
Definition at line 152 of file segmented-table-inl.h.
|
protected |
Definition at line 221 of file segmented-table.h.
|
staticconstexprprotected |
Definition at line 57 of file segmented-table.h.
|
staticconstexprprotected |
Definition at line 37 of file segmented-table.h.
|
staticconstexprprotected |
Definition at line 36 of file segmented-table.h.
|
staticconstexprprotected |
Definition at line 56 of file segmented-table.h.
|
staticconstexprprotected |
Definition at line 46 of file segmented-table.h.
|
protected |
Definition at line 226 of file segmented-table.h.