v8/test/mjsunit/regress/regress-9832.js
Thibaud Michaud a12e9329fd [wasm][eh] Fix catch_all encoding
In the latest spec, catch_all is encoded as 0x05. This is the same
opcode as "else", but they do not conflict because "else" is not valid
in the context of a try block.

The 0x0a opcode now corresponds to the "unwind" instruction, which
currently has the same semantics as "catch_all".

R=clemensb@chromium.org

Bug: v8:11392
Change-Id: Ie9cd06c9a2001a02d8bea5be7a3c016e3a58ee3d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2674007
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72531}
2021-02-04 14:36:24 +00:00

34 lines
975 B
JavaScript

// Copyright 2019 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: --experimental-wasm-eh
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestRegress9832() {
let builder = new WasmModuleBuilder();
let f = builder.addFunction("f", kSig_i_i)
.addBody([
kExprLocalGet, 0,
kExprLocalGet, 0,
kExprI32Add,
]).exportFunc();
builder.addFunction("main", kSig_i_i)
.addBody([
kExprTry, kWasmStmt,
kExprLocalGet, 0,
kExprCallFunction, f.index,
kExprCallFunction, f.index,
kExprLocalSet, 0,
kExprElse,
kExprLocalGet, 0,
kExprCallFunction, f.index,
kExprLocalSet, 0,
kExprEnd,
kExprLocalGet, 0,
]).exportFunc();
let instance = builder.instantiate();
assertEquals(92, instance.exports.main(23));
})();