5#ifndef V8_WASM_MODULE_COMPILER_H_
6#define V8_WASM_MODULE_COMPILER_H_
8#if !V8_ENABLE_WEBASSEMBLY
9#error This header should only be included if WebAssembly is enabled.
38class WasmModuleObject;
39class WasmInstanceObject;
45class CompilationResultResolver;
49class ProfileInformation;
50class StreamingDecoder;
56 Isolate* isolate, WasmEnabledFeatures enabled_features,
57 WasmDetectedFeatures detected_features, CompileTimeImports compile_imports,
58 ErrorThrower* thrower, std::shared_ptr<const WasmModule> module,
59 base::OwnedVector<const uint8_t> wire_bytes,
int compilation_id,
63 const WasmModule* module, base::Vector<const uint8_t> wire_bytes,
64 const CompileTimeImports& imports, WasmDetectedFeatures* detected);
71 NativeModule* native_module,
73 const CanonicalSig*
sig,
74 CanonicalTypeIndex type_index,
75 int expected_arity,
Suspend suspend);
84 const NativeModule* native_module,
100 NativeModule* native_module);
106 bool is_initial_compilation);
122 const char* api_method_name,
123 std::shared_ptr<CompilationResultResolver> resolver,
142 class CompilationStateCallback;
155 class PrepareAndStartCompile;
159 class FinishCompilation;
176 size_t code_size_estimate);
179 size_t code_size_estimate);
203 template <
typename Step,
209 template <
typename Step,
typename... Args>
214 template <
typename Step,
typename... Args>
219 template <
typename Step,
typename... Args>
238 const std::shared_ptr<CompilationResultResolver>
resolver_;
CompileTimeImports compile_imports_
const char *const api_method_name_
Isolate * isolate() const
V8_WARN_UNUSED_RESULT bool DecrementAndCheckFinisherCount()
const WasmEnabledFeatures enabled_features_
void NextStep(Args &&... args)
void FinishCompile(bool is_after_cache_hit)
CancelableTaskManager background_task_manager_
AsyncCompileJob(Isolate *isolate, WasmEnabledFeatures enabled_features, CompileTimeImports compile_imports, base::OwnedVector< const uint8_t > bytes, DirectHandle< Context > context, DirectHandle< NativeContext > incumbent_context, const char *api_method_name, std::shared_ptr< CompilationResultResolver > resolver, int compilation_id)
IndirectHandle< WasmModuleObject > module_object_
const std::shared_ptr< CompilationResultResolver > resolver_
WasmDetectedFeatures detected_features_
IndirectHandle< NativeContext > incumbent_context_
std::shared_ptr< StreamingDecoder > CreateStreamingDecoder()
v8::metrics::Recorder::ContextId context_id_
std::shared_ptr< v8::TaskRunner > foreground_task_runner_
IndirectHandle< NativeContext > native_context_
DirectHandle< NativeContext > context() const
std::shared_ptr< StreamingDecoder > stream_
std::shared_ptr< NativeModule > native_module_
void FinishSuccessfully()
v8::metrics::Recorder::ContextId context_id() const
void AsyncCompileSucceeded(DirectHandle< WasmModuleObject > result)
void CancelPendingForegroundTask()
void StartBackgroundTask()
void StartForegroundTask()
base::TimeTicks start_time_
void DoImmediately(Args &&... args)
std::atomic< int32_t > outstanding_finishers_
const int compilation_id_
bool GetOrCreateNativeModule(std::shared_ptr< const WasmModule > module, size_t code_size_estimate)
void ExecuteForegroundTaskImmediately()
v8::metrics::WasmModuleDecoded metrics_event_
void DoAsync(Args &&... args)
void CreateNativeModule(std::shared_ptr< const WasmModule > module, size_t code_size_estimate)
CompileTask * pending_foreground_task_
base::OwnedVector< const uint8_t > bytes_copy_
void PrepareRuntimeObjects()
std::unique_ptr< CompileStep > step_
void DoSync(Args &&... args)
ModuleWireBytes wire_bytes_
UseExistingForegroundTask
@ kAssertNoExistingForegroundTask
@ kUseExistingForegroundTask
base::Vector< const DirectHandle< Object > > args
ZoneVector< RpoNumber > & result
void TierUpNowForTesting(Isolate *isolate, Tagged< WasmTrustedInstanceData > trusted_instance_data, int func_index)
void TriggerTierUp(Isolate *isolate, Tagged< WasmTrustedInstanceData > trusted_instance_data, int func_index)
void TierUpAllForTesting(Isolate *isolate, Tagged< WasmTrustedInstanceData > trusted_instance_data)
void InitializeCompilationForTesting(NativeModule *native_module)
WasmCode * CompileImportWrapperForTest(Isolate *isolate, NativeModule *native_module, ImportCallKind kind, const CanonicalSig *sig, CanonicalTypeIndex type_index, int expected_arity, Suspend suspend)
void ThrowLazyCompilationError(Isolate *isolate, const NativeModule *native_module, int func_index)
std::shared_ptr< NativeModule > CompileToNativeModule(Isolate *isolate, WasmEnabledFeatures enabled_features, WasmDetectedFeatures detected_features, CompileTimeImports compile_imports, ErrorThrower *thrower, std::shared_ptr< const WasmModule > module, base::OwnedVector< const uint8_t > wire_bytes, int compilation_id, v8::metrics::Recorder::ContextId context_id, ProfileInformation *pgo_info)
WasmError ValidateAndSetBuiltinImports(const WasmModule *module, base::Vector< const uint8_t > wire_bytes, const CompileTimeImports &imports, WasmDetectedFeatures *detected)
void PublishDetectedFeatures(WasmDetectedFeatures detected_features, Isolate *isolate, bool is_initial_compilation)
bool CompileLazy(Isolate *isolate, Tagged< WasmTrustedInstanceData > trusted_instance_data, int func_index)
kWasmInternalFunctionIndirectPointerTag WasmTrustedInstanceData
Tagged(T object) -> Tagged< T >
wasm::WasmModule WasmModule
kWasmInternalFunctionIndirectPointerTag kProtectedInstanceDataOffset sig
#define DCHECK_LT(v1, v2)
#define V8_EXPORT_PRIVATE
#define V8_WARN_UNUSED_RESULT