#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <atomic>
#include <limits>
#include "src/trap-handler/trap-handler-internal.h"
#include "src/trap-handler/trap-handler.h"
namespace {
size_t gNextCodeObject = …;
#ifdef ENABLE_SLOW_DCHECKS
constexpr bool kEnableSlowChecks = true;
#else
constexpr bool kEnableSlowChecks = …;
#endif
}
namespace v8 {
namespace internal {
namespace trap_handler {
constexpr size_t kInitialCodeObjectSize = …;
constexpr size_t kCodeObjectGrowthFactor = …;
constexpr size_t HandlerDataSize(size_t num_protected_instructions) { … }
namespace {
#ifdef DEBUG
bool IsDisjoint(const CodeProtectionInfo* a, const CodeProtectionInfo* b) { … }
#endif
void VerifyCodeRangeIsDisjoint(const CodeProtectionInfo* code_info) { … }
void ValidateCodeObjects() { … }
}
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) { … }
void SetV8SandboxBaseAndSize(uintptr_t base, size_t size) { … }
int* GetThreadInWasmThreadLocalAddress() { … }
size_t GetRecoveredTrapCount() { … }
#if !V8_TRAP_HANDLER_SUPPORTED
bool RegisterDefaultTrapHandler() { return false; }
void RemoveTrapHandler() {}
#endif
bool g_is_trap_handler_enabled{ … };
std::atomic<bool> g_can_enable_trap_handler{ … };
bool EnableTrapHandler(bool use_v8_handler) { … }
void SetLandingPad(uintptr_t landing_pad) { … }
}
}
}