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

Function WasmI64AtomicWait

deps/v8/test/mjsunit/wasm/atomics-memory64.js:65–96  ·  view source on GitHub ↗
(memory, offset, index, val_low,
                                   val_high, timeout)

Source from the content-addressed store, hash-verified

63}
64
65function WasmI64AtomicWait(memory, offset, index, val_low,
66 val_high, timeout) {
67 let builder = new WasmModuleBuilder();
68 let pages = memory.buffer.byteLength / kPageSize;
69 builder.addImportedMemory("m", "memory", pages, pages, "shared", "memory64");
70 // Wrapper for I64AtomicWait that takes two I32 values and combines to into
71 // I64 for the instruction parameter.
72 builder.addFunction("main",
73 makeSig([kWasmF64, kWasmI32, kWasmI32, kWasmF64], [kWasmI32]))
74 .addLocals(kWasmI64, 1)
75 .addBody([
76 kExprLocalGet, 1,
77 kExprI64UConvertI32,
78 kExprI64Const, 32,
79 kExprI64Shl,
80 kExprLocalGet, 2,
81 kExprI64UConvertI32,
82 kExprI64Ior,
83 kExprLocalSet, 4, // Store the created I64 value in local
84 kExprLocalGet, 0,
85 kExprI64SConvertF64,
86 kExprLocalGet, 4,
87 kExprLocalGet, 3,
88 kExprI64SConvertF64,
89 kAtomicPrefix,
90 kExprI64AtomicWait, /* alignment */ 3, ...wasmSignedLeb64(offset, 10)])
91 .exportAs("main");
92
93 let module = new WebAssembly.Module(builder.toBuffer());
94 let instance = new WebAssembly.Instance(module, {m: {memory}});
95 return instance.exports.main(index, val_high, val_low, timeout);
96}
97
98function TestAtomicI32Wait(pages, offset) {
99 if (!%IsAtomicsWaitAllowed()) return;

Callers 1

TestAtomicI64WaitFunction · 0.70

Calls 9

addImportedMemoryMethod · 0.95
addFunctionMethod · 0.95
toBufferMethod · 0.95
wasmSignedLeb64Function · 0.85
makeSigFunction · 0.70
exportAsMethod · 0.45
addBodyMethod · 0.45
addLocalsMethod · 0.45
mainMethod · 0.45

Tested by

no test coverage detected