MCPcopy Create free account
hub / github.com/nodejs/node / run

Function run

deps/v8/test/mjsunit/wasm/gc-buffer.js:9–34  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

7d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
8
9function run(f) {
10 // wrap the creation in a closure so that the only thing returned is
11 // the module (i.e. the underlying array buffer of wasm wire bytes dies).
12 var module = (() => {
13 var builder = new WasmModuleBuilder();
14 builder.addImport("mod", "the_name_of_my_import", kSig_i_i);
15 builder.addFunction("main", kSig_i_i)
16 .addBody([
17 kExprLocalGet, 0,
18 kExprCallFunction, 0])
19 .exportAs("main");
20 print("module");
21 return new WebAssembly.Module(builder.toBuffer());
22 })();
23
24 gc();
25 for (var i = 0; i < 10; i++) {
26 print(" instance " + i);
27 var instance = new WebAssembly.Instance(module, {"mod": {the_name_of_my_import: f}});
28 var g = instance.exports.main;
29 assertEquals("function", typeof g);
30 for (var j = 0; j < 10; j++) {
31 assertEquals(f(j), g(j));
32 }
33 }
34}
35
36(function test() {
37 for (var i = 0; i < 3; i++) {

Callers 1

gc-buffer.jsFile · 0.70

Calls 10

addImportMethod · 0.95
addFunctionMethod · 0.95
toBufferMethod · 0.95
fFunction · 0.70
printFunction · 0.50
gcFunction · 0.50
assertEqualsFunction · 0.50
gFunction · 0.50
exportAsMethod · 0.45
addBodyMethod · 0.45

Tested by

no test coverage detected