// Copyright 2017 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_WASM_MODULE_COMPILER_H_ #define V8_WASM_MODULE_COMPILER_H_ #include #include #include #include "src/base/optional.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 internal { class JSArrayBuffer; class JSPromise; class Counters; class WasmModuleObject; class WasmInstanceObject; template class Vector; namespace wasm { struct CompilationEnv; class CompilationResultResolver; class ErrorThrower; class ModuleCompiler; class NativeModule; class WasmCode; struct WasmModule; std::shared_ptr CompileToNativeModule( Isolate* isolate, const WasmFeatures& enabled, ErrorThrower* thrower, std::shared_ptr module, const ModuleWireBytes& wire_bytes, Handle* export_wrappers_out); V8_EXPORT_PRIVATE void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module, Handle* export_wrappers_out); // Compiles the wrapper for this (kind, sig) pair and sets the corresponding // cache entry. Assumes the key already exists in the cache but has not been // compiled yet. V8_EXPORT_PRIVATE WasmCode* CompileImportWrapper( WasmEngine* wasm_engine, NativeModule* native_module, Counters* counters, compiler::WasmImportCallKind kind, FunctionSig* sig, WasmImportWrapperCache::ModificationScope* cache_scope); V8_EXPORT_PRIVATE Handle