v8/test/message/fail/wasm-exception-rethrow.js
Thibaud Michaud e33c13c2a2 [wasm][eh] Revert to catch with tag immediate
First step towards the new exception handling proposal:
https://github.com/WebAssembly/exception-handling/issues/125

This is essentially a revert of:
"[wasm] Switch to new 'catch' and 'br_on_exn' proposal."

The changes are:
- "catch" instruction takes a tag immediate,
- "rethrow" instruction takes a label immediate,
- Add "catch_all" instruction,
- Remove "br_on_exn" instruction,
- Do not push exceptions on the stack, only the encoded values

R=clemensb@chromium.org
CC=​aheejin@chromium.org

Bug: v8:8091
Change-Id: Iea4d8d5a5d3ad50693f645e93c13e8de117aa884
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2484514
Commit-Queue: Thibaud Michaud <thibaudm@chromium.org>
Reviewed-by: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71602}
2020-12-03 18:55:31 +00:00

22 lines
641 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: --expose-wasm --experimental-wasm-eh
load('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
let except = builder.addException(kSig_v_i);
builder.addFunction("rethrow0", kSig_v_v)
.addBody([
kExprTry, kWasmStmt,
kExprI32Const, 23,
kExprThrow, except,
kExprCatch, except,
kExprRethrow, 0,
kExprEnd,
]).exportFunc();
let instance = builder.instantiate();
instance.exports.rethrow0();