(memory, offset, index, val_low,
val_high, timeout)
| 63 | } |
| 64 | |
| 65 | function 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 | |
| 98 | function TestAtomicI32Wait(pages, offset) { |
| 99 | if (!%IsAtomicsWaitAllowed()) return; |
no test coverage detected