Commit 3f9119d5 authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm] Remove lazy compilation support from the interpreter

Since the interpreter is not used in production any more, it does not
need to support lazy compilation. Since the code is still (accidentally)
triggered by indirect calls, we need to refactor that code. It only
allows calls within the same instance anyway.

R=ahaas@chromium.org

Bug: v8:10389
Change-Id: Ied1c8effd4c9fbb857a068db587de3463867ac80
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2259942Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68512}
parent f4f8f247
......@@ -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();
......
......@@ -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> 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment