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

Function testCallFFI

deps/v8/test/mjsunit/wasm/ffi.js:9–31  ·  view source on GitHub ↗
(func, check)

Source from the content-addressed store, hash-verified

7d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
8
9function testCallFFI(func, check) {
10 var builder = new WasmModuleBuilder();
11
12 var sig_index = builder.addType(kSig_i_dd);
13 builder.addImport("", "func", sig_index);
14 builder.addFunction("main", sig_index)
15 .addBody([
16 kExprLocalGet, 0, // --
17 kExprLocalGet, 1, // --
18 kExprCallFunction, 0 // --
19 ]) // --
20 .exportFunc();
21
22 var main = builder.instantiate({"": {func: func}}).exports.main;
23
24 for (var i = 0; i < 100000; i += 10003) {
25 var a = 22.5 + i, b = 10.5 + i;
26 var r = main(a, b);
27 if (check) {
28 check(r, a, b);
29 }
30 }
31}
32
33var global = (function() { return this; })();
34var params = [-99, -99, -99, -99, -99];

Callers 1

ffi.jsFile · 0.85

Calls 8

addTypeMethod · 0.95
addImportMethod · 0.95
addFunctionMethod · 0.95
instantiateMethod · 0.95
mainFunction · 0.70
checkFunction · 0.70
exportFuncMethod · 0.45
addBodyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…