Bug 892634 - Part 4: Add jit-test.
authorShu-yu Guo <shu@rfrn.org>
Fri, 02 Aug 2013 08:24:58 -0700
changeset 153429 e21faadc79429c6bb06f213851bcdd804a8d3ed1
parent 153428 701af9ee77c8720d305e037fb4b2af55bdeb1728
child 153430 26f3f4a5d5f48ae95e012917ade88aaad4884df5
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs892634
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 892634 - Part 4: Add jit-test.
js/src/jit-test/tests/parallel/bitops-values.js
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/parallel/bitops-values.js
@@ -0,0 +1,84 @@
+load(libdir + "parallelarray-helpers.js");
+
+// The following tests test 2 paths in Ion. The 'ValueToInt32' paths test
+// LValueToInt32, and the 'V' paths test the slow value-taking VM functions
+// corresponding to the bit ops.
+//
+// At the time of writing the 'V' paths are triggered when any of the operands
+// to the bit ops may be an object, thus the always-false branch which assign
+// {} to one of the operands.
+
+var len = minItemsTestingThreshold;
+var vals = [true, false, undefined, "1"];
+
+function testBitNotValueToInt32() {
+  assertArraySeqParResultsEq(range(0, len), "map", function (i) {
+    return [~vals[0], ~vals[1], ~vals[2], ~vals[3]];
+  });
+}
+
+function testBitNotV() {
+  assertArraySeqParResultsEq(range(0, len), "map", function (i) {
+    var a, b, c, d;
+    if (i < 0) {
+      a = {};
+      b = {};
+      c = {};
+      d = {};
+    } else {
+      a = vals[0];
+      b = vals[1];
+      c = vals[2];
+      d = vals[3];
+    }
+    return [~a, ~b, ~c, ~d];
+  });
+}
+
+function testBitBinOpsValueToInt32() {
+  for (var n = 0; n < vals.length; n++) {
+    for (var m = n; m < vals.length; m++) {
+      assertArraySeqParResultsEq(range(0, len), "map", function (i) {
+        var a = vals[n];
+        var b = vals[m];
+
+        return [a & b,
+                a | b,
+                a ^ b,
+                a << b,
+                a >> b];
+      });
+    }
+  }
+}
+
+function testBitBinOpsV() {
+  for (var n = 0; n < vals.length; n++) {
+    for (var m = n; m < vals.length; m++) {
+      assertArraySeqParResultsEq(range(0, len), "map", function (i) {
+        var a, b;
+
+        if (i < 0) {
+          a = {};
+          b = {};
+        } else {
+          a = vals[n];
+          b = vals[m];
+        }
+
+        return [a & b,
+                a | b,
+                a ^ b,
+                a << b,
+                a >> b];
+      });
+    }
+  }
+}
+
+if (getBuildConfiguration().parallelJS) {
+  testBitNotValueToInt32();
+  testBitNotV();
+  testBitBinOpsValueToInt32();
+  testBitBinOpsV();
+}