![]() |
v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
|
Classes | |
struct | CodeProtectionInfo |
struct | CodeProtectionInfoListEntry |
class | MetadataLock |
struct | ProtectedInstructionData |
struct | SandboxRecord |
class | SandboxRecordsLock |
Functions | |
void | HandleSignal (int signum, siginfo_t *info, void *context) |
bool | TryHandleSignal (int signum, siginfo_t *info, void *context) |
LONG WINAPI | HandleWasmTrap (EXCEPTION_POINTERS *exception) |
TH_DISABLE_ASAN bool | TryHandleWasmTrap (EXCEPTION_POINTERS *exception) |
constexpr size_t | HandlerDataSize (size_t num_protected_instructions) |
CodeProtectionInfo * | CreateHandlerData (uintptr_t base, size_t size, size_t num_protected_instructions, const ProtectedInstructionData *protected_instructions) |
int | RegisterHandlerData (uintptr_t base, size_t size, size_t num_protected_instructions, const ProtectedInstructionData *protected_instructions) |
void | ReleaseHandlerData (int index) |
bool | RegisterV8Sandbox (uintptr_t base, size_t size) |
void | UnregisterV8Sandbox (uintptr_t base, size_t size) |
int * | GetThreadInWasmThreadLocalAddress () |
size_t | GetRecoveredTrapCount () |
bool | RegisterDefaultTrapHandler () |
void | RemoveTrapHandler () |
bool | EnableTrapHandler (bool use_v8_handler) |
void | SetLandingPad (uintptr_t landing_pad) |
bool | IsFaultAddressCovered (uintptr_t fault_addr) |
bool | IsAccessedMemoryCovered (uintptr_t accessed_addr) |
bool | IsTrapHandlerEnabled () |
TH_DISABLE_ASAN bool | IsThreadInWasm () |
void | SetThreadInWasm () |
void | ClearThreadInWasm () |
void | AssertThreadNotInWasm () |
Variables | |
constexpr size_t | kInitialCodeObjectSize = 1024 |
constexpr size_t | kCodeObjectGrowthFactor = 2 |
bool | g_is_trap_handler_enabled {false} |
std::atomic< bool > | g_can_enable_trap_handler {true} |
thread_local int | g_thread_in_wasm_code |
size_t | gNumCodeObjects = 0 |
CodeProtectionInfoListEntry * | gCodeObjects = nullptr |
SandboxRecord * | gSandboxRecordsHead = nullptr |
std::atomic_size_t | gRecoveredTrapCount = {0} |
std::atomic< uintptr_t > | gLandingPad = {0} |
const int | kInvalidIndex = -1 |
|
inline |
|
inline |
Definition at line 195 of file trap-handler.h.
CodeProtectionInfo * v8::internal::trap_handler::CreateHandlerData | ( | uintptr_t | base, |
size_t | size, | ||
size_t | num_protected_instructions, | ||
const ProtectedInstructionData * | protected_instructions ) |
Definition at line 108 of file handler-outside.cc.
TH_EXPORT_PRIVATE bool v8::internal::trap_handler::EnableTrapHandler | ( | bool | use_v8_handler | ) |
Definition at line 298 of file handler-outside.cc.
TH_EXPORT_PRIVATE size_t v8::internal::trap_handler::GetRecoveredTrapCount | ( | ) |
V8_NOINLINE TH_EXPORT_PRIVATE int * v8::internal::trap_handler::GetThreadInWasmThreadLocalAddress | ( | ) |
void v8::internal::trap_handler::HandleSignal | ( | int | signum, |
siginfo_t * | info, | ||
void * | context ) |
bool v8::internal::trap_handler::IsAccessedMemoryCovered | ( | uintptr_t | accessed_addr | ) |
bool v8::internal::trap_handler::IsFaultAddressCovered | ( | uintptr_t | fault_addr | ) |
|
inline |
|
inline |
bool v8::internal::trap_handler::RegisterDefaultTrapHandler | ( | ) |
int TH_EXPORT_PRIVATE v8::internal::trap_handler::RegisterHandlerData | ( | uintptr_t | base, |
size_t | size, | ||
size_t | num_protected_instructions, | ||
const ProtectedInstructionData * | protected_instructions ) |
Adds the handler data to the place where the trap handler will find it.
This returns a number that can be used to identify the handler data to ReleaseHandlerData, or -1 on failure.
Definition at line 131 of file handler-outside.cc.
bool TH_EXPORT_PRIVATE v8::internal::trap_handler::RegisterV8Sandbox | ( | uintptr_t | base, |
size_t | size ) |
Registers the base and size of the V8 sandbox region into list of sandboxes records. If successful, these will be used by the trap handler: only faulting accesses to memory inside the V8 sandboxes should be handled by the trap handler since all Wasm memory objects are located inside the sandboxes.
Definition at line 234 of file handler-outside.cc.
void TH_EXPORT_PRIVATE v8::internal::trap_handler::ReleaseHandlerData | ( | int | index | ) |
Removes the data from the master list and frees any memory, if necessary. TODO(mtrofin): We can switch to using size_t for index and not need kInvalidIndex.
Definition at line 207 of file handler-outside.cc.
TH_EXPORT_PRIVATE void v8::internal::trap_handler::RemoveTrapHandler | ( | ) |
Definition at line 292 of file handler-outside.cc.
TH_EXPORT_PRIVATE void v8::internal::trap_handler::SetLandingPad | ( | uintptr_t | landing_pad | ) |
|
inline |
Definition at line 188 of file trap-handler.h.
bool v8::internal::trap_handler::TryHandleSignal | ( | int | signum, |
siginfo_t * | info, | ||
void * | context ) |
TH_DISABLE_ASAN bool v8::internal::trap_handler::TryHandleWasmTrap | ( | EXCEPTION_POINTERS * | exception | ) |
void TH_EXPORT_PRIVATE v8::internal::trap_handler::UnregisterV8Sandbox | ( | uintptr_t | base, |
size_t | size ) |
Unregisters the base and size of the V8 sandbox region decribed by base and size.
Definition at line 257 of file handler-outside.cc.
TH_EXPORT_PRIVATE std::atomic< bool > v8::internal::trap_handler::g_can_enable_trap_handler {true} |
Definition at line 296 of file handler-outside.cc.
TH_EXPORT_PRIVATE bool v8::internal::trap_handler::g_is_trap_handler_enabled {false} |
Definition at line 295 of file handler-outside.cc.
thread_local int v8::internal::trap_handler::g_thread_in_wasm_code |
Definition at line 29 of file handler-shared.cc.
CodeProtectionInfoListEntry * v8::internal::trap_handler::gCodeObjects = nullptr |
Definition at line 36 of file handler-shared.cc.
std::atomic< uintptr_t > v8::internal::trap_handler::gLandingPad = {0} |
Definition at line 39 of file handler-shared.cc.
size_t v8::internal::trap_handler::gNumCodeObjects = 0 |
Definition at line 35 of file handler-shared.cc.
std::atomic_size_t v8::internal::trap_handler::gRecoveredTrapCount = {0} |
Definition at line 38 of file handler-shared.cc.
SandboxRecord * v8::internal::trap_handler::gSandboxRecordsHead = nullptr |
Definition at line 37 of file handler-shared.cc.
|
constexpr |
Definition at line 46 of file handler-outside.cc.
|
constexpr |
Definition at line 45 of file handler-outside.cc.
const int v8::internal::trap_handler::kInvalidIndex = -1 |
Definition at line 111 of file trap-handler.h.