MCPcopy Index your code
hub / github.com/nodejs/node / test

Function test

deps/v8/test/mjsunit/wasm/externref-table.js:89–105  ·  view source on GitHub ↗
(is_nullable)

Source from the content-addressed store, hash-verified

87 print(arguments.callee.name);
88
89 let test = function(is_nullable) {
90 const builder = new WasmModuleBuilder();
91 const sig = builder.addType(kSig_i_i);
92 const func = builder.addFunction("func", kSig_i_i)
93 .addBody([kExprLocalGet, 0]);
94 builder.addTable(is_nullable ? wasmRefNullType(sig) : wasmRefType(sig),
95 10, 10, [kExprRefFunc, func.index]);
96 builder.addFunction("main", kSig_i_ii)
97 .addBody([kExprLocalGet, 1, kExprLocalGet, 0, kExprTableGet, 0,
98 kExprCallRef, sig])
99 .exportFunc();
100
101 const instance = builder.instantiate();
102
103 assertEquals(1, instance.exports.main(0, 1));
104 assertEquals(33, instance.exports.main(5, 33));
105 }
106
107 test(true);
108 test(false);

Callers 1

externref-table.jsFile · 0.70

Calls 10

addTypeMethod · 0.95
addFunctionMethod · 0.95
addTableMethod · 0.95
instantiateMethod · 0.95
wasmRefNullTypeFunction · 0.70
wasmRefTypeFunction · 0.70
assertEqualsFunction · 0.50
addBodyMethod · 0.45
exportFuncMethod · 0.45
mainMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…