diff --git a/src/wasm/module-compiler.h b/src/wasm/module-compiler.h index 845e7a343b..a3fc4037a2 100644 --- a/src/wasm/module-compiler.h +++ b/src/wasm/module-compiler.h @@ -63,8 +63,7 @@ WasmCode* CompileImportWrapper( // Triggered by the WasmCompileLazy builtin. The return value indicates whether // compilation was successful. Lazy compilation can fail only if validation is // also lazy. -// TODO(clemensb): Stop calling this from the interpreter, and don't export. -V8_EXPORT_PRIVATE bool CompileLazy(Isolate*, NativeModule*, int func_index); +bool CompileLazy(Isolate*, NativeModule*, int func_index); int GetMaxBackgroundTasks(); diff --git a/test/common/wasm/wasm-interpreter.cc b/test/common/wasm/wasm-interpreter.cc index cd951caa57..2ff6a76ee5 100644 --- a/test/common/wasm/wasm-interpreter.cc +++ b/test/common/wasm/wasm-interpreter.cc @@ -3735,28 +3735,6 @@ class WasmInterpreterInternals { #endif // DEBUG } - static WasmCode* GetTargetCode(Isolate* isolate, Address target) { - WasmCodeManager* code_manager = isolate->wasm_engine()->code_manager(); - NativeModule* native_module = code_manager->LookupNativeModule(target); - WasmCode* code = native_module->Lookup(target); - if (code->kind() == WasmCode::kJumpTable) { - uint32_t func_index = - native_module->GetFunctionIndexFromJumpTableSlot(target); - - if (!native_module->HasCode(func_index)) { - bool success = CompileLazy(isolate, native_module, func_index); - if (!success) { - DCHECK(isolate->has_pending_exception()); - return nullptr; - } - } - - return native_module->GetCode(func_index); - } - DCHECK_EQ(code->instruction_start(), target); - return code; - } - CallResult CallIndirectFunction(uint32_t table_index, uint32_t entry_index, uint32_t sig_index) { HandleScope handle_scope(isolate_); // Avoid leaking handles. @@ -3778,15 +3756,20 @@ class WasmInterpreterInternals { } Handle object_ref = handle(entry.object_ref(), isolate_); - WasmCode* code = GetTargetCode(isolate_, entry.target()); - CHECK_NOT_NULL(code); - // Check that this is an internal call (within the same instance). CHECK(object_ref->IsWasmInstanceObject() && instance_object_.is_identical_to(object_ref)); - DCHECK_EQ(WasmCode::kFunction, code->kind()); - return {CallResult::INTERNAL, codemap_.GetCode(code->index())}; + NativeModule* native_module = + instance_object_->module_object().native_module(); + DCHECK_EQ(native_module, + native_module->Lookup(entry.target())->native_module()); + DCHECK_EQ(WasmCode::kJumpTable, + native_module->Lookup(entry.target())->kind()); + uint32_t func_index = + native_module->GetFunctionIndexFromJumpTableSlot(entry.target()); + + return {CallResult::INTERNAL, codemap_.GetCode(func_index)}; } // Create a copy of the module bytes for the interpreter, since the passed