Commit d73c32b9 authored by Victor Gomes's avatar Victor Gomes Committed by Commit Bot

[wasm] Fix expected arity in ImportWasmJSFunctionIntoTable

Change-Id: If9ab58bf671567f7a035a03b3e4e772ba302b522
Bug: v8:10201
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2467843
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70487}
parent 4c39f1de
......@@ -1508,10 +1508,18 @@ void WasmInstanceObject::ImportWasmJSFunctionIntoTable(
callable = resolved.second; // Update to ultimate target.
DCHECK_NE(compiler::WasmImportCallKind::kLinkError, kind);
wasm::CompilationEnv env = native_module->CreateCompilationEnv();
SharedFunctionInfo shared = js_function->shared();
// {expected_arity} should only be used if kind != kJSFunctionArityMismatch
// or kind != kJSFunctionArityMismatchSkipAdaptor.
int expected_arity = -1;
if (kind == compiler::WasmImportCallKind ::kJSFunctionArityMismatch ||
kind == compiler::WasmImportCallKind ::
kJSFunctionArityMismatchSkipAdaptor) {
expected_arity = Handle<JSFunction>::cast(callable)
->shared()
.internal_formal_parameter_count();
}
wasm::WasmCompilationResult result = compiler::CompileWasmImportCallWrapper(
isolate->wasm_engine(), &env, kind, sig, false,
shared.internal_formal_parameter_count());
isolate->wasm_engine(), &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,
......
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