wasm-exception-rethrow.js 646 Bytes
Newer Older
1 2 3 4 5 6
// 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

7
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
8 9

let builder = new WasmModuleBuilder();
10
let except = builder.addTag(kSig_v_i);
11 12
builder.addFunction("rethrow0", kSig_v_v)
    .addBody([
13
      kExprTry, kWasmVoid,
14 15
        kExprI32Const, 23,
        kExprThrow, except,
16 17
      kExprCatch, except,
        kExprRethrow, 0,
18 19 20 21
      kExprEnd,
]).exportFunc();
let instance = builder.instantiate();
instance.exports.rethrow0();