5 #ifndef V8_WASM_WASM_ENGINE_H_ 6 #define V8_WASM_WASM_ENGINE_H_ 9 #include <unordered_set> 11 #include "src/wasm/wasm-code-manager.h" 12 #include "src/wasm/wasm-memory.h" 13 #include "src/wasm/wasm-tier.h" 14 #include "src/zone/accounting-allocator.h" 21 class CompilationStatistics;
22 class WasmInstanceObject;
23 class WasmModuleObject;
27 class AsyncCompileJob;
29 struct ModuleWireBytes;
42 virtual void OnInstantiationFailed(
Handle<Object> error_reason) = 0;
88 std::shared_ptr<CompilationResultResolver> resolver,
92 void AsyncInstantiate(
Isolate* isolate,
93 std::unique_ptr<InstantiationResultResolver> resolver,
97 std::shared_ptr<StreamingDecoder> StartStreamingCompilation(
99 std::shared_ptr<CompilationResultResolver> resolver);
105 uint32_t function_index, ExecutionTier tier);
109 std::shared_ptr<NativeModule> ExportNativeModule(
115 Isolate* isolate, std::shared_ptr<NativeModule> shared_module);
127 void DumpAndResetTurboStatistics();
133 std::unique_ptr<AsyncCompileJob> RemoveCompileJob(
AsyncCompileJob* job);
137 bool HasRunningCompileJob(
Isolate* isolate);
142 void DeleteCompileJobsOnIsolate(
Isolate* isolate);
145 void AddIsolate(
Isolate* isolate);
146 void RemoveIsolate(
Isolate* isolate);
149 static void InitializeOncePerProcess();
150 static void GlobalTearDown();
154 static std::shared_ptr<WasmEngine> GetWasmEngine();
159 std::unique_ptr<byte[]> bytes_copy,
size_t length,
161 std::shared_ptr<CompilationResultResolver> resolver);
176 std::unordered_map<AsyncCompileJob*, std::unique_ptr<AsyncCompileJob>> jobs_;
178 std::unique_ptr<CompilationStatistics> compilation_stats_;
179 std::unique_ptr<CodeTracer> code_tracer_;
182 std::unordered_set<Isolate*> isolates_;
194 #endif // V8_WASM_WASM_ENGINE_H_