Bug 933001 - Part 4/5 - Add SharedArrayBuffer tests.
authorSean Stangl <sstangl@mozilla.com>
Thu, 20 Feb 2014 14:48:42 -0800
changeset 171170 b21841db83df66f3f1b15fba09f24433c5e74878
parent 171169 79c2a2e387610a8bb5800e5ffdd3fc76e4eb7105
child 171171 7bb98e166b5bd052a8753914286c4f7b5f682528
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
bugs933001
milestone30.0a1
Bug 933001 - Part 4/5 - Add SharedArrayBuffer tests.
js/src/jit-test/tests/sharedbuf/asm-link.js
js/src/jit-test/tests/sharedbuf/gc-one-view.js
js/src/jit-test/tests/sharedbuf/gc-two-views.js
js/src/jit-test/tests/sharedbuf/is-zeroed.js
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/sharedbuf/asm-link.js
@@ -0,0 +1,10 @@
+// Don't assert.
+function $(stdlib, foreign, heap) {
+    "use asm";
+    var Float64ArrayView = new stdlib.Float64Array(heap);
+    function f() {}
+    return f
+}
+
+if (typeof SharedArrayBuffer !== "undefined")
+    $(this, {}, new SharedArrayBuffer(4096));
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/sharedbuf/gc-one-view.js
@@ -0,0 +1,10 @@
+// Test tracing of a single linked ArrayBufferViewObject.
+
+function f() {
+    var x = new SharedArrayBuffer(0x1000);
+    var y = new Int32Array(x);
+    gc();
+}
+
+if (typeof SharedArrayBuffer !== "undefined")
+    f();
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/sharedbuf/gc-two-views.js
@@ -0,0 +1,11 @@
+// Test tracing of two views of a SharedArrayBuffer. Uses a different path.
+
+function f() {
+    var x = new SharedArrayBuffer(0x1000);
+    var y = new Int32Array(x);
+    var z = new Int8Array(x);
+    gc();
+}
+
+if (typeof SharedArrayBuffer !== "undefined")
+    f();
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/sharedbuf/is-zeroed.js
@@ -0,0 +1,12 @@
+// Test that the SharedArrayBuffer memory is properly zeroed.
+
+function f() {
+    var x = new SharedArrayBuffer(4096);
+    var y = new Int32Array(x);
+    assertEq(y[0], 0);
+    assertEq(y[1], 0);
+    assertEq(y[1023], 0);
+}
+
+if (typeof SharedArrayBuffer !== "undefined")
+    f();