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

Function TestAtomicI64Wait

deps/v8/test/mjsunit/wasm/wasm-interpreter-memory64.js:130–149  ·  view source on GitHub ↗
(pages, offset)

Source from the content-addressed store, hash-verified

128 }
129
130 function TestAtomicI64Wait(pages, offset) {
131 if (!%IsAtomicsWaitAllowed()) return;
132
133 let memory = CreateBigSharedWasmMemory64(pages);
134 assertEquals(kAtomicWaitNotEqual, WasmI64AtomicWait(memory, offset, 0, 42, 0, -1));
135 assertEquals(kAtomicWaitTimedOut, WasmI64AtomicWait(memory, offset, 0, 0, 0, 0));
136 assertEquals(kAtomicWaitNotEqual, WasmI64AtomicWait(memory, 0, offset, 42, 0, -1));
137 assertEquals(kAtomicWaitTimedOut, WasmI64AtomicWait(memory, 0, offset, 0, 0, 0));
138
139 let i32a = new Int32Array(memory.buffer);
140 i32a[offset / 4] = 1;
141 i32a[(offset / 4) + 1] = 2;
142
143 assertEquals(kAtomicWaitNotEqual, WasmI64AtomicWait(memory, offset, 0, 2, 1, -1));
144 assertEquals(kAtomicWaitTimedOut, WasmI64AtomicWait(memory, offset, 0, 1, 2, 0));
145 assertEquals(kAtomicWaitNotEqual, WasmI64AtomicWait(memory, 0, offset, 2, 1, -1));
146 assertEquals(kAtomicWaitTimedOut, WasmI64AtomicWait(memory, 0, offset, 1, 2, 0));
147
148 assertEquals(0, WasmAtomicNotify(memory, offset, /*index*/8, 1));
149 }
150
151 const OFFSET = 4000;
152 const MEM_PAGES = 100;

Callers 1

Calls 4

WasmI64AtomicWaitFunction · 0.70
WasmAtomicNotifyFunction · 0.70
assertEqualsFunction · 0.50

Tested by

no test coverage detected