208 std::shared_ptr<CompilationResultResolver> resolver,
210 const char* api_method_name_for_errors);
213 void AsyncInstantiate(
Isolate* isolate,
214 std::unique_ptr<InstantiationResultResolver> resolver,
218 std::shared_ptr<StreamingDecoder> StartStreamingCompilation(
221 const char* api_method_name,
222 std::shared_ptr<CompilationResultResolver> resolver);
230 void EnterDebuggingForIsolate(
Isolate* isolate);
232 void LeaveDebuggingForIsolate(
Isolate* isolate);
237 Isolate* isolate, std::shared_ptr<NativeModule> shared_module,
242 std::pair<size_t, size_t> FlushLiftoffCode();
245 size_t GetLiftoffCodeSizeForTesting();
252 std::shared_ptr<CompilationStatistics> GetOrCreateTurboStatistics();
255 void DumpAndResetTurboStatistics();
257 void DumpTurboStatistics();
263 std::unique_ptr<AsyncCompileJob> RemoveCompileJob(
AsyncCompileJob* job);
267 bool HasRunningCompileJob(
Isolate* isolate);
277 void DeleteCompileJobsOnIsolate(
Isolate* isolate);
280 void AddIsolate(
Isolate* isolate);
281 void RemoveIsolate(
Isolate* isolate);
296 void EnableCodeLogging(
Isolate*);
300 void LogOutstandingCodesForIsolate(
Isolate*);
308 std::shared_ptr<NativeModule> NewNativeModule(
312 std::shared_ptr<const WasmModule> module,
size_t code_size_estimate);
325 std::shared_ptr<NativeModule> MaybeGetNativeModule(
339 std::shared_ptr<NativeModule> UpdateNativeModuleCache(
340 bool has_error, std::shared_ptr<NativeModule> native_module,
350 bool GetStreamingCompilationOwnership(
355 void StreamingCompilationFailed(
size_t prefix_hash,
359 void ClearWeakScriptHandle(
Isolate* isolate,
360 std::unique_ptr<Address*> location);
370 void ReportLiveCodeForGC(
Isolate*, std::unordered_set<WasmCode*>& live_code);
371 void ReportLiveCodeFromStackForGC(
Isolate*);
375 void AddPotentiallyDeadCode(
WasmCode*);
378 void TriggerCodeGCForTesting();
381 using DeadCodeMap = std::unordered_map<NativeModule*, std::vector<WasmCode*>>;
382 void FreeDeadCode(
const DeadCodeMap&, std::vector<WasmCode*>&);
383 void FreeDeadCodeLocked(
const DeadCodeMap&, std::vector<WasmCode*>&);
386 const std::shared_ptr<NativeModule>&,
391 std::shared_ptr<OperationsBarrier> GetBarrierForBackgroundCompile();
398 return &call_descriptors_;
403 size_t EstimateCurrentMemoryConsumption()
const;
405 void PrintCurrentMemoryConsumptionEstimate()
const;
407 int GetDeoptsExecutedCount()
const;
408 int IncrementDeoptsExecutedCount();
411 static void InitializeOncePerProcess();
412 static void GlobalTearDown();
418 size_t NativeModuleCount()
const;
423 return reinterpret_cast<Address
>(&had_nondeterminism_);
428 return had_nondeterminism_.load(std::memory_order_relaxed) != 0;
433 had_nondeterminism_.store(1, std::memory_order_relaxed);
439 return had_nondeterminism_.exchange(0, std::memory_order_relaxed) != 0;
443 struct CurrentGCInfo;
445 struct NativeModuleInfo;
451 const char* api_method_name,
452 std::shared_ptr<CompilationResultResolver> resolver,
int compilation_id);
454 void TriggerCodeGC_Locked(
size_t dead_code_limit);
455 void TriggerGC(int8_t gc_sequence_index);
460 bool RemoveIsolateFromCurrentGC(
Isolate*);
464 void PotentiallyFinishCurrentGC();
484#ifdef V8_ENABLE_WASM_GDB_REMOTE_DEBUGGING
486 std::unique_ptr<gdb_server::GdbServer> gdb_server_;
489 std::atomic<int> next_compilation_id_{0};
492 std::atomic<int> deopts_executed_{0};
507 std::unordered_map<AsyncCompileJob*, std::unique_ptr<AsyncCompileJob>>
514 std::unordered_map<Isolate*, std::unique_ptr<IsolateInfo>>
isolates_;
517 std::unordered_map<NativeModule*, std::unique_ptr<NativeModuleInfo>>
520 std::shared_ptr<OperationsBarrier> operations_barrier_{
521 std::make_shared<OperationsBarrier>()};
526 std::atomic<size_t> num_modules_with_code_logging_{0};
530 size_t new_potentially_dead_code_size_ = 0;
535 int8_t num_code_gcs_triggered_ = 0;