summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/asm.js/testBug1183060.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/asm.js/testBug1183060.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/asm.js/testBug1183060.js')
-rw-r--r--js/src/jit-test/tests/asm.js/testBug1183060.js55
1 files changed, 55 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/asm.js/testBug1183060.js b/js/src/jit-test/tests/asm.js/testBug1183060.js
new file mode 100644
index 000000000..af2e9cf1b
--- /dev/null
+++ b/js/src/jit-test/tests/asm.js/testBug1183060.js
@@ -0,0 +1,55 @@
+if (!this.SharedArrayBuffer)
+ quit(0);
+
+function loadModule_uint16(stdlib, foreign, heap) {
+ "use asm";
+ var atomic_add = stdlib.Atomics.add;
+ var atomic_sub = stdlib.Atomics.sub;
+ var atomic_and = stdlib.Atomics.and;
+ var atomic_or = stdlib.Atomics.or;
+ var atomic_xor = stdlib.Atomics.xor;
+ var i16a = new stdlib.Uint16Array(heap);
+ function do_add_i(i) {
+ i = i|0;
+ var v = 0;
+ v = atomic_add(i16a, i>>1, 0x3333)|0;
+ }
+ function do_sub_i(i) {
+ i = i|0;
+ var v = 0;
+ v = atomic_sub(i16a, i>>1, 0x3333)|0;
+ }
+ function do_and_i(i) {
+ i = i|0;
+ var v = 0;
+ v = atomic_and(i16a, i>>1, 0x3333)|0;
+ }
+ function do_or_i(i) {
+ i = i|0;
+ var v = 0;
+ v = atomic_or(i16a, i>>1, 0x3333)|0;
+ }
+ function do_xor_i(i) {
+ i = i|0;
+ var v = 0;
+ v = atomic_xor(i16a, i>>1, 0x3333)|0;
+ }
+ return { add_i: do_add_i,
+ sub_i: do_sub_i,
+ and_i: do_and_i,
+ or_i: do_or_i,
+ xor_i: do_xor_i };
+}
+
+function test_uint16(heap) {
+ var i16m = loadModule_uint16(this, {}, heap);
+ var size = Uint16Array.BYTES_PER_ELEMENT;
+ i16m.add_i(size*40)
+ i16m.sub_i(size*40)
+ i16m.and_i(size*40)
+ i16m.or_i(size*40)
+ i16m.xor_i(size*40)
+}
+
+var heap = new SharedArrayBuffer(65536);
+test_uint16(heap);