![]() |
v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
|
#include <external-entity-table.h>
Classes | |
struct | Space |
struct | SpaceWithBlackAllocationSupport |
class | UnsealReadOnlySegmentScope |
Public Member Functions | |
void | Initialize () |
void | TearDown () |
void | InitializeSpace (Space *space) |
void | TearDownSpace (Space *space) |
void | AttachSpaceToReadOnlySegment (Space *space) |
void | DetachSpaceFromReadOnlySegment (Space *space) |
Static Public Attributes | |
static constexpr bool | kSupportsCompaction = false |
Protected Types | |
using | Base = SegmentedTable<Entry, size> |
using | FreelistHead = Base::FreelistHead |
using | Segment = Base::Segment |
using | WriteIterator = Base::WriteIterator |
Protected Member Functions | |
ExternalEntityTable ()=default | |
ExternalEntityTable (const ExternalEntityTable &)=delete | |
ExternalEntityTable & | operator= (const ExternalEntityTable &)=delete |
uint32_t | AllocateEntry (Space *space) |
std::optional< uint32_t > | TryAllocateEntry (Space *space) |
uint32_t | AllocateEntryBelow (Space *space, uint32_t threshold_index) |
bool | TryAllocateEntryFromFreelist (Space *space, FreelistHead freelist) |
std::optional< FreelistHead > | TryExtend (Space *space) |
uint32_t | GenericSweep (Space *space) |
template<typename Callback > | |
uint32_t | GenericSweep (Space *space, Callback marked) |
template<typename Callback > | |
void | IterateEntriesIn (Space *space, Callback callback) |
![]() | |
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 () |
Static Protected Attributes | |
static constexpr size_t | kSegmentSize = Base::kSegmentSize |
static constexpr size_t | kEntriesPerSegment = Base::kEntriesPerSegment |
static constexpr size_t | kEntrySize = Base::kEntrySize |
static constexpr FreelistHead | kEntryAllocationIsForbiddenMarker |
static constexpr uint32_t | kInternalReadOnlySegmentOffset = 0 |
static constexpr uint32_t | kInternalNullEntryIndex = 0 |
static constexpr uint32_t | kEndOfInternalReadOnlySegment = kEntriesPerSegment |
![]() | |
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 |
Private Member Functions | |
void | UnsealReadOnlySegment () |
void | SealReadOnlySegment () |
void | Extend (Space *space, Segment segment, FreelistHead freelist) |
Friends | |
class | Isolate |
Additional Inherited Members | |
![]() | |
Entry * | base_ = nullptr |
VirtualAddressSpace * | vas_ = nullptr |
A thread-safe table with a fixed maximum size for storing references to objects located outside of the sandbox.
An external entity table provides the basic mechanisms to ensure safe access to objects located outside the sandbox, but referenced from within it. When an external entity table is used, objects located inside the sandbox reference outside objects through indices into the table.
The ExternalEntityTable class should be seen an an incomplete class that needs to be extended by a concrete implementation class, such as the ExternalPointerTable class, as it is lacking some functionality. In particular, while the ExternalEntityTable implements basic table memory management as well as entry allocation routines, it does not implement any logic for reclaiming entries such as garbage collection. This must be done by the child classes.
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.
Definition at line 47 of file external-entity-table.h.
|
protected |
Definition at line 50 of file external-entity-table.h.
|
protected |
Definition at line 51 of file external-entity-table.h.
|
protected |
Definition at line 52 of file external-entity-table.h.
|
protected |
Definition at line 53 of file external-entity-table.h.
|
protecteddefault |
|
protecteddelete |
|
protected |
Definition at line 158 of file external-entity-table-inl.h.
|
protected |
Definition at line 218 of file external-entity-table-inl.h.
void v8::internal::ExternalEntityTable< Entry, size >::AttachSpaceToReadOnlySegment | ( | Space * | space | ) |
Definition at line 98 of file external-entity-table-inl.h.
void v8::internal::ExternalEntityTable< Entry, size >::DetachSpaceFromReadOnlySegment | ( | Space * | space | ) |
Definition at line 130 of file external-entity-table-inl.h.
|
private |
Definition at line 281 of file external-entity-table-inl.h.
|
protected |
Definition at line 314 of file external-entity-table-inl.h.
|
protected |
Definition at line 320 of file external-entity-table-inl.h.
void v8::internal::ExternalEntityTable< Entry, size >::Initialize | ( | ) |
Definition at line 48 of file external-entity-table-inl.h.
void v8::internal::ExternalEntityTable< Entry, size >::InitializeSpace | ( | Space * | space | ) |
Definition at line 80 of file external-entity-table-inl.h.
|
protected |
Definition at line 390 of file external-entity-table-inl.h.
|
protecteddelete |
|
private |
Definition at line 150 of file external-entity-table-inl.h.
void v8::internal::ExternalEntityTable< Entry, size >::TearDown | ( | ) |
Definition at line 68 of file external-entity-table-inl.h.
void v8::internal::ExternalEntityTable< Entry, size >::TearDownSpace | ( | Space * | space | ) |
Definition at line 88 of file external-entity-table-inl.h.
|
protected |
Definition at line 166 of file external-entity-table-inl.h.
|
protected |
Definition at line 240 of file external-entity-table-inl.h.
|
protected |
Definition at line 263 of file external-entity-table-inl.h.
|
private |
Definition at line 142 of file external-entity-table-inl.h.
Definition at line 273 of file external-entity-table.h.
|
staticconstexprprotected |
Definition at line 269 of file external-entity-table.h.
|
staticconstexprprotected |
Definition at line 55 of file external-entity-table.h.
|
staticconstexprprotected |
Definition at line 223 of file external-entity-table.h.
|
staticconstexprprotected |
Definition at line 56 of file external-entity-table.h.
|
staticconstexprprotected |
Definition at line 268 of file external-entity-table.h.
|
staticconstexprprotected |
Definition at line 267 of file external-entity-table.h.
|
staticconstexprprotected |
Definition at line 54 of file external-entity-table.h.
|
staticconstexpr |
Definition at line 231 of file external-entity-table.h.