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

Function GetAtomicCmpExchangeFunction

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

Source from the content-addressed store, hash-verified

58}
59
60function GetAtomicCmpExchangeFunction(wasmExpression, alignment, offset) {
61 let builder = new WasmModuleBuilder();
62 builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared");
63 builder.addFunction("main", kSig_i_iii)
64 .addBody([
65 kExprLocalGet, 0,
66 kExprLocalGet, 1,
67 kExprLocalGet, 2,
68 kAtomicPrefix,
69 wasmExpression, alignment, ...wasmSignedLeb(offset, 5)])
70 .exportAs("main");
71
72 // Instantiate module, get function exports
73 let module = new WebAssembly.Module(builder.toBuffer());
74 let instance = new WebAssembly.Instance(module,
75 {m: {imported_mem: memory}});
76 return instance.exports.main;
77}
78
79function GetAtomicLoadFunction(wasmExpression, alignment, offset) {
80 let builder = new WasmModuleBuilder();

Callers 1

atomics.jsFile · 0.85

Calls 6

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

Tested by

no test coverage detected