v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::internal::wasm::WasmCodePointerTable Class Reference

#include <wasm-code-pointer-table.h>

Inheritance diagram for v8::internal::wasm::WasmCodePointerTable:
Collaboration diagram for v8::internal::wasm::WasmCodePointerTable:

Public Types

using Handle = uint32_t
 
using WriteScope = CFIMetadataWriteScope
 

Public Member Functions

 WasmCodePointerTable ()=default
 
 WasmCodePointerTable (const WasmCodePointerTable &)=delete
 
WasmCodePointerTableoperator= (const WasmCodePointerTable &)=delete
 
void Initialize ()
 
void TearDown ()
 
Address GetEntrypoint (WasmCodePointer index, uint64_t signature_hash) const
 
Address GetEntrypointWithoutSignatureCheck (WasmCodePointer index) const
 
void UpdateEntrypoint (WasmCodePointer index, Address value, uint64_t signature_hash)
 
void SetEntrypointAndSignature (WasmCodePointer index, Address value, uint64_t signature_hash)
 
void SetEntrypointWithWriteScope (WasmCodePointer index, Address value, uint64_t signature_hash, WriteScope &write_scope)
 
WasmCodePointer AllocateAndInitializeEntry (Address entrypoint, uint64_t signature_hash)
 
WasmCodePointer AllocateUninitializedEntry ()
 
void FreeEntry (WasmCodePointer index)
 
void SweepSegments (size_t threshold=2 *kEntriesPerSegment)
 
WasmCodePointer GetOrCreateHandleForNativeFunction (Address addr)
 
bool EntrypointEqualTo (WasmCodePointer index, Address address)
 

Static Public Attributes

static constexpr Handle kInvalidHandle = -1
 

Private Types

using Base
 

Private Member Functions

V8_INLINE FreelistHead ReadFreelistHead ()
 
uint32_t AllocateEntryImpl ()
 
V8_INLINE FreelistHead LinkFreelist (FreelistHead new_freelist, uint32_t last_element)
 
std::vector< uint32_t > FreelistToVector (FreelistHead freelist)
 
FreelistHead VectorToFreelist (std::vector< uint32_t > entries)
 
V8_INLINE bool TryAllocateFromFreelist (uint32_t *index)
 
V8_INLINE uint32_t AllocateEntryFromFreelistNonAtomic (FreelistHead *freelist_head)
 
void FreeNativeFunctionHandles ()
 

Static Private Member Functions

static bool IsRetryMarker (FreelistHead freelist)
 

Private Attributes

std::atomic< FreelistHead > freelist_head_ = FreelistHead()
 
base::Mutex segment_allocation_mutex_
 
base::Mutex native_function_map_mutex_
 
std::map< Address, WasmCodePointernative_function_map_
 

Static Private Attributes

static constexpr FreelistHead kRetryMarker = FreelistHead(0xffffffff, 0)
 

Friends

class ::v8::internal::ExternalReference
 
class WasmCodePointerTableTest
 

Additional Inherited Members

- Protected Member Functions inherited from v8::internal::SegmentedTable< WasmCodePointerTableEntry, kCodePointerTableReservationSize >
 SegmentedTable ()=default
 
 SegmentedTable (const SegmentedTable &)=delete
 
SegmentedTableoperator= (const SegmentedTable &)=delete
 
WasmCodePointerTableEntry & at (uint32_t index)
 
const WasmCodePointerTableEntry & 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 inherited from v8::internal::SegmentedTable< WasmCodePointerTableEntry, kCodePointerTableReservationSize >
WasmCodePointerTableEntry * base_
 
VirtualAddressSpacevas_
 
- Static Protected Attributes inherited from v8::internal::SegmentedTable< WasmCodePointerTableEntry, kCodePointerTableReservationSize >
static constexpr bool kIsWriteProtected
 
static constexpr int kEntrySize
 
static constexpr bool kUseContiguousMemory
 
static constexpr size_t kSegmentSize
 
static constexpr size_t kEntriesPerSegment
 

Detailed Description

Definition at line 65 of file wasm-code-pointer-table.h.

Member Typedef Documentation

◆ Base

◆ Handle

◆ WriteScope

Constructor & Destructor Documentation

◆ WasmCodePointerTable() [1/2]

v8::internal::wasm::WasmCodePointerTable::WasmCodePointerTable ( )
default

◆ WasmCodePointerTable() [2/2]

v8::internal::wasm::WasmCodePointerTable::WasmCodePointerTable ( const WasmCodePointerTable & )
delete

Member Function Documentation

◆ AllocateAndInitializeEntry()

WasmCodePointer v8::internal::wasm::WasmCodePointerTable::AllocateAndInitializeEntry ( Address entrypoint,
uint64_t signature_hash )
inline

Definition at line 89 of file wasm-code-pointer-table-inl.h.

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

◆ AllocateEntryFromFreelistNonAtomic()

uint32_t v8::internal::wasm::WasmCodePointerTable::AllocateEntryFromFreelistNonAtomic ( FreelistHead * freelist_head)
private

Definition at line 181 of file wasm-code-pointer-table-inl.h.

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

◆ AllocateEntryImpl()

uint32_t v8::internal::wasm::WasmCodePointerTable::AllocateEntryImpl ( )
private

◆ AllocateUninitializedEntry()

WasmCodePointer v8::internal::wasm::WasmCodePointerTable::AllocateUninitializedEntry ( )
inline

Definition at line 109 of file wasm-code-pointer-table-inl.h.

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

◆ EntrypointEqualTo()

bool v8::internal::wasm::WasmCodePointerTable::EntrypointEqualTo ( WasmCodePointer index,
Address address )

Definition at line 138 of file wasm-code-pointer-table.cc.

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

◆ FreeEntry()

void v8::internal::wasm::WasmCodePointerTable::FreeEntry ( WasmCodePointer index)
inline

Definition at line 190 of file wasm-code-pointer-table-inl.h.

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

◆ FreelistToVector()

std::vector< uint32_t > v8::internal::wasm::WasmCodePointerTable::FreelistToVector ( FreelistHead freelist)
private
Here is the caller graph for this function:

◆ FreeNativeFunctionHandles()

void v8::internal::wasm::WasmCodePointerTable::FreeNativeFunctionHandles ( )
private

Definition at line 143 of file wasm-code-pointer-table.cc.

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

◆ GetEntrypoint()

Address v8::internal::wasm::WasmCodePointerTable::GetEntrypoint ( WasmCodePointer index,
uint64_t signature_hash ) const
inline

Definition at line 59 of file wasm-code-pointer-table-inl.h.

Here is the call graph for this function:

◆ GetEntrypointWithoutSignatureCheck()

Address v8::internal::wasm::WasmCodePointerTable::GetEntrypointWithoutSignatureCheck ( WasmCodePointer index) const
inline

Definition at line 64 of file wasm-code-pointer-table-inl.h.

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

◆ GetOrCreateHandleForNativeFunction()

WasmCodePointer v8::internal::wasm::WasmCodePointerTable::GetOrCreateHandleForNativeFunction ( Address addr)

Definition at line 124 of file wasm-code-pointer-table.cc.

Here is the call graph for this function:

◆ Initialize()

void v8::internal::wasm::WasmCodePointerTable::Initialize ( )

Definition at line 12 of file wasm-code-pointer-table.cc.

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

◆ IsRetryMarker()

static bool v8::internal::wasm::WasmCodePointerTable::IsRetryMarker ( FreelistHead freelist)
inlinestaticprivate

Definition at line 140 of file wasm-code-pointer-table.h.

Here is the caller graph for this function:

◆ LinkFreelist()

WasmCodePointerTable::FreelistHead v8::internal::wasm::WasmCodePointerTable::LinkFreelist ( FreelistHead new_freelist,
uint32_t last_element )
private

Definition at line 197 of file wasm-code-pointer-table-inl.h.

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

◆ operator=()

WasmCodePointerTable & v8::internal::wasm::WasmCodePointerTable::operator= ( const WasmCodePointerTable & )
delete

◆ ReadFreelistHead()

WasmCodePointerTable::FreelistHead v8::internal::wasm::WasmCodePointerTable::ReadFreelistHead ( )
private

Definition at line 97 of file wasm-code-pointer-table-inl.h.

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

◆ SetEntrypointAndSignature()

void v8::internal::wasm::WasmCodePointerTable::SetEntrypointAndSignature ( WasmCodePointer index,
Address value,
uint64_t signature_hash )
inline

Definition at line 76 of file wasm-code-pointer-table-inl.h.

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

◆ SetEntrypointWithWriteScope()

void v8::internal::wasm::WasmCodePointerTable::SetEntrypointWithWriteScope ( WasmCodePointer index,
Address value,
uint64_t signature_hash,
WriteScope & write_scope )
inline

Definition at line 83 of file wasm-code-pointer-table-inl.h.

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

◆ SweepSegments()

void v8::internal::wasm::WasmCodePointerTable::SweepSegments ( size_t threshold = 2 * kEntriesPerSegment)

Definition at line 57 of file wasm-code-pointer-table.cc.

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

◆ TearDown()

void v8::internal::wasm::WasmCodePointerTable::TearDown ( )

Definition at line 14 of file wasm-code-pointer-table.cc.

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

◆ TryAllocateFromFreelist()

bool v8::internal::wasm::WasmCodePointerTable::TryAllocateFromFreelist ( uint32_t * index)
private

Definition at line 151 of file wasm-code-pointer-table-inl.h.

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

◆ UpdateEntrypoint()

void v8::internal::wasm::WasmCodePointerTable::UpdateEntrypoint ( WasmCodePointer index,
Address value,
uint64_t signature_hash )
inline

Definition at line 69 of file wasm-code-pointer-table-inl.h.

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

◆ VectorToFreelist()

WasmCodePointerTable::FreelistHead v8::internal::wasm::WasmCodePointerTable::VectorToFreelist ( std::vector< uint32_t > entries)
private

Definition at line 38 of file wasm-code-pointer-table.cc.

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

Friends And Related Symbol Documentation

◆ ::v8::internal::ExternalReference

friend class ::v8::internal::ExternalReference
friend

Definition at line 135 of file wasm-code-pointer-table.h.

◆ WasmCodePointerTableTest

friend class WasmCodePointerTableTest
friend

Definition at line 183 of file wasm-code-pointer-table.h.

Member Data Documentation

◆ freelist_head_

std::atomic<FreelistHead> v8::internal::wasm::WasmCodePointerTable::freelist_head_ = FreelistHead()
private

Definition at line 175 of file wasm-code-pointer-table.h.

◆ kInvalidHandle

Handle v8::internal::wasm::WasmCodePointerTable::kInvalidHandle = -1
staticconstexpr

Definition at line 77 of file wasm-code-pointer-table.h.

◆ kRetryMarker

FreelistHead v8::internal::wasm::WasmCodePointerTable::kRetryMarker = FreelistHead(0xffffffff, 0)
staticconstexprprivate

Definition at line 139 of file wasm-code-pointer-table.h.

◆ native_function_map_

std::map<Address, WasmCodePointer> v8::internal::wasm::WasmCodePointerTable::native_function_map_
private

Definition at line 181 of file wasm-code-pointer-table.h.

◆ native_function_map_mutex_

base::Mutex v8::internal::wasm::WasmCodePointerTable::native_function_map_mutex_
private

Definition at line 180 of file wasm-code-pointer-table.h.

◆ segment_allocation_mutex_

base::Mutex v8::internal::wasm::WasmCodePointerTable::segment_allocation_mutex_
private

Definition at line 178 of file wasm-code-pointer-table.h.


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