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

#include <external-entity-table.h>

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

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
 
ExternalEntityTableoperator= (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< FreelistHeadTryExtend (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)
 
- Protected Member Functions inherited from v8::internal::SegmentedTable< Entry, size >
 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 ()
 

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 Protected Attributes inherited from v8::internal::SegmentedTable< Entry, size >
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

- Protected Attributes inherited from v8::internal::SegmentedTable< Entry, size >
Entry * base_ = nullptr
 
VirtualAddressSpacevas_ = nullptr
 

Detailed Description

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

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.

Member Typedef Documentation

◆ Base

template<typename Entry , size_t size>
using v8::internal::ExternalEntityTable< Entry, size >::Base = SegmentedTable<Entry, size>
protected

Definition at line 50 of file external-entity-table.h.

◆ FreelistHead

template<typename Entry , size_t size>
using v8::internal::ExternalEntityTable< Entry, size >::FreelistHead = Base::FreelistHead
protected

Definition at line 51 of file external-entity-table.h.

◆ Segment

template<typename Entry , size_t size>
using v8::internal::ExternalEntityTable< Entry, size >::Segment = Base::Segment
protected

Definition at line 52 of file external-entity-table.h.

◆ WriteIterator

template<typename Entry , size_t size>
using v8::internal::ExternalEntityTable< Entry, size >::WriteIterator = Base::WriteIterator
protected

Definition at line 53 of file external-entity-table.h.

Constructor & Destructor Documentation

◆ ExternalEntityTable() [1/2]

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

◆ ExternalEntityTable() [2/2]

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

Member Function Documentation

◆ AllocateEntry()

template<typename Entry , size_t size>
uint32_t v8::internal::ExternalEntityTable< Entry, size >::AllocateEntry ( Space * space)
protected

Definition at line 158 of file external-entity-table-inl.h.

Here is the call graph for this function:

◆ AllocateEntryBelow()

template<typename Entry , size_t size>
uint32_t v8::internal::ExternalEntityTable< Entry, size >::AllocateEntryBelow ( Space * space,
uint32_t threshold_index )
protected

Definition at line 218 of file external-entity-table-inl.h.

Here is the call graph for this function:

◆ AttachSpaceToReadOnlySegment()

template<typename Entry , size_t size>
void v8::internal::ExternalEntityTable< Entry, size >::AttachSpaceToReadOnlySegment ( Space * space)

Definition at line 98 of file external-entity-table-inl.h.

Here is the call graph for this function:

◆ DetachSpaceFromReadOnlySegment()

template<typename Entry , size_t size>
void v8::internal::ExternalEntityTable< Entry, size >::DetachSpaceFromReadOnlySegment ( Space * space)

Definition at line 130 of file external-entity-table-inl.h.

Here is the call graph for this function:

◆ Extend()

template<typename Entry , size_t size>
void v8::internal::ExternalEntityTable< Entry, size >::Extend ( Space * space,
Segment segment,
FreelistHead freelist )
private

Definition at line 281 of file external-entity-table-inl.h.

Here is the call graph for this function:

◆ GenericSweep() [1/2]

template<typename Entry , size_t size>
uint32_t v8::internal::ExternalEntityTable< Entry, size >::GenericSweep ( Space * space)
protected

Definition at line 314 of file external-entity-table-inl.h.

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

◆ GenericSweep() [2/2]

template<typename Entry , size_t size>
template<typename Callback >
uint32_t v8::internal::ExternalEntityTable< Entry, size >::GenericSweep ( Space * space,
Callback marked )
protected

Definition at line 320 of file external-entity-table-inl.h.

Here is the call graph for this function:

◆ Initialize()

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

Definition at line 48 of file external-entity-table-inl.h.

Here is the call graph for this function:

◆ InitializeSpace()

template<typename Entry , size_t size>
void v8::internal::ExternalEntityTable< Entry, size >::InitializeSpace ( Space * space)

Definition at line 80 of file external-entity-table-inl.h.

◆ IterateEntriesIn()

template<typename Entry , size_t size>
template<typename Callback >
void v8::internal::ExternalEntityTable< Entry, size >::IterateEntriesIn ( Space * space,
Callback callback )
protected

Definition at line 390 of file external-entity-table-inl.h.

◆ operator=()

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

◆ SealReadOnlySegment()

template<typename Entry , size_t size>
void v8::internal::ExternalEntityTable< Entry, size >::SealReadOnlySegment ( )
private

Definition at line 150 of file external-entity-table-inl.h.

Here is the call graph for this function:

◆ TearDown()

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

Definition at line 68 of file external-entity-table-inl.h.

Here is the call graph for this function:

◆ TearDownSpace()

template<typename Entry , size_t size>
void v8::internal::ExternalEntityTable< Entry, size >::TearDownSpace ( Space * space)

Definition at line 88 of file external-entity-table-inl.h.

Here is the call graph for this function:

◆ TryAllocateEntry()

template<typename Entry , size_t size>
std::optional< uint32_t > v8::internal::ExternalEntityTable< Entry, size >::TryAllocateEntry ( Space * space)
protected

Definition at line 166 of file external-entity-table-inl.h.

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

◆ TryAllocateEntryFromFreelist()

template<typename Entry , size_t size>
bool v8::internal::ExternalEntityTable< Entry, size >::TryAllocateEntryFromFreelist ( Space * space,
FreelistHead freelist )
protected

Definition at line 240 of file external-entity-table-inl.h.

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

◆ TryExtend()

template<typename Entry , size_t size>
std::optional< typename ExternalEntityTable< Entry, size >::FreelistHead > v8::internal::ExternalEntityTable< Entry, size >::TryExtend ( Space * space)
protected

Definition at line 263 of file external-entity-table-inl.h.

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

◆ UnsealReadOnlySegment()

template<typename Entry , size_t size>
void v8::internal::ExternalEntityTable< Entry, size >::UnsealReadOnlySegment ( )
private

Definition at line 142 of file external-entity-table-inl.h.

Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ Isolate

template<typename Entry , size_t size>
friend class Isolate
friend

Definition at line 273 of file external-entity-table.h.

Member Data Documentation

◆ kEndOfInternalReadOnlySegment

template<typename Entry , size_t size>
uint32_t v8::internal::ExternalEntityTable< Entry, size >::kEndOfInternalReadOnlySegment = kEntriesPerSegment
staticconstexprprotected

Definition at line 269 of file external-entity-table.h.

◆ kEntriesPerSegment

template<typename Entry , size_t size>
size_t v8::internal::ExternalEntityTable< Entry, size >::kEntriesPerSegment = Base::kEntriesPerSegment
staticconstexprprotected

Definition at line 55 of file external-entity-table.h.

◆ kEntryAllocationIsForbiddenMarker

template<typename Entry , size_t size>
FreelistHead v8::internal::ExternalEntityTable< Entry, size >::kEntryAllocationIsForbiddenMarker
staticconstexprprotected
Initial value:

Definition at line 223 of file external-entity-table.h.

◆ kEntrySize

template<typename Entry , size_t size>
size_t v8::internal::ExternalEntityTable< Entry, size >::kEntrySize = Base::kEntrySize
staticconstexprprotected

Definition at line 56 of file external-entity-table.h.

◆ kInternalNullEntryIndex

template<typename Entry , size_t size>
uint32_t v8::internal::ExternalEntityTable< Entry, size >::kInternalNullEntryIndex = 0
staticconstexprprotected

Definition at line 268 of file external-entity-table.h.

◆ kInternalReadOnlySegmentOffset

template<typename Entry , size_t size>
uint32_t v8::internal::ExternalEntityTable< Entry, size >::kInternalReadOnlySegmentOffset = 0
staticconstexprprotected

Definition at line 267 of file external-entity-table.h.

◆ kSegmentSize

template<typename Entry , size_t size>
size_t v8::internal::ExternalEntityTable< Entry, size >::kSegmentSize = Base::kSegmentSize
staticconstexprprotected

Definition at line 54 of file external-entity-table.h.

◆ kSupportsCompaction

template<typename Entry , size_t size>
bool v8::internal::ExternalEntityTable< Entry, size >::kSupportsCompaction = false
staticconstexpr

Definition at line 231 of file external-entity-table.h.


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