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

Function testCallImport

deps/v8/test/mjsunit/wasm/import-function.js:7–26  ·  view source on GitHub ↗
(func, check)

Source from the content-addressed store, hash-verified

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

Callers 1

import-function.jsFile · 0.70

Calls 8

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…