| Index: test/mjsunit/asm/atomics-exchange.js
|
| diff --git a/test/mjsunit/asm/atomics-exchange.js b/test/mjsunit/asm/atomics-exchange.js
|
| index ed2b0fa21b4679f7ec29bea9ac832333ec4d9cb9..6de7b4b954021f61669f7a99751710d5091b7c04 100644
|
| --- a/test/mjsunit/asm/atomics-exchange.js
|
| +++ b/test/mjsunit/asm/atomics-exchange.js
|
| @@ -4,14 +4,14 @@
|
|
|
| // Flags: --harmony-sharedarraybuffer
|
|
|
| -function Module(stdlib, foreign, heap) {
|
| +function Module(stdlib, foreign, heap, offset) {
|
| "use asm";
|
| - var MEM8 = new stdlib.Int8Array(heap);
|
| - var MEM16 = new stdlib.Int16Array(heap);
|
| - var MEM32 = new stdlib.Int32Array(heap);
|
| - var MEMU8 = new stdlib.Uint8Array(heap);
|
| - var MEMU16 = new stdlib.Uint16Array(heap);
|
| - var MEMU32 = new stdlib.Uint32Array(heap);
|
| + var MEM8 = new stdlib.Int8Array(heap, offset);
|
| + var MEM16 = new stdlib.Int16Array(heap, offset);
|
| + var MEM32 = new stdlib.Int32Array(heap, offset);
|
| + var MEMU8 = new stdlib.Uint8Array(heap, offset);
|
| + var MEMU16 = new stdlib.Uint16Array(heap, offset);
|
| + var MEMU32 = new stdlib.Uint32Array(heap, offset);
|
| var exchange = stdlib.Atomics.exchange;
|
| var fround = stdlib.Math.fround;
|
|
|
| @@ -71,10 +71,10 @@ function clearArray() {
|
| }
|
| }
|
|
|
| -function testElementType(taConstr, f) {
|
| +function testElementType(taConstr, f, offset) {
|
| clearArray();
|
|
|
| - var ta = new taConstr(sab);
|
| + var ta = new taConstr(sab, offset);
|
| var name = Object.prototype.toString.call(ta);
|
| ta[0] = 0x7f;
|
| assertEquals(0x7f, f(0, 0xf), name);
|
| @@ -84,9 +84,21 @@ function testElementType(taConstr, f) {
|
| assertEquals(0, f(ta.length, 0), name);
|
| }
|
|
|
| -testElementType(Int8Array, m.exchangei8);
|
| -testElementType(Int16Array, m.exchangei16);
|
| -testElementType(Int32Array, m.exchangei32);
|
| -testElementType(Uint8Array, m.exchangeu8);
|
| -testElementType(Uint16Array, m.exchangeu16);
|
| -testElementType(Uint32Array, m.exchangeu32);
|
| +function testElement(m, offset) {
|
| + testElementType(Int8Array, m.exchangei8, offset);
|
| + testElementType(Int16Array, m.exchangei16, offset);
|
| + testElementType(Int32Array, m.exchangei32, offset);
|
| + testElementType(Uint8Array, m.exchangeu8, offset);
|
| + testElementType(Uint16Array, m.exchangeu16, offset);
|
| + testElementType(Uint32Array, m.exchangeu32, offset);
|
| +}
|
| +
|
| +var offset = 0;
|
| +var sab = new SharedArrayBuffer(16);
|
| +var m1 = Module(this, {}, sab, offset);
|
| +testElement(m1, offset);
|
| +
|
| +offset = 32;
|
| +sab = new SharedArrayBuffer(64);
|
| +var m2 = Module(this, {}, sab, offset);
|
| +testElement(m2, offset);
|
|
|