#include <cinttypes>
#include <type_traits>
#include "include/v8-wasm.h"
#include "src/base/memory.h"
#include "src/base/platform/mutex.h"
#include "src/builtins/builtins-inl.h"
#include "src/execution/arguments-inl.h"
#include "src/execution/frames-inl.h"
#include "src/heap/heap-inl.h"
#include "src/objects/property-descriptor.h"
#include "src/objects/smi.h"
#include "src/trap-handler/trap-handler.h"
#include "src/wasm/fuzzing/random-module-generation.h"
#include "src/wasm/memory-tracing.h"
#include "src/wasm/module-compiler.h"
#include "src/wasm/wasm-code-manager.h"
#include "src/wasm/wasm-engine.h"
#include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-objects-inl.h"
#include "src/wasm/wasm-result.h"
#include "src/wasm/wasm-serialization.h"
namespace v8::internal {
namespace {
V8_WARN_UNUSED_RESULT Tagged<Object> CrashUnlessFuzzing(Isolate* isolate) { … }
struct WasmCompileControls { … };
using WasmCompileControlsMap = std::map<v8::Isolate*, WasmCompileControls>;
DEFINE_LAZY_LEAKY_OBJECT_GETTER(…)
base::LazyMutex g_PerIsolateWasmControlsMutex = LAZY_MUTEX_INITIALIZER;
bool IsWasmCompileAllowed(v8::Isolate* isolate, v8::Local<v8::Value> value,
bool is_async) { … }
bool IsWasmInstantiateAllowed(v8::Isolate* isolate,
v8::Local<v8::Value> module_or_bytes,
bool is_async) { … }
v8::Local<v8::Value> NewRangeException(v8::Isolate* isolate,
const char* message) { … }
void ThrowRangeException(v8::Isolate* isolate, const char* message) { … }
bool WasmModuleOverride(const v8::FunctionCallbackInfo<v8::Value>& info) { … }
bool WasmInstanceOverride(const v8::FunctionCallbackInfo<v8::Value>& info) { … }
}
RUNTIME_FUNCTION(Runtime_SetWasmCompileControls) { … }
RUNTIME_FUNCTION(Runtime_SetWasmInstantiateControls) { … }
namespace {
void PrintIndentation(int stack_size) { … }
int WasmStackSize(Isolate* isolate) { … }
}
RUNTIME_FUNCTION(Runtime_CountUnoptimizedWasmToJSWrapper) { … }
RUNTIME_FUNCTION(Runtime_HasUnoptimizedWasmToJSWrapper) { … }
RUNTIME_FUNCTION(Runtime_HasUnoptimizedJSToJSWrapper) { … }
RUNTIME_FUNCTION(Runtime_WasmTraceEnter) { … }
RUNTIME_FUNCTION(Runtime_WasmTraceExit) { … }
RUNTIME_FUNCTION(Runtime_IsAsmWasmCode) { … }
namespace {
bool DisallowWasmCodegenFromStringsCallback(v8::Local<v8::Context> context,
v8::Local<v8::String> source) { … }
}
RUNTIME_FUNCTION(Runtime_DisallowWasmCodegen) { … }
RUNTIME_FUNCTION(Runtime_IsWasmCode) { … }
RUNTIME_FUNCTION(Runtime_IsWasmTrapHandlerEnabled) { … }
RUNTIME_FUNCTION(Runtime_IsWasmPartialOOBWriteNoop) { … }
RUNTIME_FUNCTION(Runtime_IsThreadInWasm) { … }
RUNTIME_FUNCTION(Runtime_GetWasmRecoveredTrapCount) { … }
RUNTIME_FUNCTION(Runtime_GetWasmExceptionTagId) { … }
RUNTIME_FUNCTION(Runtime_GetWasmExceptionValues) { … }
RUNTIME_FUNCTION(Runtime_SerializeWasmModule) { … }
RUNTIME_FUNCTION(Runtime_DeserializeWasmModule) { … }
RUNTIME_FUNCTION(Runtime_WasmGetNumberOfInstances) { … }
RUNTIME_FUNCTION(Runtime_WasmNumCodeSpaces) { … }
namespace {
template <typename T1, typename T2 = T1>
void PrintRep(Address address, const char* str) { … }
}
RUNTIME_FUNCTION(Runtime_WasmTraceMemory) { … }
RUNTIME_FUNCTION(Runtime_WasmTierUpFunction) { … }
RUNTIME_FUNCTION(Runtime_WasmNull) { … }
static Tagged<Object> CreateWasmObject(
Isolate* isolate, base::Vector<const uint8_t> module_bytes) { … }
RUNTIME_FUNCTION(Runtime_WasmStruct) { … }
RUNTIME_FUNCTION(Runtime_WasmArray) { … }
RUNTIME_FUNCTION(Runtime_WasmEnterDebugging) { … }
RUNTIME_FUNCTION(Runtime_WasmLeaveDebugging) { … }
RUNTIME_FUNCTION(Runtime_IsWasmDebugFunction) { … }
RUNTIME_FUNCTION(Runtime_IsLiftoffFunction) { … }
RUNTIME_FUNCTION(Runtime_IsTurboFanFunction) { … }
RUNTIME_FUNCTION(Runtime_IsUncompiledWasmFunction) { … }
RUNTIME_FUNCTION(Runtime_FreezeWasmLazyCompilation) { … }
RUNTIME_FUNCTION(Runtime_SetWasmImportedStringsEnabled) { … }
RUNTIME_FUNCTION(Runtime_FlushLiftoffCode) { … }
RUNTIME_FUNCTION(Runtime_EstimateCurrentMemoryConsumption) { … }
RUNTIME_FUNCTION(Runtime_WasmCompiledExportWrappersCount) { … }
RUNTIME_FUNCTION(Runtime_WasmDeoptsExecutedCount) { … }
RUNTIME_FUNCTION(Runtime_WasmDeoptsExecutedForFunction) { … }
RUNTIME_FUNCTION(Runtime_WasmSwitchToTheCentralStackCount) { … }
RUNTIME_FUNCTION(…) { …
#ifndef OFFICIAL_BUILD
RUNTIME_FUNCTION(Runtime_WasmGenerateRandomModule) { … }
#endif
}