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

Function TestAtomicI32Wait

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

Source from the content-addressed store, hash-verified

108 }
109
110 function TestAtomicI32Wait(pages, offset) {
111 if (!%IsAtomicsWaitAllowed()) return;
112
113 let memory = CreateBigSharedWasmMemory64(pages);
114 assertEquals(kAtomicWaitNotEqual, WasmI32AtomicWait(memory, offset, 0, 42, -1));
115 assertEquals(kAtomicWaitTimedOut, WasmI32AtomicWait(memory, offset, 0, 0, 0));
116 assertEquals(kAtomicWaitNotEqual, WasmI32AtomicWait(memory, 0, offset, 42, -1));
117 assertEquals(kAtomicWaitTimedOut, WasmI32AtomicWait(memory, 0, offset, 0, 0));
118
119 let i32a = new Int32Array(memory.buffer);
120 i32a[offset / 4] = 1;
121
122 assertEquals(kAtomicWaitNotEqual, WasmI32AtomicWait(memory, offset, 0, 0, -1));
123 assertEquals(kAtomicWaitTimedOut, WasmI32AtomicWait(memory, offset, 0, 1, 0));
124 assertEquals(kAtomicWaitNotEqual, WasmI32AtomicWait(memory, 0, offset, 0, -1));
125 assertEquals(kAtomicWaitTimedOut, WasmI32AtomicWait(memory, 0, offset, 1, 0));
126
127 assertEquals(0, WasmAtomicNotify(memory, offset, /*index*/4, 1));
128 }
129
130 function TestAtomicI64Wait(pages, offset) {
131 if (!%IsAtomicsWaitAllowed()) return;

Callers 1

Calls 4

WasmI32AtomicWaitFunction · 0.70
WasmAtomicNotifyFunction · 0.70
assertEqualsFunction · 0.50

Tested by

no test coverage detected