[isolate][cleanup] Remove pointer to WasmEngine

The WasmEngine is shared across the whole process, so there is no need
to store it in every Isolate.
Instead, we can just get it from everywhere on any thread using
{wasm::GetWasmEngine()}, which is a simple read of a global.

R=jkummerow@chromium.org

Bug: v8:11879
Change-Id: I13afb8ca3d116aa14bfaec5a4bbd6d71faa9aa17
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2969825
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Maya Lekova <mslekova@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75265}
This commit is contained in:
Clemens Backes 2021-06-18 16:29:39 +02:00 committed by V8 LUCI CQ
parent 3e6230062e
commit fa3cd68a3f
46 changed files with 190 additions and 224 deletions

View File

@ -7577,7 +7577,7 @@ MaybeLocal<WasmModuleObject> WasmModuleObject::FromCompiledModule(
#if V8_ENABLE_WEBASSEMBLY
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
i::Handle<i::WasmModuleObject> module_object =
i_isolate->wasm_engine()->ImportNativeModule(
i::wasm::GetWasmEngine()->ImportNativeModule(
i_isolate, compiled_module.native_module_,
base::VectorOf(compiled_module.source_url()));
return Local<WasmModuleObject>::Cast(
@ -8238,7 +8238,7 @@ void Isolate::RequestInterrupt(InterruptCallback callback, void* data) {
bool Isolate::HasPendingBackgroundTasks() {
#if V8_ENABLE_WEBASSEMBLY
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
return isolate->wasm_engine()->HasRunningCompileJob(isolate);
return i::wasm::GetWasmEngine()->HasRunningCompileJob(isolate);
#else
return false;
#endif // V8_ENABLE_WEBASSEMBLY
@ -8579,9 +8579,9 @@ void Isolate::GetHeapStatistics(HeapStatistics* heap_statistics) {
#if V8_ENABLE_WEBASSEMBLY
heap_statistics->malloced_memory_ +=
isolate->wasm_engine()->allocator()->GetCurrentMemoryUsage();
i::wasm::GetWasmEngine()->allocator()->GetCurrentMemoryUsage();
heap_statistics->peak_malloced_memory_ +=
isolate->wasm_engine()->allocator()->GetMaxMemoryUsage();
i::wasm::GetWasmEngine()->allocator()->GetMaxMemoryUsage();
#endif // V8_ENABLE_WEBASSEMBLY
}
@ -8895,7 +8895,7 @@ int Isolate::ContextDisposedNotification(bool dependant_context) {
// of that context.
// A handle scope for the native context.
i::HandleScope handle_scope(isolate);
isolate->wasm_engine()->DeleteCompileJobsOnContext(
i::wasm::GetWasmEngine()->DeleteCompileJobsOnContext(
isolate->native_context());
}
}

View File

@ -265,7 +265,7 @@ UnoptimizedCompilationJob::Status AsmJsCompilationJob::FinalizeJobImpl(
// The result is a compiled module and serialized standard library uses.
wasm::ErrorThrower thrower(isolate, "AsmJs::Compile");
Handle<AsmWasmData> result =
isolate->wasm_engine()
wasm::GetWasmEngine()
->SyncCompileTranslatedAsmJs(
isolate, &thrower,
wasm::ModuleWireBytes(module_->begin(), module_->end()),
@ -322,7 +322,7 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(Isolate* isolate,
instantiate_timer.Start();
Handle<HeapNumber> uses_bitset(wasm_data->uses_bitset(), isolate);
Handle<Script> script(Script::cast(shared->script()), isolate);
const auto& wasm_engine = isolate->wasm_engine();
auto* wasm_engine = wasm::GetWasmEngine();
// Allocate the WasmModuleObject.
Handle<WasmModuleObject> module =

View File

@ -235,7 +235,9 @@ class PipelineData {
const ProfileDataFromFile* profile_data)
: isolate_(isolate),
#if V8_ENABLE_WEBASSEMBLY
wasm_engine_(isolate_->wasm_engine()),
// TODO(clemensb): Remove this field, use GetWasmEngine directly
// instead.
wasm_engine_(wasm::GetWasmEngine()),
#endif // V8_ENABLE_WEBASSEMBLY
allocator_(allocator),
info_(info),

View File

@ -7695,7 +7695,7 @@ MaybeHandle<Code> CompileWasmToJSWrapper(Isolate* isolate,
// Run the compilation job synchronously.
std::unique_ptr<OptimizedCompilationJob> job(
Pipeline::NewWasmHeapStubCompilationJob(
isolate, isolate->wasm_engine(), incoming, std::move(zone), graph,
isolate, wasm::GetWasmEngine(), incoming, std::move(zone), graph,
CodeKind::WASM_TO_JS_FUNCTION, std::move(name_buffer),
AssemblerOptions::Default(isolate)));
@ -7742,7 +7742,7 @@ MaybeHandle<Code> CompileJSToJSWrapper(Isolate* isolate,
// Run the compilation job synchronously.
std::unique_ptr<OptimizedCompilationJob> job(
Pipeline::NewWasmHeapStubCompilationJob(
isolate, isolate->wasm_engine(), incoming, std::move(zone), graph,
isolate, wasm::GetWasmEngine(), incoming, std::move(zone), graph,
CodeKind::JS_TO_JS_FUNCTION, std::move(name_buffer),
AssemblerOptions::Default(isolate)));
@ -7797,7 +7797,7 @@ Handle<CodeT> CompileCWasmEntry(Isolate* isolate, const wasm::FunctionSig* sig,
// Run the compilation job synchronously.
std::unique_ptr<OptimizedCompilationJob> job(
Pipeline::NewWasmHeapStubCompilationJob(
isolate, isolate->wasm_engine(), incoming, std::move(zone), graph,
isolate, wasm::GetWasmEngine(), incoming, std::move(zone), graph,
CodeKind::C_WASM_ENTRY, std::move(name_buffer),
AssemblerOptions::Default(isolate)));

View File

@ -776,12 +776,12 @@ MaybeLocal<UnboundScript> CompileInspectorScript(Isolate* v8_isolate,
#if V8_ENABLE_WEBASSEMBLY
void TierDownAllModulesPerIsolate(Isolate* v8_isolate) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
isolate->wasm_engine()->TierDownAllModulesPerIsolate(isolate);
i::wasm::GetWasmEngine()->TierDownAllModulesPerIsolate(isolate);
}
void TierUpAllModulesPerIsolate(Isolate* v8_isolate) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
isolate->wasm_engine()->TierUpAllModulesPerIsolate(isolate);
i::wasm::GetWasmEngine()->TierUpAllModulesPerIsolate(isolate);
}
#endif // V8_ENABLE_WEBASSEMBLY

View File

@ -99,11 +99,8 @@ const char* V8NameConverter::NameOfAddress(byte* pc) const {
#if V8_ENABLE_WEBASSEMBLY
wasm::WasmCodeRefScope wasm_code_ref_scope;
wasm::WasmCode* wasm_code =
isolate_ ? isolate_->wasm_engine()->code_manager()->LookupCode(
reinterpret_cast<Address>(pc))
: nullptr;
if (wasm_code != nullptr) {
if (auto* wasm_code = wasm::GetWasmEngine()->code_manager()->LookupCode(
reinterpret_cast<Address>(pc))) {
SNPrintF(v8_buffer_, "%p (%s)", static_cast<void*>(pc),
wasm::GetWasmCodeKindAsString(wasm_code->kind()));
return v8_buffer_.begin();

View File

@ -2862,9 +2862,8 @@ V8_EXPORT_PRIVATE extern void _v8_internal_Print_Code(void* object) {
#if V8_ENABLE_WEBASSEMBLY
{
i::wasm::WasmCodeRefScope scope;
i::wasm::WasmCode* wasm_code =
isolate->wasm_engine()->code_manager()->LookupCode(address);
if (wasm_code) {
if (auto* wasm_code =
i::wasm::GetWasmEngine()->code_manager()->LookupCode(address)) {
i::StdoutStream os;
wasm_code->Disassemble(nullptr, os, address);
return;

View File

@ -571,8 +571,7 @@ StackFrame::Type StackFrame::ComputeType(const StackFrameIteratorBase* iterator,
// returned {wasm_code} to be null and fall back to {GetContainingCode}.
wasm::WasmCodeRefScope code_ref_scope;
if (wasm::WasmCode* wasm_code =
iterator->isolate()->wasm_engine()->code_manager()->LookupCode(
pc)) {
wasm::GetWasmEngine()->code_manager()->LookupCode(pc)) {
switch (wasm_code->kind()) {
case wasm::WasmCode::kFunction:
return WASM;
@ -946,7 +945,7 @@ void CommonFrame::IterateCompiledFrame(RootVisitor* v) const {
#if V8_ENABLE_WEBASSEMBLY
if (auto* wasm_code =
isolate()->wasm_engine()->code_manager()->LookupCode(inner_pointer)) {
wasm::GetWasmEngine()->code_manager()->LookupCode(inner_pointer)) {
is_wasm = true;
SafepointTable table(wasm_code);
safepoint_entry = table.FindEntry(inner_pointer);
@ -982,7 +981,7 @@ void CommonFrame::IterateCompiledFrame(RootVisitor* v) const {
// directly call a Wasm function from JavaScript. In this case the
// parameters we pass to the callee are not tagged.
wasm::WasmCode* wasm_callee =
isolate()->wasm_engine()->code_manager()->LookupCode(callee_pc());
wasm::GetWasmEngine()->code_manager()->LookupCode(callee_pc());
bool is_wasm_call = (wasm_callee != nullptr);
if (is_wasm_call) has_tagged_outgoing_params = false;
#endif // V8_ENABLE_WEBASSEMBLY
@ -1862,8 +1861,7 @@ void WasmFrame::Print(StringStream* accumulator, PrintMode mode,
wasm::WasmCodeRefScope code_ref_scope;
accumulator->Add("WASM [");
accumulator->PrintName(script().name());
Address instruction_start = isolate()
->wasm_engine()
Address instruction_start = wasm::GetWasmEngine()
->code_manager()
->LookupCode(pc())
->instruction_start();
@ -1886,7 +1884,7 @@ void WasmFrame::Print(StringStream* accumulator, PrintMode mode,
}
wasm::WasmCode* WasmFrame::wasm_code() const {
return isolate()->wasm_engine()->code_manager()->LookupCode(pc());
return wasm::GetWasmEngine()->code_manager()->LookupCode(pc());
}
WasmInstanceObject WasmFrame::wasm_instance() const {
@ -1948,7 +1946,7 @@ bool WasmFrame::at_to_number_conversion() const {
// ToNumber conversion call.
wasm::WasmCode* code =
callee_pc() != kNullAddress
? isolate()->wasm_engine()->code_manager()->LookupCode(callee_pc())
? wasm::GetWasmEngine()->code_manager()->LookupCode(callee_pc())
: nullptr;
if (!code || code->kind() != wasm::WasmCode::kWasmToJsWrapper) return false;
int offset = static_cast<int>(callee_pc() - code->instruction_start());
@ -1961,7 +1959,7 @@ bool WasmFrame::at_to_number_conversion() const {
int WasmFrame::LookupExceptionHandlerInTable() {
wasm::WasmCode* code =
isolate()->wasm_engine()->code_manager()->LookupCode(pc());
wasm::GetWasmEngine()->code_manager()->LookupCode(pc());
if (!code->IsAnonymous() && code->handler_table_size() > 0) {
HandlerTable table(code);
int pc_offset = static_cast<int>(pc() - code->instruction_start());
@ -1973,7 +1971,7 @@ int WasmFrame::LookupExceptionHandlerInTable() {
void WasmDebugBreakFrame::Iterate(RootVisitor* v) const {
DCHECK(caller_pc());
wasm::WasmCode* code =
isolate()->wasm_engine()->code_manager()->LookupCode(caller_pc());
wasm::GetWasmEngine()->code_manager()->LookupCode(caller_pc());
DCHECK(code);
SafepointTable table(code);
SafepointEntry safepoint_entry = table.FindEntry(caller_pc());

View File

@ -1793,10 +1793,10 @@ Object Isolate::UnwindAndFindHandler() {
wasm::WasmCodeRefScope code_ref_scope;
WasmFrame* wasm_frame = static_cast<WasmFrame*>(frame);
wasm::WasmCode* wasm_code =
wasm_engine()->code_manager()->LookupCode(frame->pc());
wasm::GetWasmEngine()->code_manager()->LookupCode(frame->pc());
int offset = wasm_frame->LookupExceptionHandlerInTable();
if (offset < 0) break;
wasm_engine()->SampleCatchEvent(this);
wasm::GetWasmEngine()->SampleCatchEvent(this);
// Compute the stack pointer from the frame pointer. This ensures that
// argument slots on the stack are dropped as returning would.
Address return_sp = frame->fp() +
@ -1854,7 +1854,8 @@ Object Isolate::UnwindAndFindHandler() {
StubFrame* stub_frame = static_cast<StubFrame*>(frame);
#if defined(DEBUG) && V8_ENABLE_WEBASSEMBLY
wasm::WasmCodeRefScope code_ref_scope;
DCHECK_NULL(wasm_engine()->code_manager()->LookupCode(frame->pc()));
DCHECK_NULL(
wasm::GetWasmEngine()->code_manager()->LookupCode(frame->pc()));
#endif // defined(DEBUG) && V8_ENABLE_WEBASSEMBLY
Code code = stub_frame->LookupCode();
if (!code.IsCode() || code.kind() != CodeKind::BUILTIN ||
@ -2722,13 +2723,6 @@ void Isolate::UnregisterManagedPtrDestructor(ManagedPtrDestructor* destructor) {
}
#if V8_ENABLE_WEBASSEMBLY
void Isolate::SetWasmEngine(wasm::WasmEngine* engine) {
DCHECK_NULL(wasm_engine_); // Only call once before {Init}.
DCHECK_NOT_NULL(engine);
wasm_engine_ = engine;
wasm_engine_->AddIsolate(this);
}
void Isolate::AddSharedWasmMemory(Handle<WasmMemoryObject> memory_object) {
HandleScope scope(this);
Handle<WeakArrayList> shared_wasm_memories =
@ -3119,7 +3113,7 @@ void Isolate::Deinit() {
debug()->Unload();
#if V8_ENABLE_WEBASSEMBLY
wasm_engine()->DeleteCompileJobsOnIsolate(this);
wasm::GetWasmEngine()->DeleteCompileJobsOnIsolate(this);
BackingStore::RemoveSharedWasmMemoryObjects(this);
#endif // V8_ENABLE_WEBASSEMBLY
@ -3194,7 +3188,7 @@ void Isolate::Deinit() {
if (logfile != nullptr) base::Fclose(logfile);
#if V8_ENABLE_WEBASSEMBLY
wasm_engine_->RemoveIsolate(this);
wasm::GetWasmEngine()->RemoveIsolate(this);
#endif // V8_ENABLE_WEBASSEMBLY
TearDownEmbeddedBlob();
@ -3685,7 +3679,7 @@ bool Isolate::Init(SnapshotData* startup_snapshot_data,
isolate_data_.external_reference_table()->Init(this);
#if V8_ENABLE_WEBASSEMBLY
SetWasmEngine(wasm::WasmEngine::GetWasmEngine());
wasm::GetWasmEngine()->AddIsolate(this);
#endif // V8_ENABLE_WEBASSEMBLY
if (setup_delegate_ == nullptr) {
@ -3964,7 +3958,7 @@ void Isolate::DumpAndResetStats() {
// TODO(7424): There is no public API for the {WasmEngine} yet. So for now we
// just dump and reset the engines statistics together with the Isolate.
if (FLAG_turbo_stats_wasm) {
wasm_engine()->DumpAndResetTurboStatistics();
wasm::GetWasmEngine()->DumpAndResetTurboStatistics();
}
#endif // V8_ENABLE_WEBASSEMBLY
#if V8_RUNTIME_CALL_STATS

View File

@ -133,10 +133,6 @@ class NodeObserver;
class PerIsolateCompilerCache;
} // namespace compiler
namespace wasm {
class WasmEngine;
} // namespace wasm
namespace win64_unwindinfo {
class BuiltinUnwindInfo;
} // namespace win64_unwindinfo
@ -1725,10 +1721,6 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
}
#if V8_ENABLE_WEBASSEMBLY
// TODO(wasm): Replace all uses by {WasmEngine::GetWasmEngine}?
wasm::WasmEngine* wasm_engine() const { return wasm_engine_; }
void SetWasmEngine(wasm::WasmEngine* engine);
void AddSharedWasmMemory(Handle<WasmMemoryObject> memory_object);
#endif // V8_ENABLE_WEBASSEMBLY
@ -2179,10 +2171,6 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
size_t elements_deletion_counter_ = 0;
#if V8_ENABLE_WEBASSEMBLY
wasm::WasmEngine* wasm_engine_ = nullptr;
#endif // V8_ENABLE_WEBASSEMBLY
std::unique_ptr<TracingCpuProfilerImpl> tracing_cpu_profiler_;
EmbeddedFileWriterInterface* embedded_file_writer_ = nullptr;

View File

@ -297,12 +297,12 @@ Object StackGuard::HandleInterrupts() {
if (TestAndClear(&interrupt_flags, LOG_WASM_CODE)) {
TRACE_EVENT0("v8.wasm", "V8.LogCode");
isolate_->wasm_engine()->LogOutstandingCodesForIsolate(isolate_);
wasm::GetWasmEngine()->LogOutstandingCodesForIsolate(isolate_);
}
if (TestAndClear(&interrupt_flags, WASM_CODE_GC)) {
TRACE_EVENT0("v8.wasm", "V8.WasmCodeGC");
isolate_->wasm_engine()->ReportLiveCodeFromStackForGC(isolate_);
wasm::GetWasmEngine()->ReportLiveCodeFromStackForGC(isolate_);
}
#endif // V8_ENABLE_WEBASSEMBLY

View File

@ -2053,9 +2053,7 @@ void Logger::SetCodeEventHandler(uint32_t options,
if (event_handler) {
#if V8_ENABLE_WEBASSEMBLY
if (isolate_->wasm_engine() != nullptr) {
isolate_->wasm_engine()->EnableCodeLogging(isolate_);
}
wasm::GetWasmEngine()->EnableCodeLogging(isolate_);
#endif // V8_ENABLE_WEBASSEMBLY
jit_logger_ = std::make_unique<JitLogger>(isolate_, event_handler);
AddCodeEventListener(jit_logger_.get());

View File

@ -76,7 +76,7 @@ ProfilingScope::ProfilingScope(Isolate* isolate, ProfilerListener* listener)
isolate_->set_num_cpu_profilers(profiler_count);
isolate_->set_is_profiling(true);
#if V8_ENABLE_WEBASSEMBLY
isolate_->wasm_engine()->EnableCodeLogging(isolate_);
wasm::GetWasmEngine()->EnableCodeLogging(isolate_);
#endif // V8_ENABLE_WEBASSEMBLY
Logger* logger = isolate_->logger();

View File

@ -435,8 +435,8 @@ RUNTIME_FUNCTION(Runtime_WasmTierUpFunction) {
CONVERT_ARG_HANDLE_CHECKED(WasmInstanceObject, instance, 0);
CONVERT_SMI_ARG_CHECKED(function_index, 1);
auto* native_module = instance->module_object().native_module();
isolate->wasm_engine()->CompileFunction(
isolate, native_module, function_index, wasm::ExecutionTier::kTurbofan);
wasm::GetWasmEngine()->CompileFunction(isolate, native_module, function_index,
wasm::ExecutionTier::kTurbofan);
CHECK(!native_module->compilation_state()->failed());
return ReadOnlyRoots(isolate).undefined_value();
}
@ -444,14 +444,14 @@ RUNTIME_FUNCTION(Runtime_WasmTierUpFunction) {
RUNTIME_FUNCTION(Runtime_WasmTierDown) {
HandleScope scope(isolate);
DCHECK_EQ(0, args.length());
isolate->wasm_engine()->TierDownAllModulesPerIsolate(isolate);
wasm::GetWasmEngine()->TierDownAllModulesPerIsolate(isolate);
return ReadOnlyRoots(isolate).undefined_value();
}
RUNTIME_FUNCTION(Runtime_WasmTierUp) {
HandleScope scope(isolate);
DCHECK_EQ(0, args.length());
isolate->wasm_engine()->TierUpAllModulesPerIsolate(isolate);
wasm::GetWasmEngine()->TierUpAllModulesPerIsolate(isolate);
return ReadOnlyRoots(isolate).undefined_value();
}

View File

@ -1344,7 +1344,7 @@ RUNTIME_FUNCTION(Runtime_EnableCodeLoggingForTesting) {
};
static base::LeakyObject<NoopListener> noop_listener;
#if V8_ENABLE_WEBASSEMBLY
isolate->wasm_engine()->EnableCodeLogging(isolate);
wasm::GetWasmEngine()->EnableCodeLogging(isolate);
#endif // V8_ENABLE_WEBASSEMBLY
isolate->code_event_dispatcher()->AddListener(noop_listener.get());
return ReadOnlyRoots(isolate).undefined_value();

View File

@ -180,7 +180,7 @@ RUNTIME_FUNCTION(Runtime_WasmThrow) {
values, StoreOrigin::kMaybeKeyed, Just(ShouldThrow::kThrowOnError))
.Check();
isolate->wasm_engine()->SampleThrowEvent(isolate);
wasm::GetWasmEngine()->SampleThrowEvent(isolate);
return isolate->Throw(*exception);
}
@ -188,7 +188,7 @@ RUNTIME_FUNCTION(Runtime_WasmReThrow) {
ClearThreadInWasmScope clear_wasm_flag(isolate);
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
isolate->wasm_engine()->SampleRethrowEvent(isolate);
wasm::GetWasmEngine()->SampleRethrowEvent(isolate);
return isolate->ReThrow(args[0]);
}

View File

@ -1118,7 +1118,7 @@ auto Module::validate(Store* store_abs, const vec<byte_t>& binary) -> bool {
{reinterpret_cast<const uint8_t*>(binary.get()), binary.size()});
i::Isolate* isolate = impl(store_abs)->i_isolate();
i::wasm::WasmFeatures features = i::wasm::WasmFeatures::FromIsolate(isolate);
return isolate->wasm_engine()->SyncValidate(isolate, features, bytes);
return i::wasm::GetWasmEngine()->SyncValidate(isolate, features, bytes);
}
auto Module::make(Store* store_abs, const vec<byte_t>& binary) -> own<Module> {
@ -1131,7 +1131,7 @@ auto Module::make(Store* store_abs, const vec<byte_t>& binary) -> own<Module> {
i::wasm::WasmFeatures features = i::wasm::WasmFeatures::FromIsolate(isolate);
i::wasm::ErrorThrower thrower(isolate, "ignored");
i::Handle<i::WasmModuleObject> module;
if (!isolate->wasm_engine()
if (!i::wasm::GetWasmEngine()
->SyncCompile(isolate, features, &thrower, bytes)
.ToHandle(&module)) {
thrower.Reset(); // The API provides no way to expose the error.
@ -2137,7 +2137,7 @@ own<Instance> Instance::make(Store* store_abs, const Module* module_abs,
}
i::wasm::ErrorThrower thrower(isolate, "instantiation");
i::MaybeHandle<i::WasmInstanceObject> instance_obj =
isolate->wasm_engine()->SyncInstantiate(
i::wasm::GetWasmEngine()->SyncInstantiate(
isolate, &thrower, module->v8_object(), imports_obj,
i::MaybeHandle<i::JSArrayBuffer>());
if (trap) {

View File

@ -266,7 +266,7 @@ void WasmCompilationUnit::CompileWasmFunction(Isolate* isolate,
WasmCompilationUnit unit(function->func_index, tier, kNoDebugging);
CompilationEnv env = native_module->CreateCompilationEnv();
WasmCompilationResult result = unit.ExecuteCompilation(
isolate->wasm_engine(), &env,
GetWasmEngine(), &env,
native_module->compilation_state()->GetWireBytesStorage().get(),
isolate->counters(), detected);
if (result.succeeded()) {
@ -349,8 +349,8 @@ Handle<Code> JSToWasmWrapperCompilationUnit::CompileJSToWasmWrapper(
bool is_import) {
// Run the compilation unit synchronously.
WasmFeatures enabled_features = WasmFeatures::FromIsolate(isolate);
JSToWasmWrapperCompilationUnit unit(isolate, isolate->wasm_engine(), sig,
module, is_import, enabled_features,
JSToWasmWrapperCompilationUnit unit(isolate, GetWasmEngine(), sig, module,
is_import, enabled_features,
kAllowGeneric);
unit.Execute();
return unit.Finalize();
@ -362,8 +362,8 @@ Handle<Code> JSToWasmWrapperCompilationUnit::CompileSpecificJSToWasmWrapper(
// Run the compilation unit synchronously.
const bool is_import = false;
WasmFeatures enabled_features = WasmFeatures::FromIsolate(isolate);
JSToWasmWrapperCompilationUnit unit(isolate, isolate->wasm_engine(), sig,
module, is_import, enabled_features,
JSToWasmWrapperCompilationUnit unit(isolate, GetWasmEngine(), sig, module,
is_import, enabled_features,
kDontAllowGeneric);
unit.Execute();
return unit.Finalize();

View File

@ -1125,10 +1125,10 @@ bool CompileLazy(Isolate* isolate, Handle<WasmModuleObject> module_object,
WasmCompilationUnit baseline_unit{func_index, tiers.baseline_tier,
kNoDebugging};
CompilationEnv env = native_module->CreateCompilationEnv();
WasmEngine* engine = GetWasmEngine();
WasmFeatures detected_features;
WasmCompilationResult result = baseline_unit.ExecuteCompilation(
isolate->wasm_engine(), &env,
compilation_state->GetWireBytesStorage().get(), counters,
engine, &env, compilation_state->GetWireBytesStorage().get(), counters,
&detected_features);
compilation_state->OnCompilationStopped(detected_features);
@ -1141,9 +1141,9 @@ bool CompileLazy(Isolate* isolate, Handle<WasmModuleObject> module_object,
ErrorThrower thrower(isolate, nullptr);
base::Vector<const uint8_t> code =
compilation_state->GetWireBytesStorage()->GetCode(func->code);
DecodeResult decode_result = ValidateSingleFunction(
module, func_index, code, counters, isolate->wasm_engine()->allocator(),
enabled_features);
DecodeResult decode_result =
ValidateSingleFunction(module, func_index, code, counters,
engine->allocator(), enabled_features);
CHECK(decode_result.failed());
SetCompileError(&thrower, ModuleWireBytes(native_module->wire_bytes()),
func, module, decode_result.error());
@ -1456,8 +1456,8 @@ void InitializeCompilationUnits(Isolate* isolate, NativeModule* native_module) {
}
int num_import_wrappers = AddImportWrapperUnits(native_module, &builder);
int num_export_wrappers =
AddExportWrapperUnits(isolate, isolate->wasm_engine(), native_module,
&builder, WasmFeatures::FromIsolate(isolate));
AddExportWrapperUnits(isolate, GetWasmEngine(), native_module, &builder,
WasmFeatures::FromIsolate(isolate));
compilation_state->InitializeCompilationProgress(
lazy_module, num_import_wrappers, num_export_wrappers);
builder.Commit();
@ -1668,15 +1668,15 @@ std::shared_ptr<NativeModule> CompileToNativeModule(
std::shared_ptr<const WasmModule> module, const ModuleWireBytes& wire_bytes,
Handle<FixedArray>* export_wrappers_out, int compilation_id) {
const WasmModule* wasm_module = module.get();
WasmEngine* engine = GetWasmEngine();
base::OwnedVector<uint8_t> wire_bytes_copy =
base::OwnedVector<uint8_t>::Of(wire_bytes.module_bytes());
// Prefer {wire_bytes_copy} to {wire_bytes.module_bytes()} for the temporary
// cache key. When we eventually install the module in the cache, the wire
// bytes of the temporary key and the new key have the same base pointer and
// we can skip the full bytes comparison.
std::shared_ptr<NativeModule> native_module =
isolate->wasm_engine()->MaybeGetNativeModule(
wasm_module->origin, wire_bytes_copy.as_vector(), isolate);
std::shared_ptr<NativeModule> native_module = engine->MaybeGetNativeModule(
wasm_module->origin, wire_bytes_copy.as_vector(), isolate);
if (native_module) {
// TODO(thibaudm): Look into sharing export wrappers.
CompileJsToWasmWrappers(isolate, wasm_module, export_wrappers_out);
@ -1696,8 +1696,8 @@ std::shared_ptr<NativeModule> CompileToNativeModule(
size_t code_size_estimate =
wasm::WasmCodeManager::EstimateNativeModuleCodeSize(module.get(),
uses_liftoff);
native_module = isolate->wasm_engine()->NewNativeModule(
isolate, enabled, module, code_size_estimate);
native_module =
engine->NewNativeModule(isolate, enabled, module, code_size_estimate);
native_module->SetWireBytes(std::move(wire_bytes_copy));
native_module->compilation_state()->set_compilation_id(compilation_id);
// Sync compilation is user blocking, so we increase the priority.
@ -1707,8 +1707,8 @@ std::shared_ptr<NativeModule> CompileToNativeModule(
isolate->GetOrRegisterRecorderContextId(isolate->native_context());
CompileNativeModule(isolate, context_id, thrower, wasm_module, native_module,
export_wrappers_out);
bool cache_hit = !isolate->wasm_engine()->UpdateNativeModuleCache(
thrower->error(), &native_module, isolate);
bool cache_hit = !engine->UpdateNativeModuleCache(thrower->error(),
&native_module, isolate);
if (thrower->error()) return {};
if (cache_hit) {
@ -1717,7 +1717,7 @@ std::shared_ptr<NativeModule> CompileToNativeModule(
}
// Ensure that the code objects are logged before returning.
isolate->wasm_engine()->LogOutstandingCodesForIsolate(isolate);
engine->LogOutstandingCodesForIsolate(isolate);
return native_module;
}
@ -1784,7 +1784,7 @@ void AsyncCompileJob::Start() {
void AsyncCompileJob::Abort() {
// Removing this job will trigger the destructor, which will cancel all
// compilation.
isolate_->wasm_engine()->RemoveCompileJob(this);
GetWasmEngine()->RemoveCompileJob(this);
}
class AsyncStreamingProcessor final : public StreamingProcessor {
@ -1886,7 +1886,7 @@ void AsyncCompileJob::CreateNativeModule(
// Create the module object and populate with compiled functions and
// information needed at instantiation time.
native_module_ = isolate_->wasm_engine()->NewNativeModule(
native_module_ = GetWasmEngine()->NewNativeModule(
isolate_, enabled_features_, std::move(module), code_size_estimate);
native_module_->SetWireBytes({std::move(bytes_copy_), wire_bytes_.length()});
native_module_->compilation_state()->set_compilation_id(compilation_id_);
@ -1894,7 +1894,7 @@ void AsyncCompileJob::CreateNativeModule(
bool AsyncCompileJob::GetOrCreateNativeModule(
std::shared_ptr<const WasmModule> module, size_t code_size_estimate) {
native_module_ = isolate_->wasm_engine()->MaybeGetNativeModule(
native_module_ = GetWasmEngine()->MaybeGetNativeModule(
module->origin, wire_bytes_.module_bytes(), isolate_);
if (native_module_ == nullptr) {
CreateNativeModule(std::move(module), code_size_estimate);
@ -1908,8 +1908,8 @@ void AsyncCompileJob::PrepareRuntimeObjects() {
// module object. Asm.js is not compiled asynchronously.
DCHECK(module_object_.is_null());
auto source_url = stream_ ? stream_->url() : base::Vector<const char>();
auto script = isolate_->wasm_engine()->GetOrCreateScript(
isolate_, native_module_, source_url);
auto script =
GetWasmEngine()->GetOrCreateScript(isolate_, native_module_, source_url);
Handle<WasmModuleObject> module_object =
WasmModuleObject::New(isolate_, native_module_, script);
@ -2006,7 +2006,7 @@ void AsyncCompileJob::DecodeFailed(const WasmError& error) {
thrower.CompileFailed(error);
// {job} keeps the {this} pointer alive.
std::shared_ptr<AsyncCompileJob> job =
isolate_->wasm_engine()->RemoveCompileJob(this);
GetWasmEngine()->RemoveCompileJob(this);
resolver_->OnCompilationFailed(thrower.Reify());
}
@ -2020,7 +2020,7 @@ void AsyncCompileJob::AsyncCompileFailed() {
DCHECK(thrower.error());
// {job} keeps the {this} pointer alive.
std::shared_ptr<AsyncCompileJob> job =
isolate_->wasm_engine()->RemoveCompileJob(this);
GetWasmEngine()->RemoveCompileJob(this);
resolver_->OnCompilationFailed(thrower.Reify());
}
@ -2054,9 +2054,8 @@ class AsyncCompileJob::CompilationStateCallback {
// If we get a conflicting module, wait until we are back in the
// main thread to update {job_->native_module_} to avoid a data race.
std::shared_ptr<NativeModule> native_module = job_->native_module_;
bool cache_hit =
!job_->isolate_->wasm_engine()->UpdateNativeModuleCache(
false, &native_module, job_->isolate_);
bool cache_hit = !GetWasmEngine()->UpdateNativeModuleCache(
false, &native_module, job_->isolate_);
DCHECK_EQ(cache_hit, native_module != job_->native_module_);
job_->DoSync<CompileFinished>(cache_hit ? std::move(native_module)
: nullptr);
@ -2074,8 +2073,8 @@ class AsyncCompileJob::CompilationStateCallback {
// Don't update {job_->native_module_} to avoid data races with other
// compilation threads. Use a copy of the shared pointer instead.
std::shared_ptr<NativeModule> native_module = job_->native_module_;
job_->isolate_->wasm_engine()->UpdateNativeModuleCache(
true, &native_module, job_->isolate_);
GetWasmEngine()->UpdateNativeModuleCache(true, &native_module,
job_->isolate_);
job_->DoSync<CompileFailed>();
}
break;
@ -2242,7 +2241,7 @@ class AsyncCompileJob::DecodeModule : public AsyncCompileJob::CompileStep {
result = DecodeWasmModule(
enabled_features, job->wire_bytes_.start(), job->wire_bytes_.end(),
false, kWasmOrigin, counters_, metrics_recorder_, job->context_id(),
DecodingMethod::kAsync, job->isolate()->wasm_engine()->allocator());
DecodingMethod::kAsync, GetWasmEngine()->allocator());
// Validate lazy functions here if requested.
if (!FLAG_wasm_lazy_validation && result.ok()) {
@ -2250,7 +2249,7 @@ class AsyncCompileJob::DecodeModule : public AsyncCompileJob::CompileStep {
DCHECK_EQ(module->origin, kWasmOrigin);
const bool lazy_module = job->wasm_lazy_compilation_;
if (MayCompriseLazyFunctions(module, enabled_features, lazy_module)) {
auto allocator = job->isolate()->wasm_engine()->allocator();
auto allocator = GetWasmEngine()->allocator();
int start = module->num_imported_functions;
int end = start + module->num_declared_functions;
@ -2445,7 +2444,7 @@ class AsyncCompileJob::CompileFinished : public CompileStep {
void AsyncCompileJob::FinishModule() {
TRACE_COMPILE("(4) Finish module...\n");
AsyncCompileSucceeded(module_object_);
isolate_->wasm_engine()->RemoveCompileJob(this);
GetWasmEngine()->RemoveCompileJob(this);
}
AsyncStreamingProcessor::AsyncStreamingProcessor(
@ -2453,7 +2452,7 @@ AsyncStreamingProcessor::AsyncStreamingProcessor(
AccountingAllocator* allocator)
: decoder_(job->enabled_features_),
job_(job),
wasm_engine_(job_->isolate_->wasm_engine()),
wasm_engine_(GetWasmEngine()),
compilation_unit_builder_(nullptr),
async_counters_(async_counters),
allocator_(allocator) {}
@ -2461,7 +2460,7 @@ AsyncStreamingProcessor::AsyncStreamingProcessor(
AsyncStreamingProcessor::~AsyncStreamingProcessor() {
if (job_->native_module_ && job_->native_module_->wire_bytes().empty()) {
// Clean up the temporary cache entry.
job_->isolate_->wasm_engine()->StreamingCompilationFailed(prefix_hash_);
GetWasmEngine()->StreamingCompilationFailed(prefix_hash_);
}
}
@ -2504,9 +2503,9 @@ void AsyncStreamingProcessor::FinishAsyncCompileJobWithError(
bool AsyncStreamingProcessor::ProcessModuleHeader(
base::Vector<const uint8_t> bytes, uint32_t offset) {
TRACE_STREAMING("Process module header...\n");
decoder_.StartDecoding(
job_->isolate()->counters(), job_->isolate()->metrics_recorder(),
job_->context_id(), job_->isolate()->wasm_engine()->allocator());
decoder_.StartDecoding(job_->isolate()->counters(),
job_->isolate()->metrics_recorder(),
job_->context_id(), GetWasmEngine()->allocator());
decoder_.DecodeModuleHeader(bytes, offset);
if (!decoder_.ok()) {
FinishAsyncCompileJobWithError(decoder_.FinishDecoding(false).error());
@ -2748,7 +2747,7 @@ void AsyncStreamingProcessor::OnFinishedStream(
if (needs_finish) {
const bool failed = job_->native_module_->compilation_state()->failed();
if (!cache_hit) {
cache_hit = !job_->isolate_->wasm_engine()->UpdateNativeModuleCache(
cache_hit = !GetWasmEngine()->UpdateNativeModuleCache(
failed, &job_->native_module_, job_->isolate_);
}
if (failed) {
@ -3486,9 +3485,8 @@ void CompileJsToWasmWrappers(Isolate* isolate, const WasmModule* module,
JSToWasmWrapperKey key(function.imported, *function.sig);
if (queue.insert(key)) {
auto unit = std::make_unique<JSToWasmWrapperCompilationUnit>(
isolate, isolate->wasm_engine(), function.sig, module,
function.imported, enabled_features,
JSToWasmWrapperCompilationUnit::kAllowGeneric);
isolate, GetWasmEngine(), function.sig, module, function.imported,
enabled_features, JSToWasmWrapperCompilationUnit::kAllowGeneric);
compilation_units.emplace(key, std::move(unit));
}
}

View File

@ -16,6 +16,7 @@
#include "src/utils/utils.h"
#include "src/wasm/module-compiler.h"
#include "src/wasm/wasm-constants.h"
#include "src/wasm/wasm-engine.h"
#include "src/wasm/wasm-external-refs.h"
#include "src/wasm/wasm-import-wrapper-cache.h"
#include "src/wasm/wasm-module.h"
@ -997,7 +998,7 @@ bool InstanceBuilder::ProcessImportedFunction(
WasmCodeRefScope code_ref_scope;
WasmImportWrapperCache::ModificationScope cache_scope(cache);
wasm_code = compiler::CompileWasmCapiCallWrapper(
isolate_->wasm_engine(), native_module, expected_sig);
wasm::GetWasmEngine(), native_module, expected_sig);
WasmImportWrapperCache::CacheKey key(kind, expected_sig,
expected_arity);
cache_scope[key] = wasm_code;
@ -1437,7 +1438,7 @@ void InstanceBuilder::CompileImportWrappers(
}
auto compile_job_task = std::make_unique<CompileImportWrapperJob>(
isolate_->wasm_engine(), isolate_->counters(), native_module,
wasm::GetWasmEngine(), isolate_->counters(), native_module,
&import_wrapper_queue, &cache_scope);
auto compile_job = V8::GetCurrentPlatform()->PostJob(
TaskPriority::kUserVisible, std::move(compile_job_task));

View File

@ -62,8 +62,7 @@ class V8_EXPORT_PRIVATE SyncStreamingDecoder : public StreamingDecoder {
ModuleWireBytes wire_bytes(bytes.get(), bytes.get() + buffer_size_);
ErrorThrower thrower(isolate_, api_method_name_for_errors_);
MaybeHandle<WasmModuleObject> module_object =
isolate_->wasm_engine()->SyncCompile(isolate_, enabled_, &thrower,
wire_bytes);
GetWasmEngine()->SyncCompile(isolate_, enabled_, &thrower, wire_bytes);
if (thrower.error()) {
resolver_->OnCompilationFailed(thrower.Reify());
return;

View File

@ -1982,7 +1982,7 @@ size_t WasmCodeManager::EstimateNativeModuleMetaDataSize(
std::shared_ptr<NativeModule> WasmCodeManager::NewNativeModule(
WasmEngine* engine, Isolate* isolate, const WasmFeatures& enabled,
size_t code_size_estimate, std::shared_ptr<const WasmModule> module) {
DCHECK_EQ(this, isolate->wasm_engine()->code_manager());
DCHECK_EQ(this, GetWasmEngine()->code_manager());
if (total_committed_code_space_.load() >
critical_committed_code_space_.load()) {
(reinterpret_cast<v8::Isolate*>(isolate))

View File

@ -118,10 +118,9 @@ class WasmGCForegroundTask : public CancelableTask {
: CancelableTask(isolate->cancelable_task_manager()), isolate_(isolate) {}
void RunInternal() final {
WasmEngine* engine = isolate_->wasm_engine();
// The stack can contain live frames, for instance when this is invoked
// during a pause or a breakpoint.
engine->ReportLiveCodeFromStackForGC(isolate_);
GetWasmEngine()->ReportLiveCodeFromStackForGC(isolate_);
}
private:
@ -1004,7 +1003,7 @@ void WasmEngine::AddIsolate(Isolate* isolate) {
v8::GCCallbackFlags flags, void* data) {
Isolate* isolate = reinterpret_cast<Isolate*>(v8_isolate);
Counters* counters = isolate->counters();
WasmEngine* engine = isolate->wasm_engine();
WasmEngine* engine = GetWasmEngine();
base::MutexGuard lock(&engine->mutex_);
DCHECK_EQ(1, engine->isolates_.count(isolate));
for (auto* native_module : engine->isolates_[isolate]->native_modules) {
@ -1341,7 +1340,7 @@ void WasmEngine::ReportLiveCodeFromStackForGC(Isolate* isolate) {
kOSRTargetOffset);
if (osr_target) {
WasmCode* osr_code =
isolate->wasm_engine()->code_manager()->LookupCode(osr_target);
GetWasmEngine()->code_manager()->LookupCode(osr_target);
DCHECK_NOT_NULL(osr_code);
live_wasm_code.insert(osr_code);
}
@ -1599,8 +1598,7 @@ void WasmEngine::GlobalTearDown() {
global_wasm_engine = nullptr;
}
// static
WasmEngine* WasmEngine::GetWasmEngine() {
WasmEngine* GetWasmEngine() {
DCHECK_NOT_NULL(global_wasm_engine);
return global_wasm_engine;
}

View File

@ -358,9 +358,6 @@ class V8_EXPORT_PRIVATE WasmEngine {
static void InitializeOncePerProcess();
static void GlobalTearDown();
// Returns a reference to the WasmEngine shared by the entire process.
static WasmEngine* GetWasmEngine();
private:
struct CurrentGCInfo;
struct IsolateInfo;
@ -432,6 +429,9 @@ class V8_EXPORT_PRIVATE WasmEngine {
//////////////////////////////////////////////////////////////////////////////
};
// Returns a reference to the WasmEngine shared by the entire process.
V8_EXPORT_PRIVATE WasmEngine* GetWasmEngine();
} // namespace wasm
} // namespace internal
} // namespace v8

View File

@ -49,7 +49,7 @@ class WasmStreaming::WasmStreamingImpl {
: isolate_(isolate), resolver_(std::move(resolver)) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate_);
auto enabled_features = i::wasm::WasmFeatures::FromIsolate(i_isolate);
streaming_decoder_ = i_isolate->wasm_engine()->StartStreamingCompilation(
streaming_decoder_ = i::wasm::GetWasmEngine()->StartStreamingCompilation(
i_isolate, enabled_features, handle(i_isolate->context(), i_isolate),
api_method_name, resolver_);
}
@ -417,7 +417,7 @@ class AsyncInstantiateCompileResultResolver
void OnCompilationSucceeded(i::Handle<i::WasmModuleObject> result) override {
if (finished_) return;
finished_ = true;
isolate_->wasm_engine()->AsyncInstantiate(
i::wasm::GetWasmEngine()->AsyncInstantiate(
isolate_,
std::make_unique<InstantiateBytesResultResolver>(isolate_, promise_,
result),
@ -516,7 +516,7 @@ void WebAssemblyCompile(const v8::FunctionCallbackInfo<v8::Value>& args) {
}
// Asynchronous compilation handles copying wire bytes if necessary.
auto enabled_features = i::wasm::WasmFeatures::FromIsolate(i_isolate);
i_isolate->wasm_engine()->AsyncCompile(i_isolate, enabled_features,
i::wasm::GetWasmEngine()->AsyncCompile(i_isolate, enabled_features,
std::move(resolver), bytes, is_shared,
kAPIMethodName);
}
@ -638,11 +638,11 @@ void WebAssemblyValidate(const v8::FunctionCallbackInfo<v8::Value>& args) {
memcpy(copy.get(), bytes.start(), bytes.length());
i::wasm::ModuleWireBytes bytes_copy(copy.get(),
copy.get() + bytes.length());
validated = i_isolate->wasm_engine()->SyncValidate(
validated = i::wasm::GetWasmEngine()->SyncValidate(
i_isolate, enabled_features, bytes_copy);
} else {
// The wire bytes are not shared, OK to use them directly.
validated = i_isolate->wasm_engine()->SyncValidate(i_isolate,
validated = i::wasm::GetWasmEngine()->SyncValidate(i_isolate,
enabled_features, bytes);
}
@ -681,11 +681,11 @@ void WebAssemblyModule(const v8::FunctionCallbackInfo<v8::Value>& args) {
memcpy(copy.get(), bytes.start(), bytes.length());
i::wasm::ModuleWireBytes bytes_copy(copy.get(),
copy.get() + bytes.length());
module_obj = i_isolate->wasm_engine()->SyncCompile(
module_obj = i::wasm::GetWasmEngine()->SyncCompile(
i_isolate, enabled_features, &thrower, bytes_copy);
} else {
// The wire bytes are not shared, OK to use them directly.
module_obj = i_isolate->wasm_engine()->SyncCompile(
module_obj = i::wasm::GetWasmEngine()->SyncCompile(
i_isolate, enabled_features, &thrower, bytes);
}
@ -770,7 +770,7 @@ MaybeLocal<Value> WebAssemblyInstantiateImpl(Isolate* isolate,
GetValueAsImports(ffi, &thrower);
if (thrower.error()) return {};
instance_object = i_isolate->wasm_engine()->SyncInstantiate(
instance_object = i::wasm::GetWasmEngine()->SyncInstantiate(
i_isolate, &thrower, i::Handle<i::WasmModuleObject>::cast(module_obj),
maybe_imports, i::MaybeHandle<i::JSArrayBuffer>());
}
@ -941,7 +941,7 @@ void WebAssemblyInstantiate(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::Handle<i::WasmModuleObject> module_obj =
i::Handle<i::WasmModuleObject>::cast(first_arg);
i_isolate->wasm_engine()->AsyncInstantiate(i_isolate, std::move(resolver),
i::wasm::GetWasmEngine()->AsyncInstantiate(i_isolate, std::move(resolver),
module_obj, maybe_imports);
return;
}
@ -971,7 +971,7 @@ void WebAssemblyInstantiate(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Asynchronous compilation handles copying wire bytes if necessary.
auto enabled_features = i::wasm::WasmFeatures::FromIsolate(i_isolate);
i_isolate->wasm_engine()->AsyncCompile(i_isolate, enabled_features,
i::wasm::GetWasmEngine()->AsyncCompile(i_isolate, enabled_features,
std::move(compilation_resolver), bytes,
is_shared, kAPIMethodName);
}

View File

@ -624,7 +624,7 @@ void WasmTableObject::UpdateDispatchTables(
if (wasm_code == nullptr) {
wasm::WasmCodeRefScope code_ref_scope;
wasm::WasmImportWrapperCache::ModificationScope cache_scope(cache);
wasm_code = compiler::CompileWasmCapiCallWrapper(isolate->wasm_engine(),
wasm_code = compiler::CompileWasmCapiCallWrapper(wasm::GetWasmEngine(),
native_module, &sig);
wasm::WasmImportWrapperCache::CacheKey key(kind, &sig, param_count);
cache_scope[key] = wasm_code;
@ -1544,7 +1544,7 @@ void WasmInstanceObject::ImportWasmJSFunctionIntoTable(
.internal_formal_parameter_count();
}
wasm::WasmCompilationResult result = compiler::CompileWasmImportCallWrapper(
isolate->wasm_engine(), &env, kind, sig, false, expected_arity);
wasm::GetWasmEngine(), &env, kind, sig, false, expected_arity);
std::unique_ptr<wasm::WasmCode> wasm_code = native_module->AddCode(
result.func_index, result.code_desc, result.frame_slot_count,
result.tagged_parameter_slots,

View File

@ -833,7 +833,7 @@ MaybeHandle<WasmModuleObject> DeserializeNativeModule(
auto owned_wire_bytes = base::OwnedVector<uint8_t>::Of(wire_bytes_vec);
// TODO(titzer): module features should be part of the serialization format.
WasmEngine* wasm_engine = isolate->wasm_engine();
WasmEngine* wasm_engine = GetWasmEngine();
WasmFeatures enabled_features = WasmFeatures::FromIsolate(isolate);
ModuleResult decode_result = DecodeWasmModule(
enabled_features, owned_wire_bytes.start(), owned_wire_bytes.end(), false,

View File

@ -1447,7 +1447,7 @@ std::shared_ptr<wasm::NativeModule> AllocateNativeModule(Isolate* isolate,
// We have to add the code object to a NativeModule, because the
// WasmCallDescriptor assumes that code is on the native heap and not
// within a code object.
auto native_module = isolate->wasm_engine()->NewNativeModule(
auto native_module = wasm::GetWasmEngine()->NewNativeModule(
isolate, wasm::WasmFeatures::All(), std::move(module), code_size);
native_module->SetWireBytes({});
return native_module;

View File

@ -125,7 +125,7 @@ std::shared_ptr<wasm::NativeModule> AllocateNativeModule(Isolate* isolate,
// We have to add the code object to a NativeModule, because the
// WasmCallDescriptor assumes that code is on the native heap and not
// within a code object.
auto native_module = isolate->wasm_engine()->NewNativeModule(
auto native_module = wasm::GetWasmEngine()->NewNativeModule(
isolate, wasm::WasmFeatures::All(), std::move(module), code_size);
native_module->SetWireBytes({});
return native_module;

View File

@ -52,7 +52,7 @@ class StreamTester {
Handle<Context> context = i_isolate->native_context();
stream_ = i_isolate->wasm_engine()->StartStreamingCompilation(
stream_ = GetWasmEngine()->StartStreamingCompilation(
i_isolate, WasmFeatures::All(), context,
"WebAssembly.compileStreaming()", test_resolver_);
}
@ -92,8 +92,7 @@ std::shared_ptr<NativeModule> SyncCompile(base::Vector<const uint8_t> bytes) {
auto enabled_features = WasmFeatures::FromIsolate(CcTest::i_isolate());
auto wire_bytes = ModuleWireBytes(bytes.begin(), bytes.end());
Handle<WasmModuleObject> module =
CcTest::i_isolate()
->wasm_engine()
GetWasmEngine()
->SyncCompile(CcTest::i_isolate(), enabled_features, &thrower,
wire_bytes)
.ToHandleChecked();
@ -143,18 +142,18 @@ TEST(TestAsyncCache) {
auto resolverA2 = std::make_shared<TestResolver>(&pending);
auto resolverB = std::make_shared<TestResolver>(&pending);
CcTest::i_isolate()->wasm_engine()->AsyncCompile(
CcTest::i_isolate(), WasmFeatures::All(), resolverA1,
ModuleWireBytes(bufferA.begin(), bufferA.end()), true,
"WebAssembly.compile");
CcTest::i_isolate()->wasm_engine()->AsyncCompile(
CcTest::i_isolate(), WasmFeatures::All(), resolverA2,
ModuleWireBytes(bufferA.begin(), bufferA.end()), true,
"WebAssembly.compile");
CcTest::i_isolate()->wasm_engine()->AsyncCompile(
CcTest::i_isolate(), WasmFeatures::All(), resolverB,
ModuleWireBytes(bufferB.begin(), bufferB.end()), true,
"WebAssembly.compile");
GetWasmEngine()->AsyncCompile(CcTest::i_isolate(), WasmFeatures::All(),
resolverA1,
ModuleWireBytes(bufferA.begin(), bufferA.end()),
true, "WebAssembly.compile");
GetWasmEngine()->AsyncCompile(CcTest::i_isolate(), WasmFeatures::All(),
resolverA2,
ModuleWireBytes(bufferA.begin(), bufferA.end()),
true, "WebAssembly.compile");
GetWasmEngine()->AsyncCompile(CcTest::i_isolate(), WasmFeatures::All(),
resolverB,
ModuleWireBytes(bufferB.begin(), bufferB.end()),
true, "WebAssembly.compile");
while (pending > 0) {
v8::platform::PumpMessageLoop(i::V8::GetCurrentPlatform(),

View File

@ -134,9 +134,8 @@ TEST(Run_WasmModule_CompilationHintsLazy) {
CHECK(compilation_state->baseline_compilation_finished());
// Instantiate and invoke function.
MaybeHandle<WasmInstanceObject> instance =
isolate->wasm_engine()->SyncInstantiate(
isolate, &thrower, module.ToHandleChecked(), {}, {});
MaybeHandle<WasmInstanceObject> instance = GetWasmEngine()->SyncInstantiate(
isolate, &thrower, module.ToHandleChecked(), {}, {});
CHECK(!instance.is_null());
int32_t result = testing::CallWasmFunctionForTesting(
isolate, instance.ToHandleChecked(), "main", 0, nullptr);

View File

@ -189,7 +189,7 @@ class StreamTester {
Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
v8::Local<v8::Context> context = isolate->GetCurrentContext();
stream_ = i_isolate->wasm_engine()->StartStreamingCompilation(
stream_ = GetWasmEngine()->StartStreamingCompilation(
i_isolate, WasmFeatures::All(), v8::Utils::OpenHandle(*context),
"WebAssembly.compileStreaming()",
std::make_shared<TestResolver>(i_isolate, &state_, &error_message_,
@ -343,7 +343,7 @@ size_t GetFunctionOffset(i::Isolate* isolate, const uint8_t* buffer,
WasmFeatures::All(), buffer, buffer + size, false,
ModuleOrigin::kWasmOrigin, isolate->counters(),
isolate->metrics_recorder(), v8::metrics::Recorder::ContextId::Empty(),
DecodingMethod::kSyncStream, isolate->wasm_engine()->allocator());
DecodingMethod::kSyncStream, GetWasmEngine()->allocator());
CHECK(result.ok());
const WasmFunction* func = &result.value()->functions[index];
return func->code.offset();
@ -1360,7 +1360,7 @@ STREAM_TEST(TestProfilingMidStreaming) {
// Trigger code logging explicitly like the profiler would do.
CHECK(WasmCode::ShouldBeLogged(i_isolate));
i_isolate->wasm_engine()->LogOutstandingCodesForIsolate(i_isolate);
GetWasmEngine()->LogOutstandingCodesForIsolate(i_isolate);
CHECK(tester.IsPromisePending());
// Finalize stream, stop profiler and clean up.
@ -1387,7 +1387,7 @@ STREAM_TEST(TierDownWithError) {
builder.WriteTo(&buffer);
}
i_isolate->wasm_engine()->TierDownAllModulesPerIsolate(i_isolate);
GetWasmEngine()->TierDownAllModulesPerIsolate(i_isolate);
tester.OnBytesReceived(buffer.begin(), buffer.size());
tester.FinishStream();

View File

@ -21,7 +21,7 @@ namespace test_wasm_import_wrapper_cache {
std::shared_ptr<NativeModule> NewModule(Isolate* isolate) {
std::shared_ptr<WasmModule> module(new WasmModule);
constexpr size_t kCodeSizeEstimate = 16384;
auto native_module = isolate->wasm_engine()->NewNativeModule(
auto native_module = GetWasmEngine()->NewNativeModule(
isolate, WasmFeatures::All(), std::move(module), kCodeSizeEstimate);
native_module->SetWireBytes({});
return native_module;
@ -39,9 +39,9 @@ TEST(CacheHit) {
auto sig = sigs.i_i();
int expected_arity = static_cast<int>(sig->parameter_count());
WasmCode* c1 = CompileImportWrapper(isolate->wasm_engine(), module.get(),
isolate->counters(), kind, sig,
expected_arity, &cache_scope);
WasmCode* c1 =
CompileImportWrapper(GetWasmEngine(), module.get(), isolate->counters(),
kind, sig, expected_arity, &cache_scope);
CHECK_NOT_NULL(c1);
CHECK_EQ(WasmCode::Kind::kWasmToJsWrapper, c1->kind());
@ -66,9 +66,9 @@ TEST(CacheMissSig) {
auto sig2 = sigs.i_ii();
int expected_arity2 = static_cast<int>(sig2->parameter_count());
WasmCode* c1 = CompileImportWrapper(isolate->wasm_engine(), module.get(),
isolate->counters(), kind, sig1,
expected_arity1, &cache_scope);
WasmCode* c1 =
CompileImportWrapper(GetWasmEngine(), module.get(), isolate->counters(),
kind, sig1, expected_arity1, &cache_scope);
CHECK_NOT_NULL(c1);
CHECK_EQ(WasmCode::Kind::kWasmToJsWrapper, c1->kind());
@ -91,9 +91,9 @@ TEST(CacheMissKind) {
auto sig = sigs.i_i();
int expected_arity = static_cast<int>(sig->parameter_count());
WasmCode* c1 = CompileImportWrapper(isolate->wasm_engine(), module.get(),
isolate->counters(), kind1, sig,
expected_arity, &cache_scope);
WasmCode* c1 =
CompileImportWrapper(GetWasmEngine(), module.get(), isolate->counters(),
kind1, sig, expected_arity, &cache_scope);
CHECK_NOT_NULL(c1);
CHECK_EQ(WasmCode::Kind::kWasmToJsWrapper, c1->kind());
@ -117,9 +117,9 @@ TEST(CacheHitMissSig) {
auto sig2 = sigs.i_ii();
int expected_arity2 = static_cast<int>(sig2->parameter_count());
WasmCode* c1 = CompileImportWrapper(isolate->wasm_engine(), module.get(),
isolate->counters(), kind, sig1,
expected_arity1, &cache_scope);
WasmCode* c1 =
CompileImportWrapper(GetWasmEngine(), module.get(), isolate->counters(),
kind, sig1, expected_arity1, &cache_scope);
CHECK_NOT_NULL(c1);
CHECK_EQ(WasmCode::Kind::kWasmToJsWrapper, c1->kind());
@ -128,9 +128,8 @@ TEST(CacheHitMissSig) {
CHECK_NULL(c2);
c2 = CompileImportWrapper(isolate->wasm_engine(), module.get(),
isolate->counters(), kind, sig2, expected_arity2,
&cache_scope);
c2 = CompileImportWrapper(GetWasmEngine(), module.get(), isolate->counters(),
kind, sig2, expected_arity2, &cache_scope);
CHECK_NE(c1, c2);

View File

@ -183,7 +183,7 @@ class TestCompileResolver : public CompilationResultResolver {
void OnCompilationSucceeded(i::Handle<i::WasmModuleObject> module) override {
if (!module.is_null()) {
*native_module_ = module->shared_native_module();
isolate_->wasm_engine()->AsyncInstantiate(
GetWasmEngine()->AsyncInstantiate(
isolate_,
std::make_unique<TestInstantiateResolver>(isolate_, status_,
error_message_),
@ -289,7 +289,7 @@ COMPILE_TEST(TestEventMetrics) {
CompilationStatus status = CompilationStatus::kPending;
std::string error_message;
std::shared_ptr<NativeModule> native_module;
isolate->wasm_engine()->AsyncCompile(
GetWasmEngine()->AsyncCompile(
isolate, enabled_features,
std::make_shared<TestCompileResolver>(&status, &error_message, isolate,
&native_module),

View File

@ -82,8 +82,7 @@ class WasmSerializationTest {
0);
}
Handle<WasmInstanceObject> instance =
CcTest::i_isolate()
->wasm_engine()
GetWasmEngine()
->SyncInstantiate(CcTest::i_isolate(), &thrower, module_object,
Handle<JSReceiver>::null(),
MaybeHandle<JSArrayBuffer>())
@ -131,7 +130,7 @@ class WasmSerializationTest {
auto enabled_features = WasmFeatures::FromIsolate(serialization_isolate);
MaybeHandle<WasmModuleObject> maybe_module_object =
serialization_isolate->wasm_engine()->SyncCompile(
GetWasmEngine()->SyncCompile(
serialization_isolate, enabled_features, &thrower,
ModuleWireBytes(buffer.begin(), buffer.end()));
Handle<WasmModuleObject> module_object =
@ -277,7 +276,7 @@ UNINITIALIZED_TEST(CompiledWasmModulesTransfer) {
ErrorThrower thrower(from_i_isolate, "TestCompiledWasmModulesTransfer");
auto enabled_features = WasmFeatures::FromIsolate(from_i_isolate);
MaybeHandle<WasmModuleObject> maybe_module_object =
from_i_isolate->wasm_engine()->SyncCompile(
GetWasmEngine()->SyncCompile(
from_i_isolate, enabled_features, &thrower,
ModuleWireBytes(buffer.begin(), buffer.end()));
Handle<WasmModuleObject> module_object =
@ -325,7 +324,7 @@ TEST(TierDownAfterDeserialization) {
CHECK_NOT_NULL(turbofan_code);
CHECK_EQ(ExecutionTier::kTurbofan, turbofan_code->tier());
isolate->wasm_engine()->TierDownAllModulesPerIsolate(isolate);
GetWasmEngine()->TierDownAllModulesPerIsolate(isolate);
auto* liftoff_code = native_module->GetCode(0);
CHECK_EQ(ExecutionTier::kLiftoff, liftoff_code->tier());

View File

@ -59,12 +59,10 @@ class SharedEngineIsolate {
Handle<WasmInstanceObject> ImportInstance(SharedModule shared_module) {
Handle<WasmModuleObject> module_object =
isolate()->wasm_engine()->ImportNativeModule(isolate(), shared_module,
{});
GetWasmEngine()->ImportNativeModule(isolate(), shared_module, {});
ErrorThrower thrower(isolate(), "ImportInstance");
MaybeHandle<WasmInstanceObject> instance =
isolate()->wasm_engine()->SyncInstantiate(isolate(), &thrower,
module_object, {}, {});
MaybeHandle<WasmInstanceObject> instance = GetWasmEngine()->SyncInstantiate(
isolate(), &thrower, module_object, {}, {});
return instance.ToHandleChecked();
}
@ -135,7 +133,7 @@ class MockCompilationResolver : public CompilationResultResolver {
Handle<Object>* out_instance)
: isolate_(isolate), out_instance_(out_instance) {}
void OnCompilationSucceeded(Handle<WasmModuleObject> result) override {
isolate_->isolate()->wasm_engine()->AsyncInstantiate(
GetWasmEngine()->AsyncInstantiate(
isolate_->isolate(),
std::make_unique<MockInstantiationResolver>(out_instance_), result, {});
}
@ -161,7 +159,7 @@ Handle<WasmInstanceObject> CompileAndInstantiateAsync(
Handle<Object> maybe_instance = handle(Smi::zero(), isolate->isolate());
auto enabled_features = WasmFeatures::FromIsolate(isolate->isolate());
constexpr const char* kAPIMethodName = "Test.CompileAndInstantiateAsync";
isolate->isolate()->wasm_engine()->AsyncCompile(
GetWasmEngine()->AsyncCompile(
isolate->isolate(), enabled_features,
std::make_unique<MockCompilationResolver>(isolate, &maybe_instance),
ModuleWireBytes(buffer->begin(), buffer->end()), true, kAPIMethodName);

View File

@ -63,7 +63,7 @@ TestingModuleBuilder::TestingModuleBuilder(
auto import_wrapper = cache_scope[key];
if (import_wrapper == nullptr) {
import_wrapper = CompileImportWrapper(
isolate_->wasm_engine(), native_module_, isolate_->counters(), kind,
GetWasmEngine(), native_module_, isolate_->counters(), kind,
maybe_import->sig,
static_cast<int>(maybe_import->sig->parameter_count()), &cache_scope);
}
@ -338,13 +338,13 @@ Handle<WasmInstanceObject> TestingModuleBuilder::InitInstanceObject() {
size_t code_size_estimate =
wasm::WasmCodeManager::EstimateNativeModuleCodeSize(test_module_.get(),
kUsesLiftoff);
auto native_module = isolate_->wasm_engine()->NewNativeModule(
auto native_module = GetWasmEngine()->NewNativeModule(
isolate_, enabled_features_, test_module_, code_size_estimate);
native_module->SetWireBytes(base::OwnedVector<const uint8_t>());
native_module->compilation_state()->set_compilation_id(0);
constexpr base::Vector<const char> kNoSourceUrl{"", 0};
Handle<Script> script = isolate_->wasm_engine()->GetOrCreateScript(
isolate_, native_module, kNoSourceUrl);
Handle<Script> script =
GetWasmEngine()->GetOrCreateScript(isolate_, native_module, kNoSourceUrl);
Handle<WasmModuleObject> module_object =
WasmModuleObject::New(isolate_, std::move(native_module), script);
@ -559,14 +559,14 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
if (builder_->test_execution_tier() ==
TestExecutionTier::kLiftoffForFuzzing) {
result.emplace(ExecuteLiftoffCompilation(
isolate()->wasm_engine()->allocator(), &env, func_body,
function_->func_index, kForDebugging, isolate()->counters(),
&unused_detected_features, {}, nullptr, 0, builder_->max_steps_ptr()));
GetWasmEngine()->allocator(), &env, func_body, function_->func_index,
kForDebugging, isolate()->counters(), &unused_detected_features, {},
nullptr, 0, builder_->max_steps_ptr()));
} else {
WasmCompilationUnit unit(function_->func_index, builder_->execution_tier(),
for_debugging);
result.emplace(unit.ExecuteCompilation(
isolate()->wasm_engine(), &env,
GetWasmEngine(), &env,
native_module->compilation_state()->GetWireBytesStorage().get(),
isolate()->counters(), &unused_detected_features));
}

View File

@ -27,8 +27,8 @@ MaybeHandle<WasmModuleObject> CompileForTesting(Isolate* isolate,
ErrorThrower* thrower,
const ModuleWireBytes& bytes) {
auto enabled_features = WasmFeatures::FromIsolate(isolate);
MaybeHandle<WasmModuleObject> module = isolate->wasm_engine()->SyncCompile(
isolate, enabled_features, thrower, bytes);
MaybeHandle<WasmModuleObject> module =
GetWasmEngine()->SyncCompile(isolate, enabled_features, thrower, bytes);
DCHECK_EQ(thrower->error(), module.is_null());
return module;
}
@ -38,8 +38,8 @@ MaybeHandle<WasmInstanceObject> CompileAndInstantiateForTesting(
MaybeHandle<WasmModuleObject> module =
CompileForTesting(isolate, thrower, bytes);
if (module.is_null()) return {};
return isolate->wasm_engine()->SyncInstantiate(
isolate, thrower, module.ToHandleChecked(), {}, {});
return GetWasmEngine()->SyncInstantiate(isolate, thrower,
module.ToHandleChecked(), {}, {});
}
base::OwnedVector<WasmValue> MakeDefaultInterpreterArguments(

View File

@ -142,7 +142,7 @@ std::shared_ptr<wasm::NativeModule> AllocateNativeModule(i::Isolate* isolate,
// We have to add the code object to a NativeModule, because the
// WasmCallDescriptor assumes that code is on the native heap and not
// within a code object.
auto native_module = isolate->wasm_engine()->NewNativeModule(
auto native_module = wasm::GetWasmEngine()->NewNativeModule(
isolate, i::wasm::WasmFeatures::All(), std::move(module), code_size);
native_module->SetWireBytes({});
return native_module;

View File

@ -76,7 +76,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
bool done = false;
auto enabled_features = i::wasm::WasmFeatures::FromIsolate(i_isolate);
constexpr const char* kAPIMethodName = "WasmAsyncFuzzer.compile";
i_isolate->wasm_engine()->AsyncCompile(
GetWasmEngine()->AsyncCompile(
i_isolate, enabled_features,
std::make_shared<AsyncFuzzerResolver>(i_isolate, &done),
ModuleWireBytes(data, data + size), false, kAPIMethodName);

View File

@ -38,7 +38,7 @@ void InterpretAndExecuteModule(i::Isolate* isolate,
// Try to instantiate, return if it fails.
{
ErrorThrower thrower(isolate, "WebAssembly Instantiation");
if (!isolate->wasm_engine()
if (!GetWasmEngine()
->SyncInstantiate(isolate, &thrower, module_object, {},
{}) // no imports & memory
.ToHandle(&instance)) {
@ -77,7 +77,7 @@ void InterpretAndExecuteModule(i::Isolate* isolate,
{
ErrorThrower thrower(isolate, "Second Instantiation");
// We instantiated before, so the second instantiation must also succeed:
CHECK(isolate->wasm_engine()
CHECK(GetWasmEngine()
->SyncInstantiate(isolate, &thrower, module_object, {},
{}) // no imports & memory
.ToHandle(&instance));
@ -204,7 +204,7 @@ void GenerateTestCase(Isolate* isolate, ModuleWireBytes wire_bytes,
enabled_features, wire_bytes.start(), wire_bytes.end(), kVerifyFunctions,
ModuleOrigin::kWasmOrigin, isolate->counters(),
isolate->metrics_recorder(), v8::metrics::Recorder::ContextId::Empty(),
DecodingMethod::kSync, isolate->wasm_engine()->allocator());
DecodingMethod::kSync, GetWasmEngine()->allocator());
CHECK(module_res.ok());
WasmModule* module = module_res.value().get();
CHECK_NOT_NULL(module);
@ -422,7 +422,7 @@ void WasmExecutionFuzzer::FuzzWasmModule(base::Vector<const uint8_t> data,
FlagScope<int> tier_mask_scope(&FLAG_wasm_tier_mask_for_testing, tier_mask);
FlagScope<int> debug_mask_scope(&FLAG_wasm_debug_mask_for_testing,
debug_mask);
compiled_module = i_isolate->wasm_engine()->SyncCompile(
compiled_module = GetWasmEngine()->SyncCompile(
i_isolate, enabled_features, &interpreter_thrower, wire_bytes);
}
bool compiles = !compiled_module.is_null();
@ -431,8 +431,8 @@ void WasmExecutionFuzzer::FuzzWasmModule(base::Vector<const uint8_t> data,
GenerateTestCase(i_isolate, wire_bytes, compiles);
}
bool validates = i_isolate->wasm_engine()->SyncValidate(
i_isolate, enabled_features, wire_bytes);
bool validates =
GetWasmEngine()->SyncValidate(i_isolate, enabled_features, wire_bytes);
CHECK_EQ(compiles, validates);
CHECK_IMPLIES(require_valid, validates);

View File

@ -54,7 +54,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
i::Handle<i::WasmModuleObject> module_object;
auto enabled_features = i::wasm::WasmFeatures::FromIsolate(i_isolate);
bool compiles =
i_isolate->wasm_engine()
i::wasm::GetWasmEngine()
->SyncCompile(i_isolate, enabled_features, &thrower, wire_bytes)
.ToHandle(&module_object);

View File

@ -2601,7 +2601,7 @@ class ValueSerializerTestWithWasm : public ValueSerializerTest {
i::wasm::ErrorThrower thrower(i_isolate(), "MakeWasm");
auto enabled_features = i::wasm::WasmFeatures::FromIsolate(i_isolate());
i::MaybeHandle<i::JSObject> compiled =
i_isolate()->wasm_engine()->SyncCompile(
i::wasm::GetWasmEngine()->SyncCompile(
i_isolate(), enabled_features, &thrower,
i::wasm::ModuleWireBytes(base::ArrayVector(kIncrementerWasm)));
CHECK(!thrower.error());

View File

@ -36,7 +36,7 @@ class Memory64DecodingTest : public TestWithIsolateAndZone {
module_bytes.data() + module_bytes.size(), false, kWasmOrigin,
isolate()->counters(), isolate()->metrics_recorder(),
v8::metrics::Recorder::ContextId::Empty(), DecodingMethod::kSync,
isolate()->wasm_engine()->allocator());
wasm::GetWasmEngine()->allocator());
}
};

View File

@ -207,7 +207,7 @@ class WasmModuleVerifyTest : public TestWithIsolateAndZone {
enabled_features_, temp, temp + total, false, kWasmOrigin,
isolate()->counters(), isolate()->metrics_recorder(),
v8::metrics::Recorder::ContextId::Empty(), DecodingMethod::kSync,
isolate()->wasm_engine()->allocator());
GetWasmEngine()->allocator());
delete[] temp;
return result;
}
@ -217,7 +217,7 @@ class WasmModuleVerifyTest : public TestWithIsolateAndZone {
enabled_features_, module_start, module_end, false, kWasmOrigin,
isolate()->counters(), isolate()->metrics_recorder(),
v8::metrics::Recorder::ContextId::Empty(), DecodingMethod::kSync,
isolate()->wasm_engine()->allocator());
GetWasmEngine()->allocator());
}
};

View File

@ -73,7 +73,7 @@ TEST_F(WasmCapiTest, Traps) {
WasmFeatures::All(), wire_bytes()->begin(), wire_bytes()->end(), false,
ModuleOrigin::kWasmOrigin, isolate->counters(),
isolate->metrics_recorder(), v8::metrics::Recorder::ContextId::Empty(),
DecodingMethod::kSync, isolate->wasm_engine()->allocator());
DecodingMethod::kSync, GetWasmEngine()->allocator());
ASSERT_TRUE(result.ok());
const WasmFunction* func1 = &result.value()->functions[1];
const WasmFunction* func2 = &result.value()->functions[2];