summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/wasm/js-direct-call-wasm.js
blob: d70e2fbbb624e01b2f22454ddc96ae3282001efe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// |jit-test| --fast-warmup; --ion-offthread-compile=off

// Test that JS frames can trace wasm anyref values when they are used for
// direct calls.
{
	let {wasmFunc} = wasmEvalText(`(module
		(func (import "" "gc"))
		(func (export "wasmFunc") (param externref)
			call 0
		)
	)`, {"": {gc}}).exports;

	function jsFunc(i) {
		// Call the function twice so that the conversion to externref will be
		// GVN'ed and spilled across one of the calls
		wasmFunc(i);
		wasmFunc(i);
	}

	for (let i = 0; i < 100; i++) {
		jsFunc(i);
	}
}