Debian Codegraph @

js/src/jit-test/tests/wasm/regress/bug1839065.js

raw
1 function wasmEvalText(str, imports) {
2 let binary = wasmTextToBinary(str);
3 m = new WebAssembly.Module(binary);
4 return new WebAssembly.Instance(m, imports);
5 }
6 let { newElem, f1, f2, f3, f4 } = wasmEvalText(`
7 (type $a (array funcref))
8 (elem $e func $f1 $f2 $f3 $f4)
9 (func $f1 )
10 (func $f2 )
11 (func $f3 )
12 (func $f4 )
13 (func (export "newElem") (result eqref)
14 i32.const 0
15 i32.const 4
16 array.new_elem $a $e
17 )`).exports;
18
19 let s = "no exception";
20 try {
21 wasmGcReadField(newElem(), -1.5);
22 } catch (e) {
23 s = "" + e;
24 }
25
26 assertEq(s, "Error: Second argument must be a non-negative integer. " +
27 "Usage: wasmGcReadField(obj, index)");