(wasmExpression, alignment, offset)
| 58 | } |
| 59 | |
| 60 | function GetAtomicCmpExchangeFunction(wasmExpression, alignment, offset) { |
| 61 | let builder = new WasmModuleBuilder(); |
| 62 | builder.addImportedMemory("m", "imported_mem", 0, maxSize, "shared"); |
| 63 | builder.addFunction("main", kSig_i_iii) |
| 64 | .addBody([ |
| 65 | kExprLocalGet, 0, |
| 66 | kExprLocalGet, 1, |
| 67 | kExprLocalGet, 2, |
| 68 | kAtomicPrefix, |
| 69 | wasmExpression, alignment, ...wasmSignedLeb(offset, 5)]) |
| 70 | .exportAs("main"); |
| 71 | |
| 72 | // Instantiate module, get function exports |
| 73 | let module = new WebAssembly.Module(builder.toBuffer()); |
| 74 | let instance = new WebAssembly.Instance(module, |
| 75 | {m: {imported_mem: memory}}); |
| 76 | return instance.exports.main; |
| 77 | } |
| 78 | |
| 79 | function GetAtomicLoadFunction(wasmExpression, alignment, offset) { |
| 80 | let builder = new WasmModuleBuilder(); |
no test coverage detected