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

Function GetAtomicBinOpFunction

deps/v8/test/mjsunit/wasm/atomics.js:22–38  ·  view source on GitHub ↗
(wasmExpression, alignment, offset)

Source from the content-addressed store, hash-verified

20let memory = new WebAssembly.Memory({initial: 1, maximum: maxSize, shared: true});
21
22function GetAtomicBinOpFunction(wasmExpression, alignment, offset) {
23 let builder = new WasmModuleBuilder();
24 builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared");
25 builder.addFunction("main", kSig_i_ii)
26 .addBody([
27 kExprLocalGet, 0,
28 kExprLocalGet, 1,
29 kAtomicPrefix,
30 wasmExpression, alignment, offset])
31 .exportAs("main");
32
33 // Instantiate module, get function exports
34 let module = new WebAssembly.Module(builder.toBuffer());
35 let instance = new WebAssembly.Instance(module,
36 {m: {imported_mem: memory}});
37 return instance.exports.main;
38}
39
40function GetI64AtomicBinOpFunction(wasmExpression, alignment, offset) {
41 const kSig_l_il = makeSig([kWasmI32, kWasmI64], [kWasmI64]);

Callers 1

atomics.jsFile · 0.85

Calls 5

addImportedMemoryMethod · 0.95
addFunctionMethod · 0.95
toBufferMethod · 0.95
exportAsMethod · 0.45
addBodyMethod · 0.45

Tested by

no test coverage detected