#if !V8_ENABLE_WEBASSEMBLY
#error This header should only be included if WebAssembly is enabled.
#endif
#ifndef V8_WASM_MODULE_COMPILER_H_
#define V8_WASM_MODULE_COMPILER_H_
#include <atomic>
#include <functional>
#include <memory>
#include <optional>
#include "include/v8-metrics.h"
#include "src/base/platform/time.h"
#include "src/common/globals.h"
#include "src/tasks/cancelable-task.h"
#include "src/wasm/compilation-environment.h"
#include "src/wasm/wasm-features.h"
#include "src/wasm/wasm-import-wrapper-cache.h"
#include "src/wasm/wasm-module.h"
namespace v8 {
namespace base {
template <typename T>
class Vector;
}
namespace internal {
class JSArrayBuffer;
class JSPromise;
class Counters;
class WasmModuleObject;
class WasmInstanceObject;
class WasmTrustedInstanceData;
namespace wasm {
struct CompilationEnv;
class CompilationResultResolver;
class ErrorThrower;
class ModuleCompiler;
class NativeModule;
class ProfileInformation;
class StreamingDecoder;
class WasmCode;
struct WasmModule;
V8_EXPORT_PRIVATE
std::shared_ptr<NativeModule> CompileToNativeModule(
Isolate* isolate, WasmEnabledFeatures enabled_features,
CompileTimeImports compile_imports, ErrorThrower* thrower,
std::shared_ptr<const WasmModule> module, ModuleWireBytes wire_bytes,
int compilation_id, v8::metrics::Recorder::ContextId context_id,
ProfileInformation* pgo_info);
V8_EXPORT_PRIVATE
void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module);
V8_EXPORT_PRIVATE WasmError ValidateAndSetBuiltinImports(
const WasmModule* module, base::Vector<const uint8_t> wire_bytes,
const CompileTimeImports& imports);
V8_EXPORT_PRIVATE
WasmCode* CompileImportWrapperForTest(NativeModule* native_module,
Counters* counters, ImportCallKind kind,
const FunctionSig* sig,
uint32_t canonical_type_index,
int expected_arity, Suspend suspend);
bool CompileLazy(Isolate*, Tagged<WasmTrustedInstanceData>, int func_index);
void ThrowLazyCompilationError(Isolate* isolate,
const NativeModule* native_module,
int func_index);
V8_EXPORT_PRIVATE void TriggerTierUp(Isolate*, Tagged<WasmTrustedInstanceData>,
int func_index);
V8_EXPORT_PRIVATE void TierUpNowForTesting(Isolate*,
Tagged<WasmTrustedInstanceData>,
int func_index);
V8_EXPORT_PRIVATE void TierUpAllForTesting(Isolate*,
Tagged<WasmTrustedInstanceData>);
class AsyncCompileJob { … };
}
}
}
#endif