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

Function sumArray

deps/v8/test/mjsunit/wasm/wasm-gc-inlining-load-elimination.js:76–84  ·  view source on GitHub ↗
(arrayStruct)

Source from the content-addressed store, hash-verified

74 let myUserArray = wasm.createArray(42, 43, 44);
75
76 let sumArray = (arrayStruct) => {
77 let get = wasm.get;
78 let length = wasm.getLength(arrayStruct);
79 let result = 0;
80 for (let i = 0; i < length; ++i) {
81 result += get(arrayStruct, i);
82 }
83 return result;
84 };
85
86 testOptimized(() => assertEquals(42+43+44, sumArray(myUserArray)), sumArray);
87})();

Calls 1

getFunction · 0.70

Tested by

no test coverage detected