Commit a72a4db7 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by V8 LUCI CQ

[wasm] Allow any return count for JSPI export

R=clemensb@chromium.org

Bug: v8:12191, v8:13231
Change-Id: I0104f54ce5cdc022f22800d4aeec68aac481219d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3856573Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/main@{#82769}
parent 51acc286
......@@ -1920,14 +1920,14 @@ bool IsSuspendingSignature(const i::wasm::FunctionSig* inner_sig,
return true;
}
// Given {inner_sig}: externref ti* -> to
// {outer_sig} must be: ti* -> externref
// Given {inner_sig}: externref [ti*] -> [to*]
// {outer_sig} must be: [ti*] -> [externref]
bool IsPromisingSignature(const i::wasm::FunctionSig* inner_sig,
const i::wasm::FunctionSig* outer_sig) {
if (inner_sig->parameter_count() != outer_sig->parameter_count() + 1) {
return false;
}
if (inner_sig->return_count() != 1 || outer_sig->return_count() != 1) {
if (outer_sig->return_count() != 1) {
return false;
}
if (inner_sig->GetParam(0) != i::wasm::kWasmExternRef) return false;
......
......@@ -19,7 +19,6 @@ function ToPromising(wasm_export) {
let sig = WebAssembly.Function.type(wasm_export);
assertTrue(sig.parameters.length > 0);
assertEquals('externref', sig.parameters[0]);
assertEquals(1, sig.results.length);
let wrapper_sig = {
parameters: sig.parameters.slice(1),
results: ['externref']
......@@ -466,3 +465,16 @@ function TestNestedSuspenders(suspend) {
print(arguments.callee.name);
TestNestedSuspenders(false);
})();
(function Regress13231() {
print(arguments.callee.name);
// Check that a promising function with no return is allowed.
let builder = new WasmModuleBuilder();
let sig_v_r = makeSig([kWasmExternRef], []);
builder.addFunction("export", sig_v_r).addBody([]).exportFunc();
let instance = builder.instantiate();
let export_wrapper = ToPromising(instance.exports.export);
let export_sig = WebAssembly.Function.type(export_wrapper);
assertEquals([], export_sig.parameters);
assertEquals(['externref'], export_sig.results);
})();
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