Debian Codegraph @

js/src/jit-test/tests/wasm/exceptions/caching.js

raw
1 // |jit-test| skip-if: !wasmCachingEnabled()
2
3 load(libdir + "wasm-caching.js");
4
5 // Test that the tag section is cached correctly
6 testCached(`(module
7 (tag $t (export "t"))
8 (func (export "r")
9 throw $t
10 )
11 )`, {}, i => {
12 assertErrorMessage(() => i.exports.r(), WebAssembly.Exception, /.*/);
13 });
14
15 // Test that try notes are cached correctly
16 testCached(`(module
17 (tag $t)
18 (func (export "r") (result i32)
19 try (result i32)
20 throw $t
21 i32.const 0
22 catch $t
23 i32.const 1
24 end
25 )
26 )`, {}, i => {
27 assertEq(i.exports.r(), 1, "caught");
28 });