0c0d4c3934
This is a reland of 9c2c8f15f8
Original change's description:
> [wasm] Support encoding s128 simd types in exceptions.
>
> This adds support for having simd type values (i.e. s128) stored in an
> exception. It is the natural combination of the simd propsal and the
> exception handling proposal.
>
> R=clemensh@chromium.org
> TEST=mjsunit/wasm/exceptions-simd
> BUG=v8:8390
>
> Change-Id: I01079f82a6ba4d9152de4dae63e3db1584ca7cd8
> Reviewed-on: https://chromium-review.googlesource.com/c/1363141
> Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
> Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#58098}
Bug: v8:8390
Change-Id: I333c50cd766055f74b023df626d0fd90fdef3bac
Reviewed-on: https://chromium-review.googlesource.com/c/1370024
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58122}
50 lines
1.6 KiB
JavaScript
50 lines
1.6 KiB
JavaScript
// Copyright 2018 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
// Flags: --expose-wasm --experimental-wasm-eh --experimental-wasm-simd --allow-natives-syntax
|
|
|
|
load("test/mjsunit/wasm/wasm-constants.js");
|
|
load("test/mjsunit/wasm/wasm-module-builder.js");
|
|
load("test/mjsunit/wasm/exceptions-utils.js");
|
|
|
|
(function TestThrowS128Default() {
|
|
var builder = new WasmModuleBuilder();
|
|
var kSig_v_s = makeSig([kWasmS128], []);
|
|
var except = builder.addException(kSig_v_s);
|
|
builder.addFunction("throw_simd", kSig_v_v)
|
|
.addLocals({s128_count: 1})
|
|
.addBody([
|
|
kExprGetLocal, 0,
|
|
kExprThrow, 0,
|
|
])
|
|
.exportFunc();
|
|
var instance = builder.instantiate();
|
|
|
|
assertWasmThrows(instance, except, [0, 0, 0, 0, 0, 0, 0, 0],
|
|
() => instance.exports.throw_simd());
|
|
})();
|
|
|
|
(function TestThrowCatchS128Default() {
|
|
var builder = new WasmModuleBuilder();
|
|
var kSig_v_s = makeSig([kWasmS128], []);
|
|
var except = builder.addException(kSig_v_s);
|
|
builder.addFunction("throw_catch_simd", kSig_i_v)
|
|
.addLocals({s128_count: 1})
|
|
.addBody([
|
|
kExprTry, kWasmI32,
|
|
kExprGetLocal, 0,
|
|
kExprThrow, 0,
|
|
kExprCatch, except,
|
|
// 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,
|
|
kExprEnd,
|
|
])
|
|
.exportFunc();
|
|
var instance = builder.instantiate();
|
|
|
|
assertEquals(1, instance.exports.throw_catch_simd());
|
|
})();
|