Commit 4c5cf2e9 authored by Thibaud Michaud's avatar Thibaud Michaud Committed by Commit Bot

[wasm][liftoff] Allow refs in store helper

R=ahaas@chromium.org

Bug: v8:1189651
Change-Id: Ic414954101f99ac9d51af505f094cb03f0e85d29
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2773810Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73613}
parent 03227d05
......@@ -98,6 +98,10 @@ inline void Store(LiftoffAssembler* assm, Register base, int32_t offset,
Operand dst(base, offset);
switch (kind) {
case kI32:
case kOptRef:
case kRef:
case kRtt:
case kRttWithDepth:
assm->mov(dst, src.gp());
break;
case kI64:
......
......@@ -119,6 +119,12 @@ inline void Store(LiftoffAssembler* assm, Operand dst, LiftoffRegister src,
case kI64:
assm->movq(dst, src.gp());
break;
case kOptRef:
case kRef:
case kRtt:
case kRttWithDepth:
assm->StoreTaggedField(dst, src.gp());
break;
case kF32:
assm->Movss(dst, src.fp());
break;
......
......@@ -333,3 +333,28 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
instance.exports.main({hello: 4}, 5, {world: 6}, null, {bar: 7});
})();
(function MultiReturnRefTest() {
print("MultiReturnTest");
let builder = new WasmModuleBuilder();
let sig = makeSig([kWasmExternRef],
[kWasmExternRef, kWasmExternRef, kWasmExternRef, kWasmExternRef]);
builder.addFunction("callee", sig)
.addBody([
kExprLocalGet, 0,
kExprLocalGet, 0,
kExprLocalGet, 0,
kExprLocalGet, 0,
]);
builder.addFunction("main", sig)
.addBody([
kExprLocalGet, 0,
kExprCallFunction, 0
])
.exportAs("main");
let module = new WebAssembly.Module(builder.toBuffer());
let instance = new WebAssembly.Instance(module);
assertEquals(instance.exports.main(null), [null, null, null, null]);
})();
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