summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/exceptions/caching.js
blob: 5427de5102b00d1b81ebbfae356bc3399db49ab4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// |jit-test| skip-if: !wasmCachingEnabled()

load(libdir + "wasm-caching.js");

// Test that the tag section is cached correctly
testCached(`(module
	(tag $t (export "t"))
	(func (export "r")
		throw $t
	)
)`, {}, i => {
	assertErrorMessage(() => i.exports.r(), WebAssembly.Exception, /.*/);
});

// Test that try notes are cached correctly
testCached(`(module
	(tag $t)
	(func (export "r") (result i32)
		try (result i32)
			throw $t
			i32.const 0
		catch $t
			i32.const 1
		end
	)
)`, {}, i => {
	assertEq(i.exports.r(), 1, "caught");
});