Commit 837556be authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Improve test coverage of s128 exception handling.

This adds test coverage for the encoding and decoding of s128 values as
part of an exception package. The encoding within an exception package
is not specified (and not observable), but the full bit-pattern needs to
survive an encoding/decoding round trip.

R=clemensb@chromium.org
TEST=mjsunit/wasm/exceptions-simd
BUG=v8:8091

Change-Id: I4cf6c1f00c64757512f66d068640a7e772eb0127
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1905769
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64932}
parent b6ef2517
......@@ -38,13 +38,44 @@ load("test/mjsunit/wasm/exceptions-utils.js");
kExprBrOnExn, 0, except,
kExprRethrow,
kExprEnd,
// TODO(mstarzinger): Actually return some compressed form of the s128
// value here to make sure it is extracted properly from the exception.
kExprDrop,
kExprI32Const, 1,
kExprLocalGet, 0,
kSimdPrefix, kExprI32x4Eq,
kSimdPrefix, kExprS1x4AllTrue,
])
.exportFunc();
var instance = builder.instantiate();
assertEquals(1, instance.exports.throw_catch_simd());
})();
(function TestThrowCatchS128WithValue() {
var builder = new WasmModuleBuilder();
var kSig_v_s = makeSig([kWasmS128], []);
var except = builder.addException(kSig_v_s);
const in_idx = 0x10; // Input index in memory.
const out_idx = 0x20; // Output index in memory.
builder.addImportedMemory("env", "memory");
builder.addFunction("throw_catch_simd", kSig_v_v)
.addBody([
kExprI32Const, out_idx,
kExprTry, kWasmS128,
kExprI32Const, in_idx,
kSimdPrefix, kExprS128LoadMem, 0, 0,
kExprThrow, 0,
kExprCatch,
kExprBrOnExn, 0, except,
kExprRethrow,
kExprEnd,
kSimdPrefix, kExprS128StoreMem, 0, 0,
])
.exportFunc();
var memory = new WebAssembly.Memory({initial: 1});
var instance = builder.instantiate({env: {memory:memory}});
var ref = [0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0];
var array = new Uint8Array(memory.buffer);
array.set(ref, in_idx); // Store reference value in memory.
instance.exports.throw_catch_simd();
assertArrayEquals(ref, array.slice(out_idx, out_idx + 0x10));
})();
......@@ -468,6 +468,8 @@ let kExprI64AtomicCompareExchange32U = 0x4e;
let kExprS128LoadMem = 0x00;
let kExprS128StoreMem = 0x01;
let kExprI32x4Splat = 0x0c;
let kExprI32x4Eq = 0x2c;
let kExprS1x4AllTrue = 0x75;
let kExprF32x4Min = 0x9e;
// Compilation hint constants.
......
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