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

Function TestAtomicI32Wait

deps/v8/test/mjsunit/wasm/atomics-memory64.js:98–116  ·  view source on GitHub ↗
(pages, offset)

Source from the content-addressed store, hash-verified

96}
97
98function TestAtomicI32Wait(pages, offset) {
99 if (!%IsAtomicsWaitAllowed()) return;
100 print(arguments.callee.name);
101
102 let memory = CreateBigSharedWasmMemory64(pages);
103
104 assertEquals(kAtomicWaitNotEqual, WasmI32AtomicWait(memory, offset, 0, 42, -1));
105 assertEquals(kAtomicWaitTimedOut, WasmI32AtomicWait(memory, offset, 0, 0, 0));
106 assertEquals(kAtomicWaitNotEqual, WasmI32AtomicWait(memory, 0, offset, 42, -1));
107 assertEquals(kAtomicWaitTimedOut, WasmI32AtomicWait(memory, 0, offset, 0, 0));
108
109 let i32a = new Int32Array(memory.buffer);
110 i32a[offset / 4] = 1;
111
112 assertEquals(kAtomicWaitNotEqual, WasmI32AtomicWait(memory, offset, 0, 0, -1));
113 assertEquals(kAtomicWaitTimedOut, WasmI32AtomicWait(memory, offset, 0, 1, 0));
114 assertEquals(kAtomicWaitNotEqual, WasmI32AtomicWait(memory, 0, offset, 0, -1));
115 assertEquals(kAtomicWaitTimedOut, WasmI32AtomicWait(memory, 0, offset, 1, 0));
116}
117
118function TestAtomicI64Wait(pages, offset) {
119 if (!%IsAtomicsWaitAllowed()) return;

Callers 1

Calls 4

WasmI32AtomicWaitFunction · 0.70
printFunction · 0.50
assertEqualsFunction · 0.50

Tested by

no test coverage detected