Add more systematic tests for comparisons.
authortitzer <titzer@chromium.org>
Wed, 8 Apr 2015 13:15:34 +0000 (06:15 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 8 Apr 2015 13:15:41 +0000 (13:15 +0000)
Because, well, JavaScript is tricky and compilers like folding.

R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1069673002

Cr-Commit-Position: refs/heads/master@{#27668}

test/mjsunit/compare-table-eq.js [new file with mode: 0644]
test/mjsunit/compare-table-gt.js [new file with mode: 0644]
test/mjsunit/compare-table-gteq.js [new file with mode: 0644]
test/mjsunit/compare-table-lt.js [new file with mode: 0644]
test/mjsunit/compare-table-lteq.js [new file with mode: 0644]
test/mjsunit/compare-table-ne.js [new file with mode: 0644]
test/mjsunit/compare-table-seq.js [new file with mode: 0644]
test/mjsunit/compare-table-sne.js [new file with mode: 0644]
tools/compare-table-gen.js [new file with mode: 0644]

diff --git a/test/mjsunit/compare-table-eq.js b/test/mjsunit/compare-table-eq.js
new file mode 100644 (file)
index 0000000..fa7bef7
--- /dev/null
@@ -0,0 +1,105 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var values = [true,false,null,void 0,0,0.0,-0,"",-1,-1.25,1,1.25,-2147483648,2147483648,Infinity,-Infinity,NaN];
+var expected = [
+  [true ,false,false,false,false,false,false,false,false,false,true ,false,false,false,false,false,false],
+  [false,true ,false,false,true ,true ,true ,true ,false,false,false,false,false,false,false,false,false],
+  [false,false,true ,true ,false,false,false,false,false,false,false,false,false,false,false,false,false],
+  [false,false,true ,true ,false,false,false,false,false,false,false,false,false,false,false,false,false],
+  [false,true ,false,false,true ,true ,true ,true ,false,false,false,false,false,false,false,false,false],
+  [false,true ,false,false,true ,true ,true ,true ,false,false,false,false,false,false,false,false,false],
+  [false,true ,false,false,true ,true ,true ,true ,false,false,false,false,false,false,false,false,false],
+  [false,true ,false,false,true ,true ,true ,true ,false,false,false,false,false,false,false,false,false],
+  [false,false,false,false,false,false,false,false,true ,false,false,false,false,false,false,false,false],
+  [false,false,false,false,false,false,false,false,false,true ,false,false,false,false,false,false,false],
+  [true ,false,false,false,false,false,false,false,false,false,true ,false,false,false,false,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,true ,false,false,false,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,true ,false,false,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,true ,false,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,true ,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]
+];
+var func = (function eq(a,b) { return a == b; });
+var left_funcs = [
+  (function eq_L0(b) { return true == b; }),
+  (function eq_L1(b) { return false == b; }),
+  (function eq_L2(b) { return null == b; }),
+  (function eq_L3(b) { return void 0 == b; }),
+  (function eq_L4(b) { return 0 == b; }),
+  (function eq_L5(b) { return 0.0 == b; }),
+  (function eq_L6(b) { return -0 == b; }),
+  (function eq_L7(b) { return "" == b; }),
+  (function eq_L8(b) { return -1 == b; }),
+  (function eq_L9(b) { return -1.25 == b; }),
+  (function eq_L10(b) { return 1 == b; }),
+  (function eq_L11(b) { return 1.25 == b; }),
+  (function eq_L12(b) { return -2147483648 == b; }),
+  (function eq_L13(b) { return 2147483648 == b; }),
+  (function eq_L14(b) { return Infinity == b; }),
+  (function eq_L15(b) { return -Infinity == b; }),
+  (function eq_L16(b) { return NaN == b; })
+];
+var right_funcs = [
+  (function eq_R0(a) { return a == true; }),
+  (function eq_R1(a) { return a == false; }),
+  (function eq_R2(a) { return a == null; }),
+  (function eq_R3(a) { return a == void 0; }),
+  (function eq_R4(a) { return a == 0; }),
+  (function eq_R5(a) { return a == 0.0; }),
+  (function eq_R6(a) { return a == -0; }),
+  (function eq_R7(a) { return a == ""; }),
+  (function eq_R8(a) { return a == -1; }),
+  (function eq_R9(a) { return a == -1.25; }),
+  (function eq_R10(a) { return a == 1; }),
+  (function eq_R11(a) { return a == 1.25; }),
+  (function eq_R12(a) { return a == -2147483648; }),
+  (function eq_R13(a) { return a == 2147483648; }),
+  (function eq_R14(a) { return a == Infinity; }),
+  (function eq_R15(a) { return a == -Infinity; }),
+  (function eq_R16(a) { return a == NaN; })
+];
+function matrix() {
+  return [
+    [true == true,true == false,true == null,true == void 0,true == 0,true == 0.0,true == -0,true == "",true == -1,true == -1.25,true == 1,true == 1.25,true == -2147483648,true == 2147483648,true == Infinity,true == -Infinity,true == NaN],
+    [false == true,false == false,false == null,false == void 0,false == 0,false == 0.0,false == -0,false == "",false == -1,false == -1.25,false == 1,false == 1.25,false == -2147483648,false == 2147483648,false == Infinity,false == -Infinity,false == NaN],
+    [null == true,null == false,null == null,null == void 0,null == 0,null == 0.0,null == -0,null == "",null == -1,null == -1.25,null == 1,null == 1.25,null == -2147483648,null == 2147483648,null == Infinity,null == -Infinity,null == NaN],
+    [void 0 == true,void 0 == false,void 0 == null,void 0 == void 0,void 0 == 0,void 0 == 0.0,void 0 == -0,void 0 == "",void 0 == -1,void 0 == -1.25,void 0 == 1,void 0 == 1.25,void 0 == -2147483648,void 0 == 2147483648,void 0 == Infinity,void 0 == -Infinity,void 0 == NaN],
+    [0 == true,0 == false,0 == null,0 == void 0,0 == 0,0 == 0.0,0 == -0,0 == "",0 == -1,0 == -1.25,0 == 1,0 == 1.25,0 == -2147483648,0 == 2147483648,0 == Infinity,0 == -Infinity,0 == NaN],
+    [0.0 == true,0.0 == false,0.0 == null,0.0 == void 0,0.0 == 0,0.0 == 0.0,0.0 == -0,0.0 == "",0.0 == -1,0.0 == -1.25,0.0 == 1,0.0 == 1.25,0.0 == -2147483648,0.0 == 2147483648,0.0 == Infinity,0.0 == -Infinity,0.0 == NaN],
+    [-0 == true,-0 == false,-0 == null,-0 == void 0,-0 == 0,-0 == 0.0,-0 == -0,-0 == "",-0 == -1,-0 == -1.25,-0 == 1,-0 == 1.25,-0 == -2147483648,-0 == 2147483648,-0 == Infinity,-0 == -Infinity,-0 == NaN],
+    ["" == true,"" == false,"" == null,"" == void 0,"" == 0,"" == 0.0,"" == -0,"" == "","" == -1,"" == -1.25,"" == 1,"" == 1.25,"" == -2147483648,"" == 2147483648,"" == Infinity,"" == -Infinity,"" == NaN],
+    [-1 == true,-1 == false,-1 == null,-1 == void 0,-1 == 0,-1 == 0.0,-1 == -0,-1 == "",-1 == -1,-1 == -1.25,-1 == 1,-1 == 1.25,-1 == -2147483648,-1 == 2147483648,-1 == Infinity,-1 == -Infinity,-1 == NaN],
+    [-1.25 == true,-1.25 == false,-1.25 == null,-1.25 == void 0,-1.25 == 0,-1.25 == 0.0,-1.25 == -0,-1.25 == "",-1.25 == -1,-1.25 == -1.25,-1.25 == 1,-1.25 == 1.25,-1.25 == -2147483648,-1.25 == 2147483648,-1.25 == Infinity,-1.25 == -Infinity,-1.25 == NaN],
+    [1 == true,1 == false,1 == null,1 == void 0,1 == 0,1 == 0.0,1 == -0,1 == "",1 == -1,1 == -1.25,1 == 1,1 == 1.25,1 == -2147483648,1 == 2147483648,1 == Infinity,1 == -Infinity,1 == NaN],
+    [1.25 == true,1.25 == false,1.25 == null,1.25 == void 0,1.25 == 0,1.25 == 0.0,1.25 == -0,1.25 == "",1.25 == -1,1.25 == -1.25,1.25 == 1,1.25 == 1.25,1.25 == -2147483648,1.25 == 2147483648,1.25 == Infinity,1.25 == -Infinity,1.25 == NaN],
+    [-2147483648 == true,-2147483648 == false,-2147483648 == null,-2147483648 == void 0,-2147483648 == 0,-2147483648 == 0.0,-2147483648 == -0,-2147483648 == "",-2147483648 == -1,-2147483648 == -1.25,-2147483648 == 1,-2147483648 == 1.25,-2147483648 == -2147483648,-2147483648 == 2147483648,-2147483648 == Infinity,-2147483648 == -Infinity,-2147483648 == NaN],
+    [2147483648 == true,2147483648 == false,2147483648 == null,2147483648 == void 0,2147483648 == 0,2147483648 == 0.0,2147483648 == -0,2147483648 == "",2147483648 == -1,2147483648 == -1.25,2147483648 == 1,2147483648 == 1.25,2147483648 == -2147483648,2147483648 == 2147483648,2147483648 == Infinity,2147483648 == -Infinity,2147483648 == NaN],
+    [Infinity == true,Infinity == false,Infinity == null,Infinity == void 0,Infinity == 0,Infinity == 0.0,Infinity == -0,Infinity == "",Infinity == -1,Infinity == -1.25,Infinity == 1,Infinity == 1.25,Infinity == -2147483648,Infinity == 2147483648,Infinity == Infinity,Infinity == -Infinity,Infinity == NaN],
+    [-Infinity == true,-Infinity == false,-Infinity == null,-Infinity == void 0,-Infinity == 0,-Infinity == 0.0,-Infinity == -0,-Infinity == "",-Infinity == -1,-Infinity == -1.25,-Infinity == 1,-Infinity == 1.25,-Infinity == -2147483648,-Infinity == 2147483648,-Infinity == Infinity,-Infinity == -Infinity,-Infinity == NaN],
+    [NaN == true,NaN == false,NaN == null,NaN == void 0,NaN == 0,NaN == 0.0,NaN == -0,NaN == "",NaN == -1,NaN == -1.25,NaN == 1,NaN == 1.25,NaN == -2147483648,NaN == 2147483648,NaN == Infinity,NaN == -Infinity,NaN == NaN]
+  ];
+}
+function test() {
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      var a = values[i];
+      var b = values[j];
+      var x = expected[i][j];
+      assertEquals(x, func(a,b));
+      assertEquals(x, left_funcs[i](b));
+      assertEquals(x, right_funcs[j](a));
+    }
+  }
+
+  var result = matrix();
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      assertEquals(expected[i][j], result[i][j]);
+    }
+  }
+}
+test();
+test();
diff --git a/test/mjsunit/compare-table-gt.js b/test/mjsunit/compare-table-gt.js
new file mode 100644 (file)
index 0000000..b7830ec
--- /dev/null
@@ -0,0 +1,105 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var values = [true,false,null,void 0,0,0.0,-0,"",-1,-1.25,1,1.25,-2147483648,2147483648,Infinity,-Infinity,NaN];
+var expected = [
+  [false,true ,true ,false,true ,true ,true ,true ,true ,true ,false,false,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,true ,true ,false,false,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,true ,true ,false,false,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
+  [false,false,false,false,false,false,false,false,true ,true ,false,false,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,true ,true ,false,false,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,true ,true ,false,false,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,true ,true ,false,false,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,false,true ,false,false,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,true ,false,false,true ,false],
+  [false,true ,true ,false,true ,true ,true ,true ,true ,true ,false,false,true ,false,false,true ,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,false,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true ,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,false,true ,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]
+];
+var func = (function gt(a,b) { return a > b; });
+var left_funcs = [
+  (function gt_L0(b) { return true > b; }),
+  (function gt_L1(b) { return false > b; }),
+  (function gt_L2(b) { return null > b; }),
+  (function gt_L3(b) { return void 0 > b; }),
+  (function gt_L4(b) { return 0 > b; }),
+  (function gt_L5(b) { return 0.0 > b; }),
+  (function gt_L6(b) { return -0 > b; }),
+  (function gt_L7(b) { return "" > b; }),
+  (function gt_L8(b) { return -1 > b; }),
+  (function gt_L9(b) { return -1.25 > b; }),
+  (function gt_L10(b) { return 1 > b; }),
+  (function gt_L11(b) { return 1.25 > b; }),
+  (function gt_L12(b) { return -2147483648 > b; }),
+  (function gt_L13(b) { return 2147483648 > b; }),
+  (function gt_L14(b) { return Infinity > b; }),
+  (function gt_L15(b) { return -Infinity > b; }),
+  (function gt_L16(b) { return NaN > b; })
+];
+var right_funcs = [
+  (function gt_R0(a) { return a > true; }),
+  (function gt_R1(a) { return a > false; }),
+  (function gt_R2(a) { return a > null; }),
+  (function gt_R3(a) { return a > void 0; }),
+  (function gt_R4(a) { return a > 0; }),
+  (function gt_R5(a) { return a > 0.0; }),
+  (function gt_R6(a) { return a > -0; }),
+  (function gt_R7(a) { return a > ""; }),
+  (function gt_R8(a) { return a > -1; }),
+  (function gt_R9(a) { return a > -1.25; }),
+  (function gt_R10(a) { return a > 1; }),
+  (function gt_R11(a) { return a > 1.25; }),
+  (function gt_R12(a) { return a > -2147483648; }),
+  (function gt_R13(a) { return a > 2147483648; }),
+  (function gt_R14(a) { return a > Infinity; }),
+  (function gt_R15(a) { return a > -Infinity; }),
+  (function gt_R16(a) { return a > NaN; })
+];
+function matrix() {
+  return [
+    [true > true,true > false,true > null,true > void 0,true > 0,true > 0.0,true > -0,true > "",true > -1,true > -1.25,true > 1,true > 1.25,true > -2147483648,true > 2147483648,true > Infinity,true > -Infinity,true > NaN],
+    [false > true,false > false,false > null,false > void 0,false > 0,false > 0.0,false > -0,false > "",false > -1,false > -1.25,false > 1,false > 1.25,false > -2147483648,false > 2147483648,false > Infinity,false > -Infinity,false > NaN],
+    [null > true,null > false,null > null,null > void 0,null > 0,null > 0.0,null > -0,null > "",null > -1,null > -1.25,null > 1,null > 1.25,null > -2147483648,null > 2147483648,null > Infinity,null > -Infinity,null > NaN],
+    [void 0 > true,void 0 > false,void 0 > null,void 0 > void 0,void 0 > 0,void 0 > 0.0,void 0 > -0,void 0 > "",void 0 > -1,void 0 > -1.25,void 0 > 1,void 0 > 1.25,void 0 > -2147483648,void 0 > 2147483648,void 0 > Infinity,void 0 > -Infinity,void 0 > NaN],
+    [0 > true,0 > false,0 > null,0 > void 0,0 > 0,0 > 0.0,0 > -0,0 > "",0 > -1,0 > -1.25,0 > 1,0 > 1.25,0 > -2147483648,0 > 2147483648,0 > Infinity,0 > -Infinity,0 > NaN],
+    [0.0 > true,0.0 > false,0.0 > null,0.0 > void 0,0.0 > 0,0.0 > 0.0,0.0 > -0,0.0 > "",0.0 > -1,0.0 > -1.25,0.0 > 1,0.0 > 1.25,0.0 > -2147483648,0.0 > 2147483648,0.0 > Infinity,0.0 > -Infinity,0.0 > NaN],
+    [-0 > true,-0 > false,-0 > null,-0 > void 0,-0 > 0,-0 > 0.0,-0 > -0,-0 > "",-0 > -1,-0 > -1.25,-0 > 1,-0 > 1.25,-0 > -2147483648,-0 > 2147483648,-0 > Infinity,-0 > -Infinity,-0 > NaN],
+    ["" > true,"" > false,"" > null,"" > void 0,"" > 0,"" > 0.0,"" > -0,"" > "","" > -1,"" > -1.25,"" > 1,"" > 1.25,"" > -2147483648,"" > 2147483648,"" > Infinity,"" > -Infinity,"" > NaN],
+    [-1 > true,-1 > false,-1 > null,-1 > void 0,-1 > 0,-1 > 0.0,-1 > -0,-1 > "",-1 > -1,-1 > -1.25,-1 > 1,-1 > 1.25,-1 > -2147483648,-1 > 2147483648,-1 > Infinity,-1 > -Infinity,-1 > NaN],
+    [-1.25 > true,-1.25 > false,-1.25 > null,-1.25 > void 0,-1.25 > 0,-1.25 > 0.0,-1.25 > -0,-1.25 > "",-1.25 > -1,-1.25 > -1.25,-1.25 > 1,-1.25 > 1.25,-1.25 > -2147483648,-1.25 > 2147483648,-1.25 > Infinity,-1.25 > -Infinity,-1.25 > NaN],
+    [1 > true,1 > false,1 > null,1 > void 0,1 > 0,1 > 0.0,1 > -0,1 > "",1 > -1,1 > -1.25,1 > 1,1 > 1.25,1 > -2147483648,1 > 2147483648,1 > Infinity,1 > -Infinity,1 > NaN],
+    [1.25 > true,1.25 > false,1.25 > null,1.25 > void 0,1.25 > 0,1.25 > 0.0,1.25 > -0,1.25 > "",1.25 > -1,1.25 > -1.25,1.25 > 1,1.25 > 1.25,1.25 > -2147483648,1.25 > 2147483648,1.25 > Infinity,1.25 > -Infinity,1.25 > NaN],
+    [-2147483648 > true,-2147483648 > false,-2147483648 > null,-2147483648 > void 0,-2147483648 > 0,-2147483648 > 0.0,-2147483648 > -0,-2147483648 > "",-2147483648 > -1,-2147483648 > -1.25,-2147483648 > 1,-2147483648 > 1.25,-2147483648 > -2147483648,-2147483648 > 2147483648,-2147483648 > Infinity,-2147483648 > -Infinity,-2147483648 > NaN],
+    [2147483648 > true,2147483648 > false,2147483648 > null,2147483648 > void 0,2147483648 > 0,2147483648 > 0.0,2147483648 > -0,2147483648 > "",2147483648 > -1,2147483648 > -1.25,2147483648 > 1,2147483648 > 1.25,2147483648 > -2147483648,2147483648 > 2147483648,2147483648 > Infinity,2147483648 > -Infinity,2147483648 > NaN],
+    [Infinity > true,Infinity > false,Infinity > null,Infinity > void 0,Infinity > 0,Infinity > 0.0,Infinity > -0,Infinity > "",Infinity > -1,Infinity > -1.25,Infinity > 1,Infinity > 1.25,Infinity > -2147483648,Infinity > 2147483648,Infinity > Infinity,Infinity > -Infinity,Infinity > NaN],
+    [-Infinity > true,-Infinity > false,-Infinity > null,-Infinity > void 0,-Infinity > 0,-Infinity > 0.0,-Infinity > -0,-Infinity > "",-Infinity > -1,-Infinity > -1.25,-Infinity > 1,-Infinity > 1.25,-Infinity > -2147483648,-Infinity > 2147483648,-Infinity > Infinity,-Infinity > -Infinity,-Infinity > NaN],
+    [NaN > true,NaN > false,NaN > null,NaN > void 0,NaN > 0,NaN > 0.0,NaN > -0,NaN > "",NaN > -1,NaN > -1.25,NaN > 1,NaN > 1.25,NaN > -2147483648,NaN > 2147483648,NaN > Infinity,NaN > -Infinity,NaN > NaN]
+  ];
+}
+function test() {
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      var a = values[i];
+      var b = values[j];
+      var x = expected[i][j];
+      assertEquals(x, func(a,b));
+      assertEquals(x, left_funcs[i](b));
+      assertEquals(x, right_funcs[j](a));
+    }
+  }
+
+  var result = matrix();
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      assertEquals(expected[i][j], result[i][j]);
+    }
+  }
+}
+test();
+test();
diff --git a/test/mjsunit/compare-table-gteq.js b/test/mjsunit/compare-table-gteq.js
new file mode 100644 (file)
index 0000000..6d500e4
--- /dev/null
@@ -0,0 +1,105 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var values = [true,false,null,void 0,0,0.0,-0,"",-1,-1.25,1,1.25,-2147483648,2147483648,Infinity,-Infinity,NaN];
+var expected = [
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,false,true ,false,false,true ,false],
+  [false,true ,true ,false,true ,true ,true ,true ,true ,true ,false,false,true ,false,false,true ,false],
+  [false,true ,true ,false,true ,true ,true ,true ,true ,true ,false,false,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
+  [false,true ,true ,false,true ,true ,true ,true ,true ,true ,false,false,true ,false,false,true ,false],
+  [false,true ,true ,false,true ,true ,true ,true ,true ,true ,false,false,true ,false,false,true ,false],
+  [false,true ,true ,false,true ,true ,true ,true ,true ,true ,false,false,true ,false,false,true ,false],
+  [false,true ,true ,false,true ,true ,true ,true ,true ,true ,false,false,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,true ,true ,false,false,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,false,true ,false,false,true ,false,false,true ,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,false,true ,false,false,true ,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,true ,false,false,true ,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]
+];
+var func = (function gteq(a,b) { return a >= b; });
+var left_funcs = [
+  (function gteq_L0(b) { return true >= b; }),
+  (function gteq_L1(b) { return false >= b; }),
+  (function gteq_L2(b) { return null >= b; }),
+  (function gteq_L3(b) { return void 0 >= b; }),
+  (function gteq_L4(b) { return 0 >= b; }),
+  (function gteq_L5(b) { return 0.0 >= b; }),
+  (function gteq_L6(b) { return -0 >= b; }),
+  (function gteq_L7(b) { return "" >= b; }),
+  (function gteq_L8(b) { return -1 >= b; }),
+  (function gteq_L9(b) { return -1.25 >= b; }),
+  (function gteq_L10(b) { return 1 >= b; }),
+  (function gteq_L11(b) { return 1.25 >= b; }),
+  (function gteq_L12(b) { return -2147483648 >= b; }),
+  (function gteq_L13(b) { return 2147483648 >= b; }),
+  (function gteq_L14(b) { return Infinity >= b; }),
+  (function gteq_L15(b) { return -Infinity >= b; }),
+  (function gteq_L16(b) { return NaN >= b; })
+];
+var right_funcs = [
+  (function gteq_R0(a) { return a >= true; }),
+  (function gteq_R1(a) { return a >= false; }),
+  (function gteq_R2(a) { return a >= null; }),
+  (function gteq_R3(a) { return a >= void 0; }),
+  (function gteq_R4(a) { return a >= 0; }),
+  (function gteq_R5(a) { return a >= 0.0; }),
+  (function gteq_R6(a) { return a >= -0; }),
+  (function gteq_R7(a) { return a >= ""; }),
+  (function gteq_R8(a) { return a >= -1; }),
+  (function gteq_R9(a) { return a >= -1.25; }),
+  (function gteq_R10(a) { return a >= 1; }),
+  (function gteq_R11(a) { return a >= 1.25; }),
+  (function gteq_R12(a) { return a >= -2147483648; }),
+  (function gteq_R13(a) { return a >= 2147483648; }),
+  (function gteq_R14(a) { return a >= Infinity; }),
+  (function gteq_R15(a) { return a >= -Infinity; }),
+  (function gteq_R16(a) { return a >= NaN; })
+];
+function matrix() {
+  return [
+    [true >= true,true >= false,true >= null,true >= void 0,true >= 0,true >= 0.0,true >= -0,true >= "",true >= -1,true >= -1.25,true >= 1,true >= 1.25,true >= -2147483648,true >= 2147483648,true >= Infinity,true >= -Infinity,true >= NaN],
+    [false >= true,false >= false,false >= null,false >= void 0,false >= 0,false >= 0.0,false >= -0,false >= "",false >= -1,false >= -1.25,false >= 1,false >= 1.25,false >= -2147483648,false >= 2147483648,false >= Infinity,false >= -Infinity,false >= NaN],
+    [null >= true,null >= false,null >= null,null >= void 0,null >= 0,null >= 0.0,null >= -0,null >= "",null >= -1,null >= -1.25,null >= 1,null >= 1.25,null >= -2147483648,null >= 2147483648,null >= Infinity,null >= -Infinity,null >= NaN],
+    [void 0 >= true,void 0 >= false,void 0 >= null,void 0 >= void 0,void 0 >= 0,void 0 >= 0.0,void 0 >= -0,void 0 >= "",void 0 >= -1,void 0 >= -1.25,void 0 >= 1,void 0 >= 1.25,void 0 >= -2147483648,void 0 >= 2147483648,void 0 >= Infinity,void 0 >= -Infinity,void 0 >= NaN],
+    [0 >= true,0 >= false,0 >= null,0 >= void 0,0 >= 0,0 >= 0.0,0 >= -0,0 >= "",0 >= -1,0 >= -1.25,0 >= 1,0 >= 1.25,0 >= -2147483648,0 >= 2147483648,0 >= Infinity,0 >= -Infinity,0 >= NaN],
+    [0.0 >= true,0.0 >= false,0.0 >= null,0.0 >= void 0,0.0 >= 0,0.0 >= 0.0,0.0 >= -0,0.0 >= "",0.0 >= -1,0.0 >= -1.25,0.0 >= 1,0.0 >= 1.25,0.0 >= -2147483648,0.0 >= 2147483648,0.0 >= Infinity,0.0 >= -Infinity,0.0 >= NaN],
+    [-0 >= true,-0 >= false,-0 >= null,-0 >= void 0,-0 >= 0,-0 >= 0.0,-0 >= -0,-0 >= "",-0 >= -1,-0 >= -1.25,-0 >= 1,-0 >= 1.25,-0 >= -2147483648,-0 >= 2147483648,-0 >= Infinity,-0 >= -Infinity,-0 >= NaN],
+    ["" >= true,"" >= false,"" >= null,"" >= void 0,"" >= 0,"" >= 0.0,"" >= -0,"" >= "","" >= -1,"" >= -1.25,"" >= 1,"" >= 1.25,"" >= -2147483648,"" >= 2147483648,"" >= Infinity,"" >= -Infinity,"" >= NaN],
+    [-1 >= true,-1 >= false,-1 >= null,-1 >= void 0,-1 >= 0,-1 >= 0.0,-1 >= -0,-1 >= "",-1 >= -1,-1 >= -1.25,-1 >= 1,-1 >= 1.25,-1 >= -2147483648,-1 >= 2147483648,-1 >= Infinity,-1 >= -Infinity,-1 >= NaN],
+    [-1.25 >= true,-1.25 >= false,-1.25 >= null,-1.25 >= void 0,-1.25 >= 0,-1.25 >= 0.0,-1.25 >= -0,-1.25 >= "",-1.25 >= -1,-1.25 >= -1.25,-1.25 >= 1,-1.25 >= 1.25,-1.25 >= -2147483648,-1.25 >= 2147483648,-1.25 >= Infinity,-1.25 >= -Infinity,-1.25 >= NaN],
+    [1 >= true,1 >= false,1 >= null,1 >= void 0,1 >= 0,1 >= 0.0,1 >= -0,1 >= "",1 >= -1,1 >= -1.25,1 >= 1,1 >= 1.25,1 >= -2147483648,1 >= 2147483648,1 >= Infinity,1 >= -Infinity,1 >= NaN],
+    [1.25 >= true,1.25 >= false,1.25 >= null,1.25 >= void 0,1.25 >= 0,1.25 >= 0.0,1.25 >= -0,1.25 >= "",1.25 >= -1,1.25 >= -1.25,1.25 >= 1,1.25 >= 1.25,1.25 >= -2147483648,1.25 >= 2147483648,1.25 >= Infinity,1.25 >= -Infinity,1.25 >= NaN],
+    [-2147483648 >= true,-2147483648 >= false,-2147483648 >= null,-2147483648 >= void 0,-2147483648 >= 0,-2147483648 >= 0.0,-2147483648 >= -0,-2147483648 >= "",-2147483648 >= -1,-2147483648 >= -1.25,-2147483648 >= 1,-2147483648 >= 1.25,-2147483648 >= -2147483648,-2147483648 >= 2147483648,-2147483648 >= Infinity,-2147483648 >= -Infinity,-2147483648 >= NaN],
+    [2147483648 >= true,2147483648 >= false,2147483648 >= null,2147483648 >= void 0,2147483648 >= 0,2147483648 >= 0.0,2147483648 >= -0,2147483648 >= "",2147483648 >= -1,2147483648 >= -1.25,2147483648 >= 1,2147483648 >= 1.25,2147483648 >= -2147483648,2147483648 >= 2147483648,2147483648 >= Infinity,2147483648 >= -Infinity,2147483648 >= NaN],
+    [Infinity >= true,Infinity >= false,Infinity >= null,Infinity >= void 0,Infinity >= 0,Infinity >= 0.0,Infinity >= -0,Infinity >= "",Infinity >= -1,Infinity >= -1.25,Infinity >= 1,Infinity >= 1.25,Infinity >= -2147483648,Infinity >= 2147483648,Infinity >= Infinity,Infinity >= -Infinity,Infinity >= NaN],
+    [-Infinity >= true,-Infinity >= false,-Infinity >= null,-Infinity >= void 0,-Infinity >= 0,-Infinity >= 0.0,-Infinity >= -0,-Infinity >= "",-Infinity >= -1,-Infinity >= -1.25,-Infinity >= 1,-Infinity >= 1.25,-Infinity >= -2147483648,-Infinity >= 2147483648,-Infinity >= Infinity,-Infinity >= -Infinity,-Infinity >= NaN],
+    [NaN >= true,NaN >= false,NaN >= null,NaN >= void 0,NaN >= 0,NaN >= 0.0,NaN >= -0,NaN >= "",NaN >= -1,NaN >= -1.25,NaN >= 1,NaN >= 1.25,NaN >= -2147483648,NaN >= 2147483648,NaN >= Infinity,NaN >= -Infinity,NaN >= NaN]
+  ];
+}
+function test() {
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      var a = values[i];
+      var b = values[j];
+      var x = expected[i][j];
+      assertEquals(x, func(a,b));
+      assertEquals(x, left_funcs[i](b));
+      assertEquals(x, right_funcs[j](a));
+    }
+  }
+
+  var result = matrix();
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      assertEquals(expected[i][j], result[i][j]);
+    }
+  }
+}
+test();
+test();
diff --git a/test/mjsunit/compare-table-lt.js b/test/mjsunit/compare-table-lt.js
new file mode 100644 (file)
index 0000000..acb8a22
--- /dev/null
@@ -0,0 +1,105 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var values = [true,false,null,void 0,0,0.0,-0,"",-1,-1.25,1,1.25,-2147483648,2147483648,Infinity,-Infinity,NaN];
+var expected = [
+  [false,false,false,false,false,false,false,false,false,false,false,true ,false,true ,true ,false,false],
+  [true ,false,false,false,false,false,false,false,false,false,true ,true ,false,true ,true ,false,false],
+  [true ,false,false,false,false,false,false,false,false,false,true ,true ,false,true ,true ,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
+  [true ,false,false,false,false,false,false,false,false,false,true ,true ,false,true ,true ,false,false],
+  [true ,false,false,false,false,false,false,false,false,false,true ,true ,false,true ,true ,false,false],
+  [true ,false,false,false,false,false,false,false,false,false,true ,true ,false,true ,true ,false,false],
+  [true ,false,false,false,false,false,false,false,false,false,true ,true ,false,true ,true ,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,false,false,true ,true ,false,true ,true ,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,false,true ,true ,false,true ,true ,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,true ,false,true ,true ,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,true ,true ,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,true ,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]
+];
+var func = (function lt(a,b) { return a < b; });
+var left_funcs = [
+  (function lt_L0(b) { return true < b; }),
+  (function lt_L1(b) { return false < b; }),
+  (function lt_L2(b) { return null < b; }),
+  (function lt_L3(b) { return void 0 < b; }),
+  (function lt_L4(b) { return 0 < b; }),
+  (function lt_L5(b) { return 0.0 < b; }),
+  (function lt_L6(b) { return -0 < b; }),
+  (function lt_L7(b) { return "" < b; }),
+  (function lt_L8(b) { return -1 < b; }),
+  (function lt_L9(b) { return -1.25 < b; }),
+  (function lt_L10(b) { return 1 < b; }),
+  (function lt_L11(b) { return 1.25 < b; }),
+  (function lt_L12(b) { return -2147483648 < b; }),
+  (function lt_L13(b) { return 2147483648 < b; }),
+  (function lt_L14(b) { return Infinity < b; }),
+  (function lt_L15(b) { return -Infinity < b; }),
+  (function lt_L16(b) { return NaN < b; })
+];
+var right_funcs = [
+  (function lt_R0(a) { return a < true; }),
+  (function lt_R1(a) { return a < false; }),
+  (function lt_R2(a) { return a < null; }),
+  (function lt_R3(a) { return a < void 0; }),
+  (function lt_R4(a) { return a < 0; }),
+  (function lt_R5(a) { return a < 0.0; }),
+  (function lt_R6(a) { return a < -0; }),
+  (function lt_R7(a) { return a < ""; }),
+  (function lt_R8(a) { return a < -1; }),
+  (function lt_R9(a) { return a < -1.25; }),
+  (function lt_R10(a) { return a < 1; }),
+  (function lt_R11(a) { return a < 1.25; }),
+  (function lt_R12(a) { return a < -2147483648; }),
+  (function lt_R13(a) { return a < 2147483648; }),
+  (function lt_R14(a) { return a < Infinity; }),
+  (function lt_R15(a) { return a < -Infinity; }),
+  (function lt_R16(a) { return a < NaN; })
+];
+function matrix() {
+  return [
+    [true < true,true < false,true < null,true < void 0,true < 0,true < 0.0,true < -0,true < "",true < -1,true < -1.25,true < 1,true < 1.25,true < -2147483648,true < 2147483648,true < Infinity,true < -Infinity,true < NaN],
+    [false < true,false < false,false < null,false < void 0,false < 0,false < 0.0,false < -0,false < "",false < -1,false < -1.25,false < 1,false < 1.25,false < -2147483648,false < 2147483648,false < Infinity,false < -Infinity,false < NaN],
+    [null < true,null < false,null < null,null < void 0,null < 0,null < 0.0,null < -0,null < "",null < -1,null < -1.25,null < 1,null < 1.25,null < -2147483648,null < 2147483648,null < Infinity,null < -Infinity,null < NaN],
+    [void 0 < true,void 0 < false,void 0 < null,void 0 < void 0,void 0 < 0,void 0 < 0.0,void 0 < -0,void 0 < "",void 0 < -1,void 0 < -1.25,void 0 < 1,void 0 < 1.25,void 0 < -2147483648,void 0 < 2147483648,void 0 < Infinity,void 0 < -Infinity,void 0 < NaN],
+    [0 < true,0 < false,0 < null,0 < void 0,0 < 0,0 < 0.0,0 < -0,0 < "",0 < -1,0 < -1.25,0 < 1,0 < 1.25,0 < -2147483648,0 < 2147483648,0 < Infinity,0 < -Infinity,0 < NaN],
+    [0.0 < true,0.0 < false,0.0 < null,0.0 < void 0,0.0 < 0,0.0 < 0.0,0.0 < -0,0.0 < "",0.0 < -1,0.0 < -1.25,0.0 < 1,0.0 < 1.25,0.0 < -2147483648,0.0 < 2147483648,0.0 < Infinity,0.0 < -Infinity,0.0 < NaN],
+    [-0 < true,-0 < false,-0 < null,-0 < void 0,-0 < 0,-0 < 0.0,-0 < -0,-0 < "",-0 < -1,-0 < -1.25,-0 < 1,-0 < 1.25,-0 < -2147483648,-0 < 2147483648,-0 < Infinity,-0 < -Infinity,-0 < NaN],
+    ["" < true,"" < false,"" < null,"" < void 0,"" < 0,"" < 0.0,"" < -0,"" < "","" < -1,"" < -1.25,"" < 1,"" < 1.25,"" < -2147483648,"" < 2147483648,"" < Infinity,"" < -Infinity,"" < NaN],
+    [-1 < true,-1 < false,-1 < null,-1 < void 0,-1 < 0,-1 < 0.0,-1 < -0,-1 < "",-1 < -1,-1 < -1.25,-1 < 1,-1 < 1.25,-1 < -2147483648,-1 < 2147483648,-1 < Infinity,-1 < -Infinity,-1 < NaN],
+    [-1.25 < true,-1.25 < false,-1.25 < null,-1.25 < void 0,-1.25 < 0,-1.25 < 0.0,-1.25 < -0,-1.25 < "",-1.25 < -1,-1.25 < -1.25,-1.25 < 1,-1.25 < 1.25,-1.25 < -2147483648,-1.25 < 2147483648,-1.25 < Infinity,-1.25 < -Infinity,-1.25 < NaN],
+    [1 < true,1 < false,1 < null,1 < void 0,1 < 0,1 < 0.0,1 < -0,1 < "",1 < -1,1 < -1.25,1 < 1,1 < 1.25,1 < -2147483648,1 < 2147483648,1 < Infinity,1 < -Infinity,1 < NaN],
+    [1.25 < true,1.25 < false,1.25 < null,1.25 < void 0,1.25 < 0,1.25 < 0.0,1.25 < -0,1.25 < "",1.25 < -1,1.25 < -1.25,1.25 < 1,1.25 < 1.25,1.25 < -2147483648,1.25 < 2147483648,1.25 < Infinity,1.25 < -Infinity,1.25 < NaN],
+    [-2147483648 < true,-2147483648 < false,-2147483648 < null,-2147483648 < void 0,-2147483648 < 0,-2147483648 < 0.0,-2147483648 < -0,-2147483648 < "",-2147483648 < -1,-2147483648 < -1.25,-2147483648 < 1,-2147483648 < 1.25,-2147483648 < -2147483648,-2147483648 < 2147483648,-2147483648 < Infinity,-2147483648 < -Infinity,-2147483648 < NaN],
+    [2147483648 < true,2147483648 < false,2147483648 < null,2147483648 < void 0,2147483648 < 0,2147483648 < 0.0,2147483648 < -0,2147483648 < "",2147483648 < -1,2147483648 < -1.25,2147483648 < 1,2147483648 < 1.25,2147483648 < -2147483648,2147483648 < 2147483648,2147483648 < Infinity,2147483648 < -Infinity,2147483648 < NaN],
+    [Infinity < true,Infinity < false,Infinity < null,Infinity < void 0,Infinity < 0,Infinity < 0.0,Infinity < -0,Infinity < "",Infinity < -1,Infinity < -1.25,Infinity < 1,Infinity < 1.25,Infinity < -2147483648,Infinity < 2147483648,Infinity < Infinity,Infinity < -Infinity,Infinity < NaN],
+    [-Infinity < true,-Infinity < false,-Infinity < null,-Infinity < void 0,-Infinity < 0,-Infinity < 0.0,-Infinity < -0,-Infinity < "",-Infinity < -1,-Infinity < -1.25,-Infinity < 1,-Infinity < 1.25,-Infinity < -2147483648,-Infinity < 2147483648,-Infinity < Infinity,-Infinity < -Infinity,-Infinity < NaN],
+    [NaN < true,NaN < false,NaN < null,NaN < void 0,NaN < 0,NaN < 0.0,NaN < -0,NaN < "",NaN < -1,NaN < -1.25,NaN < 1,NaN < 1.25,NaN < -2147483648,NaN < 2147483648,NaN < Infinity,NaN < -Infinity,NaN < NaN]
+  ];
+}
+function test() {
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      var a = values[i];
+      var b = values[j];
+      var x = expected[i][j];
+      assertEquals(x, func(a,b));
+      assertEquals(x, left_funcs[i](b));
+      assertEquals(x, right_funcs[j](a));
+    }
+  }
+
+  var result = matrix();
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      assertEquals(expected[i][j], result[i][j]);
+    }
+  }
+}
+test();
+test();
diff --git a/test/mjsunit/compare-table-lteq.js b/test/mjsunit/compare-table-lteq.js
new file mode 100644 (file)
index 0000000..164f26a
--- /dev/null
@@ -0,0 +1,105 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var values = [true,false,null,void 0,0,0.0,-0,"",-1,-1.25,1,1.25,-2147483648,2147483648,Infinity,-Infinity,NaN];
+var expected = [
+  [true ,false,false,false,false,false,false,false,false,false,true ,true ,false,true ,true ,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,false,false,true ,true ,false,true ,true ,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,false,false,true ,true ,false,true ,true ,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,false,false,true ,true ,false,true ,true ,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,false,false,true ,true ,false,true ,true ,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,false,false,true ,true ,false,true ,true ,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,false,false,true ,true ,false,true ,true ,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,false,true ,true ,false,true ,true ,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,false,false],
+  [true ,false,false,false,false,false,false,false,false,false,true ,true ,false,true ,true ,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,true ,false,true ,true ,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,true ,true ,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,true ,false,false],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]
+];
+var func = (function lteq(a,b) { return a <= b; });
+var left_funcs = [
+  (function lteq_L0(b) { return true <= b; }),
+  (function lteq_L1(b) { return false <= b; }),
+  (function lteq_L2(b) { return null <= b; }),
+  (function lteq_L3(b) { return void 0 <= b; }),
+  (function lteq_L4(b) { return 0 <= b; }),
+  (function lteq_L5(b) { return 0.0 <= b; }),
+  (function lteq_L6(b) { return -0 <= b; }),
+  (function lteq_L7(b) { return "" <= b; }),
+  (function lteq_L8(b) { return -1 <= b; }),
+  (function lteq_L9(b) { return -1.25 <= b; }),
+  (function lteq_L10(b) { return 1 <= b; }),
+  (function lteq_L11(b) { return 1.25 <= b; }),
+  (function lteq_L12(b) { return -2147483648 <= b; }),
+  (function lteq_L13(b) { return 2147483648 <= b; }),
+  (function lteq_L14(b) { return Infinity <= b; }),
+  (function lteq_L15(b) { return -Infinity <= b; }),
+  (function lteq_L16(b) { return NaN <= b; })
+];
+var right_funcs = [
+  (function lteq_R0(a) { return a <= true; }),
+  (function lteq_R1(a) { return a <= false; }),
+  (function lteq_R2(a) { return a <= null; }),
+  (function lteq_R3(a) { return a <= void 0; }),
+  (function lteq_R4(a) { return a <= 0; }),
+  (function lteq_R5(a) { return a <= 0.0; }),
+  (function lteq_R6(a) { return a <= -0; }),
+  (function lteq_R7(a) { return a <= ""; }),
+  (function lteq_R8(a) { return a <= -1; }),
+  (function lteq_R9(a) { return a <= -1.25; }),
+  (function lteq_R10(a) { return a <= 1; }),
+  (function lteq_R11(a) { return a <= 1.25; }),
+  (function lteq_R12(a) { return a <= -2147483648; }),
+  (function lteq_R13(a) { return a <= 2147483648; }),
+  (function lteq_R14(a) { return a <= Infinity; }),
+  (function lteq_R15(a) { return a <= -Infinity; }),
+  (function lteq_R16(a) { return a <= NaN; })
+];
+function matrix() {
+  return [
+    [true <= true,true <= false,true <= null,true <= void 0,true <= 0,true <= 0.0,true <= -0,true <= "",true <= -1,true <= -1.25,true <= 1,true <= 1.25,true <= -2147483648,true <= 2147483648,true <= Infinity,true <= -Infinity,true <= NaN],
+    [false <= true,false <= false,false <= null,false <= void 0,false <= 0,false <= 0.0,false <= -0,false <= "",false <= -1,false <= -1.25,false <= 1,false <= 1.25,false <= -2147483648,false <= 2147483648,false <= Infinity,false <= -Infinity,false <= NaN],
+    [null <= true,null <= false,null <= null,null <= void 0,null <= 0,null <= 0.0,null <= -0,null <= "",null <= -1,null <= -1.25,null <= 1,null <= 1.25,null <= -2147483648,null <= 2147483648,null <= Infinity,null <= -Infinity,null <= NaN],
+    [void 0 <= true,void 0 <= false,void 0 <= null,void 0 <= void 0,void 0 <= 0,void 0 <= 0.0,void 0 <= -0,void 0 <= "",void 0 <= -1,void 0 <= -1.25,void 0 <= 1,void 0 <= 1.25,void 0 <= -2147483648,void 0 <= 2147483648,void 0 <= Infinity,void 0 <= -Infinity,void 0 <= NaN],
+    [0 <= true,0 <= false,0 <= null,0 <= void 0,0 <= 0,0 <= 0.0,0 <= -0,0 <= "",0 <= -1,0 <= -1.25,0 <= 1,0 <= 1.25,0 <= -2147483648,0 <= 2147483648,0 <= Infinity,0 <= -Infinity,0 <= NaN],
+    [0.0 <= true,0.0 <= false,0.0 <= null,0.0 <= void 0,0.0 <= 0,0.0 <= 0.0,0.0 <= -0,0.0 <= "",0.0 <= -1,0.0 <= -1.25,0.0 <= 1,0.0 <= 1.25,0.0 <= -2147483648,0.0 <= 2147483648,0.0 <= Infinity,0.0 <= -Infinity,0.0 <= NaN],
+    [-0 <= true,-0 <= false,-0 <= null,-0 <= void 0,-0 <= 0,-0 <= 0.0,-0 <= -0,-0 <= "",-0 <= -1,-0 <= -1.25,-0 <= 1,-0 <= 1.25,-0 <= -2147483648,-0 <= 2147483648,-0 <= Infinity,-0 <= -Infinity,-0 <= NaN],
+    ["" <= true,"" <= false,"" <= null,"" <= void 0,"" <= 0,"" <= 0.0,"" <= -0,"" <= "","" <= -1,"" <= -1.25,"" <= 1,"" <= 1.25,"" <= -2147483648,"" <= 2147483648,"" <= Infinity,"" <= -Infinity,"" <= NaN],
+    [-1 <= true,-1 <= false,-1 <= null,-1 <= void 0,-1 <= 0,-1 <= 0.0,-1 <= -0,-1 <= "",-1 <= -1,-1 <= -1.25,-1 <= 1,-1 <= 1.25,-1 <= -2147483648,-1 <= 2147483648,-1 <= Infinity,-1 <= -Infinity,-1 <= NaN],
+    [-1.25 <= true,-1.25 <= false,-1.25 <= null,-1.25 <= void 0,-1.25 <= 0,-1.25 <= 0.0,-1.25 <= -0,-1.25 <= "",-1.25 <= -1,-1.25 <= -1.25,-1.25 <= 1,-1.25 <= 1.25,-1.25 <= -2147483648,-1.25 <= 2147483648,-1.25 <= Infinity,-1.25 <= -Infinity,-1.25 <= NaN],
+    [1 <= true,1 <= false,1 <= null,1 <= void 0,1 <= 0,1 <= 0.0,1 <= -0,1 <= "",1 <= -1,1 <= -1.25,1 <= 1,1 <= 1.25,1 <= -2147483648,1 <= 2147483648,1 <= Infinity,1 <= -Infinity,1 <= NaN],
+    [1.25 <= true,1.25 <= false,1.25 <= null,1.25 <= void 0,1.25 <= 0,1.25 <= 0.0,1.25 <= -0,1.25 <= "",1.25 <= -1,1.25 <= -1.25,1.25 <= 1,1.25 <= 1.25,1.25 <= -2147483648,1.25 <= 2147483648,1.25 <= Infinity,1.25 <= -Infinity,1.25 <= NaN],
+    [-2147483648 <= true,-2147483648 <= false,-2147483648 <= null,-2147483648 <= void 0,-2147483648 <= 0,-2147483648 <= 0.0,-2147483648 <= -0,-2147483648 <= "",-2147483648 <= -1,-2147483648 <= -1.25,-2147483648 <= 1,-2147483648 <= 1.25,-2147483648 <= -2147483648,-2147483648 <= 2147483648,-2147483648 <= Infinity,-2147483648 <= -Infinity,-2147483648 <= NaN],
+    [2147483648 <= true,2147483648 <= false,2147483648 <= null,2147483648 <= void 0,2147483648 <= 0,2147483648 <= 0.0,2147483648 <= -0,2147483648 <= "",2147483648 <= -1,2147483648 <= -1.25,2147483648 <= 1,2147483648 <= 1.25,2147483648 <= -2147483648,2147483648 <= 2147483648,2147483648 <= Infinity,2147483648 <= -Infinity,2147483648 <= NaN],
+    [Infinity <= true,Infinity <= false,Infinity <= null,Infinity <= void 0,Infinity <= 0,Infinity <= 0.0,Infinity <= -0,Infinity <= "",Infinity <= -1,Infinity <= -1.25,Infinity <= 1,Infinity <= 1.25,Infinity <= -2147483648,Infinity <= 2147483648,Infinity <= Infinity,Infinity <= -Infinity,Infinity <= NaN],
+    [-Infinity <= true,-Infinity <= false,-Infinity <= null,-Infinity <= void 0,-Infinity <= 0,-Infinity <= 0.0,-Infinity <= -0,-Infinity <= "",-Infinity <= -1,-Infinity <= -1.25,-Infinity <= 1,-Infinity <= 1.25,-Infinity <= -2147483648,-Infinity <= 2147483648,-Infinity <= Infinity,-Infinity <= -Infinity,-Infinity <= NaN],
+    [NaN <= true,NaN <= false,NaN <= null,NaN <= void 0,NaN <= 0,NaN <= 0.0,NaN <= -0,NaN <= "",NaN <= -1,NaN <= -1.25,NaN <= 1,NaN <= 1.25,NaN <= -2147483648,NaN <= 2147483648,NaN <= Infinity,NaN <= -Infinity,NaN <= NaN]
+  ];
+}
+function test() {
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      var a = values[i];
+      var b = values[j];
+      var x = expected[i][j];
+      assertEquals(x, func(a,b));
+      assertEquals(x, left_funcs[i](b));
+      assertEquals(x, right_funcs[j](a));
+    }
+  }
+
+  var result = matrix();
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      assertEquals(expected[i][j], result[i][j]);
+    }
+  }
+}
+test();
+test();
diff --git a/test/mjsunit/compare-table-ne.js b/test/mjsunit/compare-table-ne.js
new file mode 100644 (file)
index 0000000..0dd5b51
--- /dev/null
@@ -0,0 +1,105 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var values = [true,false,null,void 0,0,0.0,-0,"",-1,-1.25,1,1.25,-2147483648,2147483648,Infinity,-Infinity,NaN];
+var expected = [
+  [false,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,true ],
+  [true ,false,true ,true ,false,false,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,false,true ,true ,false,false,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,false,true ,true ,false,false,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,false,true ,true ,false,false,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,false,true ,true ,false,false,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ],
+  [false,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ]
+];
+var func = (function ne(a,b) { return a != b; });
+var left_funcs = [
+  (function ne_L0(b) { return true != b; }),
+  (function ne_L1(b) { return false != b; }),
+  (function ne_L2(b) { return null != b; }),
+  (function ne_L3(b) { return void 0 != b; }),
+  (function ne_L4(b) { return 0 != b; }),
+  (function ne_L5(b) { return 0.0 != b; }),
+  (function ne_L6(b) { return -0 != b; }),
+  (function ne_L7(b) { return "" != b; }),
+  (function ne_L8(b) { return -1 != b; }),
+  (function ne_L9(b) { return -1.25 != b; }),
+  (function ne_L10(b) { return 1 != b; }),
+  (function ne_L11(b) { return 1.25 != b; }),
+  (function ne_L12(b) { return -2147483648 != b; }),
+  (function ne_L13(b) { return 2147483648 != b; }),
+  (function ne_L14(b) { return Infinity != b; }),
+  (function ne_L15(b) { return -Infinity != b; }),
+  (function ne_L16(b) { return NaN != b; })
+];
+var right_funcs = [
+  (function ne_R0(a) { return a != true; }),
+  (function ne_R1(a) { return a != false; }),
+  (function ne_R2(a) { return a != null; }),
+  (function ne_R3(a) { return a != void 0; }),
+  (function ne_R4(a) { return a != 0; }),
+  (function ne_R5(a) { return a != 0.0; }),
+  (function ne_R6(a) { return a != -0; }),
+  (function ne_R7(a) { return a != ""; }),
+  (function ne_R8(a) { return a != -1; }),
+  (function ne_R9(a) { return a != -1.25; }),
+  (function ne_R10(a) { return a != 1; }),
+  (function ne_R11(a) { return a != 1.25; }),
+  (function ne_R12(a) { return a != -2147483648; }),
+  (function ne_R13(a) { return a != 2147483648; }),
+  (function ne_R14(a) { return a != Infinity; }),
+  (function ne_R15(a) { return a != -Infinity; }),
+  (function ne_R16(a) { return a != NaN; })
+];
+function matrix() {
+  return [
+    [true != true,true != false,true != null,true != void 0,true != 0,true != 0.0,true != -0,true != "",true != -1,true != -1.25,true != 1,true != 1.25,true != -2147483648,true != 2147483648,true != Infinity,true != -Infinity,true != NaN],
+    [false != true,false != false,false != null,false != void 0,false != 0,false != 0.0,false != -0,false != "",false != -1,false != -1.25,false != 1,false != 1.25,false != -2147483648,false != 2147483648,false != Infinity,false != -Infinity,false != NaN],
+    [null != true,null != false,null != null,null != void 0,null != 0,null != 0.0,null != -0,null != "",null != -1,null != -1.25,null != 1,null != 1.25,null != -2147483648,null != 2147483648,null != Infinity,null != -Infinity,null != NaN],
+    [void 0 != true,void 0 != false,void 0 != null,void 0 != void 0,void 0 != 0,void 0 != 0.0,void 0 != -0,void 0 != "",void 0 != -1,void 0 != -1.25,void 0 != 1,void 0 != 1.25,void 0 != -2147483648,void 0 != 2147483648,void 0 != Infinity,void 0 != -Infinity,void 0 != NaN],
+    [0 != true,0 != false,0 != null,0 != void 0,0 != 0,0 != 0.0,0 != -0,0 != "",0 != -1,0 != -1.25,0 != 1,0 != 1.25,0 != -2147483648,0 != 2147483648,0 != Infinity,0 != -Infinity,0 != NaN],
+    [0.0 != true,0.0 != false,0.0 != null,0.0 != void 0,0.0 != 0,0.0 != 0.0,0.0 != -0,0.0 != "",0.0 != -1,0.0 != -1.25,0.0 != 1,0.0 != 1.25,0.0 != -2147483648,0.0 != 2147483648,0.0 != Infinity,0.0 != -Infinity,0.0 != NaN],
+    [-0 != true,-0 != false,-0 != null,-0 != void 0,-0 != 0,-0 != 0.0,-0 != -0,-0 != "",-0 != -1,-0 != -1.25,-0 != 1,-0 != 1.25,-0 != -2147483648,-0 != 2147483648,-0 != Infinity,-0 != -Infinity,-0 != NaN],
+    ["" != true,"" != false,"" != null,"" != void 0,"" != 0,"" != 0.0,"" != -0,"" != "","" != -1,"" != -1.25,"" != 1,"" != 1.25,"" != -2147483648,"" != 2147483648,"" != Infinity,"" != -Infinity,"" != NaN],
+    [-1 != true,-1 != false,-1 != null,-1 != void 0,-1 != 0,-1 != 0.0,-1 != -0,-1 != "",-1 != -1,-1 != -1.25,-1 != 1,-1 != 1.25,-1 != -2147483648,-1 != 2147483648,-1 != Infinity,-1 != -Infinity,-1 != NaN],
+    [-1.25 != true,-1.25 != false,-1.25 != null,-1.25 != void 0,-1.25 != 0,-1.25 != 0.0,-1.25 != -0,-1.25 != "",-1.25 != -1,-1.25 != -1.25,-1.25 != 1,-1.25 != 1.25,-1.25 != -2147483648,-1.25 != 2147483648,-1.25 != Infinity,-1.25 != -Infinity,-1.25 != NaN],
+    [1 != true,1 != false,1 != null,1 != void 0,1 != 0,1 != 0.0,1 != -0,1 != "",1 != -1,1 != -1.25,1 != 1,1 != 1.25,1 != -2147483648,1 != 2147483648,1 != Infinity,1 != -Infinity,1 != NaN],
+    [1.25 != true,1.25 != false,1.25 != null,1.25 != void 0,1.25 != 0,1.25 != 0.0,1.25 != -0,1.25 != "",1.25 != -1,1.25 != -1.25,1.25 != 1,1.25 != 1.25,1.25 != -2147483648,1.25 != 2147483648,1.25 != Infinity,1.25 != -Infinity,1.25 != NaN],
+    [-2147483648 != true,-2147483648 != false,-2147483648 != null,-2147483648 != void 0,-2147483648 != 0,-2147483648 != 0.0,-2147483648 != -0,-2147483648 != "",-2147483648 != -1,-2147483648 != -1.25,-2147483648 != 1,-2147483648 != 1.25,-2147483648 != -2147483648,-2147483648 != 2147483648,-2147483648 != Infinity,-2147483648 != -Infinity,-2147483648 != NaN],
+    [2147483648 != true,2147483648 != false,2147483648 != null,2147483648 != void 0,2147483648 != 0,2147483648 != 0.0,2147483648 != -0,2147483648 != "",2147483648 != -1,2147483648 != -1.25,2147483648 != 1,2147483648 != 1.25,2147483648 != -2147483648,2147483648 != 2147483648,2147483648 != Infinity,2147483648 != -Infinity,2147483648 != NaN],
+    [Infinity != true,Infinity != false,Infinity != null,Infinity != void 0,Infinity != 0,Infinity != 0.0,Infinity != -0,Infinity != "",Infinity != -1,Infinity != -1.25,Infinity != 1,Infinity != 1.25,Infinity != -2147483648,Infinity != 2147483648,Infinity != Infinity,Infinity != -Infinity,Infinity != NaN],
+    [-Infinity != true,-Infinity != false,-Infinity != null,-Infinity != void 0,-Infinity != 0,-Infinity != 0.0,-Infinity != -0,-Infinity != "",-Infinity != -1,-Infinity != -1.25,-Infinity != 1,-Infinity != 1.25,-Infinity != -2147483648,-Infinity != 2147483648,-Infinity != Infinity,-Infinity != -Infinity,-Infinity != NaN],
+    [NaN != true,NaN != false,NaN != null,NaN != void 0,NaN != 0,NaN != 0.0,NaN != -0,NaN != "",NaN != -1,NaN != -1.25,NaN != 1,NaN != 1.25,NaN != -2147483648,NaN != 2147483648,NaN != Infinity,NaN != -Infinity,NaN != NaN]
+  ];
+}
+function test() {
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      var a = values[i];
+      var b = values[j];
+      var x = expected[i][j];
+      assertEquals(x, func(a,b));
+      assertEquals(x, left_funcs[i](b));
+      assertEquals(x, right_funcs[j](a));
+    }
+  }
+
+  var result = matrix();
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      assertEquals(expected[i][j], result[i][j]);
+    }
+  }
+}
+test();
+test();
diff --git a/test/mjsunit/compare-table-seq.js b/test/mjsunit/compare-table-seq.js
new file mode 100644 (file)
index 0000000..524024b
--- /dev/null
@@ -0,0 +1,105 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var values = [true,false,null,void 0,0,0.0,-0,"",-1,-1.25,1,1.25,-2147483648,2147483648,Infinity,-Infinity,NaN];
+var expected = [
+  [true ,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
+  [false,true ,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
+  [false,false,true ,false,false,false,false,false,false,false,false,false,false,false,false,false,false],
+  [false,false,false,true ,false,false,false,false,false,false,false,false,false,false,false,false,false],
+  [false,false,false,false,true ,true ,true ,false,false,false,false,false,false,false,false,false,false],
+  [false,false,false,false,true ,true ,true ,false,false,false,false,false,false,false,false,false,false],
+  [false,false,false,false,true ,true ,true ,false,false,false,false,false,false,false,false,false,false],
+  [false,false,false,false,false,false,false,true ,false,false,false,false,false,false,false,false,false],
+  [false,false,false,false,false,false,false,false,true ,false,false,false,false,false,false,false,false],
+  [false,false,false,false,false,false,false,false,false,true ,false,false,false,false,false,false,false],
+  [false,false,false,false,false,false,false,false,false,false,true ,false,false,false,false,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,true ,false,false,false,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,true ,false,false,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,true ,false,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,true ,false,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,true ,false],
+  [false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false]
+];
+var func = (function seq(a,b) { return a === b; });
+var left_funcs = [
+  (function seq_L0(b) { return true === b; }),
+  (function seq_L1(b) { return false === b; }),
+  (function seq_L2(b) { return null === b; }),
+  (function seq_L3(b) { return void 0 === b; }),
+  (function seq_L4(b) { return 0 === b; }),
+  (function seq_L5(b) { return 0.0 === b; }),
+  (function seq_L6(b) { return -0 === b; }),
+  (function seq_L7(b) { return "" === b; }),
+  (function seq_L8(b) { return -1 === b; }),
+  (function seq_L9(b) { return -1.25 === b; }),
+  (function seq_L10(b) { return 1 === b; }),
+  (function seq_L11(b) { return 1.25 === b; }),
+  (function seq_L12(b) { return -2147483648 === b; }),
+  (function seq_L13(b) { return 2147483648 === b; }),
+  (function seq_L14(b) { return Infinity === b; }),
+  (function seq_L15(b) { return -Infinity === b; }),
+  (function seq_L16(b) { return NaN === b; })
+];
+var right_funcs = [
+  (function seq_R0(a) { return a === true; }),
+  (function seq_R1(a) { return a === false; }),
+  (function seq_R2(a) { return a === null; }),
+  (function seq_R3(a) { return a === void 0; }),
+  (function seq_R4(a) { return a === 0; }),
+  (function seq_R5(a) { return a === 0.0; }),
+  (function seq_R6(a) { return a === -0; }),
+  (function seq_R7(a) { return a === ""; }),
+  (function seq_R8(a) { return a === -1; }),
+  (function seq_R9(a) { return a === -1.25; }),
+  (function seq_R10(a) { return a === 1; }),
+  (function seq_R11(a) { return a === 1.25; }),
+  (function seq_R12(a) { return a === -2147483648; }),
+  (function seq_R13(a) { return a === 2147483648; }),
+  (function seq_R14(a) { return a === Infinity; }),
+  (function seq_R15(a) { return a === -Infinity; }),
+  (function seq_R16(a) { return a === NaN; })
+];
+function matrix() {
+  return [
+    [true === true,true === false,true === null,true === void 0,true === 0,true === 0.0,true === -0,true === "",true === -1,true === -1.25,true === 1,true === 1.25,true === -2147483648,true === 2147483648,true === Infinity,true === -Infinity,true === NaN],
+    [false === true,false === false,false === null,false === void 0,false === 0,false === 0.0,false === -0,false === "",false === -1,false === -1.25,false === 1,false === 1.25,false === -2147483648,false === 2147483648,false === Infinity,false === -Infinity,false === NaN],
+    [null === true,null === false,null === null,null === void 0,null === 0,null === 0.0,null === -0,null === "",null === -1,null === -1.25,null === 1,null === 1.25,null === -2147483648,null === 2147483648,null === Infinity,null === -Infinity,null === NaN],
+    [void 0 === true,void 0 === false,void 0 === null,void 0 === void 0,void 0 === 0,void 0 === 0.0,void 0 === -0,void 0 === "",void 0 === -1,void 0 === -1.25,void 0 === 1,void 0 === 1.25,void 0 === -2147483648,void 0 === 2147483648,void 0 === Infinity,void 0 === -Infinity,void 0 === NaN],
+    [0 === true,0 === false,0 === null,0 === void 0,0 === 0,0 === 0.0,0 === -0,0 === "",0 === -1,0 === -1.25,0 === 1,0 === 1.25,0 === -2147483648,0 === 2147483648,0 === Infinity,0 === -Infinity,0 === NaN],
+    [0.0 === true,0.0 === false,0.0 === null,0.0 === void 0,0.0 === 0,0.0 === 0.0,0.0 === -0,0.0 === "",0.0 === -1,0.0 === -1.25,0.0 === 1,0.0 === 1.25,0.0 === -2147483648,0.0 === 2147483648,0.0 === Infinity,0.0 === -Infinity,0.0 === NaN],
+    [-0 === true,-0 === false,-0 === null,-0 === void 0,-0 === 0,-0 === 0.0,-0 === -0,-0 === "",-0 === -1,-0 === -1.25,-0 === 1,-0 === 1.25,-0 === -2147483648,-0 === 2147483648,-0 === Infinity,-0 === -Infinity,-0 === NaN],
+    ["" === true,"" === false,"" === null,"" === void 0,"" === 0,"" === 0.0,"" === -0,"" === "","" === -1,"" === -1.25,"" === 1,"" === 1.25,"" === -2147483648,"" === 2147483648,"" === Infinity,"" === -Infinity,"" === NaN],
+    [-1 === true,-1 === false,-1 === null,-1 === void 0,-1 === 0,-1 === 0.0,-1 === -0,-1 === "",-1 === -1,-1 === -1.25,-1 === 1,-1 === 1.25,-1 === -2147483648,-1 === 2147483648,-1 === Infinity,-1 === -Infinity,-1 === NaN],
+    [-1.25 === true,-1.25 === false,-1.25 === null,-1.25 === void 0,-1.25 === 0,-1.25 === 0.0,-1.25 === -0,-1.25 === "",-1.25 === -1,-1.25 === -1.25,-1.25 === 1,-1.25 === 1.25,-1.25 === -2147483648,-1.25 === 2147483648,-1.25 === Infinity,-1.25 === -Infinity,-1.25 === NaN],
+    [1 === true,1 === false,1 === null,1 === void 0,1 === 0,1 === 0.0,1 === -0,1 === "",1 === -1,1 === -1.25,1 === 1,1 === 1.25,1 === -2147483648,1 === 2147483648,1 === Infinity,1 === -Infinity,1 === NaN],
+    [1.25 === true,1.25 === false,1.25 === null,1.25 === void 0,1.25 === 0,1.25 === 0.0,1.25 === -0,1.25 === "",1.25 === -1,1.25 === -1.25,1.25 === 1,1.25 === 1.25,1.25 === -2147483648,1.25 === 2147483648,1.25 === Infinity,1.25 === -Infinity,1.25 === NaN],
+    [-2147483648 === true,-2147483648 === false,-2147483648 === null,-2147483648 === void 0,-2147483648 === 0,-2147483648 === 0.0,-2147483648 === -0,-2147483648 === "",-2147483648 === -1,-2147483648 === -1.25,-2147483648 === 1,-2147483648 === 1.25,-2147483648 === -2147483648,-2147483648 === 2147483648,-2147483648 === Infinity,-2147483648 === -Infinity,-2147483648 === NaN],
+    [2147483648 === true,2147483648 === false,2147483648 === null,2147483648 === void 0,2147483648 === 0,2147483648 === 0.0,2147483648 === -0,2147483648 === "",2147483648 === -1,2147483648 === -1.25,2147483648 === 1,2147483648 === 1.25,2147483648 === -2147483648,2147483648 === 2147483648,2147483648 === Infinity,2147483648 === -Infinity,2147483648 === NaN],
+    [Infinity === true,Infinity === false,Infinity === null,Infinity === void 0,Infinity === 0,Infinity === 0.0,Infinity === -0,Infinity === "",Infinity === -1,Infinity === -1.25,Infinity === 1,Infinity === 1.25,Infinity === -2147483648,Infinity === 2147483648,Infinity === Infinity,Infinity === -Infinity,Infinity === NaN],
+    [-Infinity === true,-Infinity === false,-Infinity === null,-Infinity === void 0,-Infinity === 0,-Infinity === 0.0,-Infinity === -0,-Infinity === "",-Infinity === -1,-Infinity === -1.25,-Infinity === 1,-Infinity === 1.25,-Infinity === -2147483648,-Infinity === 2147483648,-Infinity === Infinity,-Infinity === -Infinity,-Infinity === NaN],
+    [NaN === true,NaN === false,NaN === null,NaN === void 0,NaN === 0,NaN === 0.0,NaN === -0,NaN === "",NaN === -1,NaN === -1.25,NaN === 1,NaN === 1.25,NaN === -2147483648,NaN === 2147483648,NaN === Infinity,NaN === -Infinity,NaN === NaN]
+  ];
+}
+function test() {
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      var a = values[i];
+      var b = values[j];
+      var x = expected[i][j];
+      assertEquals(x, func(a,b));
+      assertEquals(x, left_funcs[i](b));
+      assertEquals(x, right_funcs[j](a));
+    }
+  }
+
+  var result = matrix();
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      assertEquals(expected[i][j], result[i][j]);
+    }
+  }
+}
+test();
+test();
diff --git a/test/mjsunit/compare-table-sne.js b/test/mjsunit/compare-table-sne.js
new file mode 100644 (file)
index 0000000..b9c8071
--- /dev/null
@@ -0,0 +1,105 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var values = [true,false,null,void 0,0,0.0,-0,"",-1,-1.25,1,1.25,-2147483648,2147483648,Infinity,-Infinity,NaN];
+var expected = [
+  [false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,false,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,false,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,false,false,false,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,false,true ],
+  [true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ,true ]
+];
+var func = (function sne(a,b) { return a !== b; });
+var left_funcs = [
+  (function sne_L0(b) { return true !== b; }),
+  (function sne_L1(b) { return false !== b; }),
+  (function sne_L2(b) { return null !== b; }),
+  (function sne_L3(b) { return void 0 !== b; }),
+  (function sne_L4(b) { return 0 !== b; }),
+  (function sne_L5(b) { return 0.0 !== b; }),
+  (function sne_L6(b) { return -0 !== b; }),
+  (function sne_L7(b) { return "" !== b; }),
+  (function sne_L8(b) { return -1 !== b; }),
+  (function sne_L9(b) { return -1.25 !== b; }),
+  (function sne_L10(b) { return 1 !== b; }),
+  (function sne_L11(b) { return 1.25 !== b; }),
+  (function sne_L12(b) { return -2147483648 !== b; }),
+  (function sne_L13(b) { return 2147483648 !== b; }),
+  (function sne_L14(b) { return Infinity !== b; }),
+  (function sne_L15(b) { return -Infinity !== b; }),
+  (function sne_L16(b) { return NaN !== b; })
+];
+var right_funcs = [
+  (function sne_R0(a) { return a !== true; }),
+  (function sne_R1(a) { return a !== false; }),
+  (function sne_R2(a) { return a !== null; }),
+  (function sne_R3(a) { return a !== void 0; }),
+  (function sne_R4(a) { return a !== 0; }),
+  (function sne_R5(a) { return a !== 0.0; }),
+  (function sne_R6(a) { return a !== -0; }),
+  (function sne_R7(a) { return a !== ""; }),
+  (function sne_R8(a) { return a !== -1; }),
+  (function sne_R9(a) { return a !== -1.25; }),
+  (function sne_R10(a) { return a !== 1; }),
+  (function sne_R11(a) { return a !== 1.25; }),
+  (function sne_R12(a) { return a !== -2147483648; }),
+  (function sne_R13(a) { return a !== 2147483648; }),
+  (function sne_R14(a) { return a !== Infinity; }),
+  (function sne_R15(a) { return a !== -Infinity; }),
+  (function sne_R16(a) { return a !== NaN; })
+];
+function matrix() {
+  return [
+    [true !== true,true !== false,true !== null,true !== void 0,true !== 0,true !== 0.0,true !== -0,true !== "",true !== -1,true !== -1.25,true !== 1,true !== 1.25,true !== -2147483648,true !== 2147483648,true !== Infinity,true !== -Infinity,true !== NaN],
+    [false !== true,false !== false,false !== null,false !== void 0,false !== 0,false !== 0.0,false !== -0,false !== "",false !== -1,false !== -1.25,false !== 1,false !== 1.25,false !== -2147483648,false !== 2147483648,false !== Infinity,false !== -Infinity,false !== NaN],
+    [null !== true,null !== false,null !== null,null !== void 0,null !== 0,null !== 0.0,null !== -0,null !== "",null !== -1,null !== -1.25,null !== 1,null !== 1.25,null !== -2147483648,null !== 2147483648,null !== Infinity,null !== -Infinity,null !== NaN],
+    [void 0 !== true,void 0 !== false,void 0 !== null,void 0 !== void 0,void 0 !== 0,void 0 !== 0.0,void 0 !== -0,void 0 !== "",void 0 !== -1,void 0 !== -1.25,void 0 !== 1,void 0 !== 1.25,void 0 !== -2147483648,void 0 !== 2147483648,void 0 !== Infinity,void 0 !== -Infinity,void 0 !== NaN],
+    [0 !== true,0 !== false,0 !== null,0 !== void 0,0 !== 0,0 !== 0.0,0 !== -0,0 !== "",0 !== -1,0 !== -1.25,0 !== 1,0 !== 1.25,0 !== -2147483648,0 !== 2147483648,0 !== Infinity,0 !== -Infinity,0 !== NaN],
+    [0.0 !== true,0.0 !== false,0.0 !== null,0.0 !== void 0,0.0 !== 0,0.0 !== 0.0,0.0 !== -0,0.0 !== "",0.0 !== -1,0.0 !== -1.25,0.0 !== 1,0.0 !== 1.25,0.0 !== -2147483648,0.0 !== 2147483648,0.0 !== Infinity,0.0 !== -Infinity,0.0 !== NaN],
+    [-0 !== true,-0 !== false,-0 !== null,-0 !== void 0,-0 !== 0,-0 !== 0.0,-0 !== -0,-0 !== "",-0 !== -1,-0 !== -1.25,-0 !== 1,-0 !== 1.25,-0 !== -2147483648,-0 !== 2147483648,-0 !== Infinity,-0 !== -Infinity,-0 !== NaN],
+    ["" !== true,"" !== false,"" !== null,"" !== void 0,"" !== 0,"" !== 0.0,"" !== -0,"" !== "","" !== -1,"" !== -1.25,"" !== 1,"" !== 1.25,"" !== -2147483648,"" !== 2147483648,"" !== Infinity,"" !== -Infinity,"" !== NaN],
+    [-1 !== true,-1 !== false,-1 !== null,-1 !== void 0,-1 !== 0,-1 !== 0.0,-1 !== -0,-1 !== "",-1 !== -1,-1 !== -1.25,-1 !== 1,-1 !== 1.25,-1 !== -2147483648,-1 !== 2147483648,-1 !== Infinity,-1 !== -Infinity,-1 !== NaN],
+    [-1.25 !== true,-1.25 !== false,-1.25 !== null,-1.25 !== void 0,-1.25 !== 0,-1.25 !== 0.0,-1.25 !== -0,-1.25 !== "",-1.25 !== -1,-1.25 !== -1.25,-1.25 !== 1,-1.25 !== 1.25,-1.25 !== -2147483648,-1.25 !== 2147483648,-1.25 !== Infinity,-1.25 !== -Infinity,-1.25 !== NaN],
+    [1 !== true,1 !== false,1 !== null,1 !== void 0,1 !== 0,1 !== 0.0,1 !== -0,1 !== "",1 !== -1,1 !== -1.25,1 !== 1,1 !== 1.25,1 !== -2147483648,1 !== 2147483648,1 !== Infinity,1 !== -Infinity,1 !== NaN],
+    [1.25 !== true,1.25 !== false,1.25 !== null,1.25 !== void 0,1.25 !== 0,1.25 !== 0.0,1.25 !== -0,1.25 !== "",1.25 !== -1,1.25 !== -1.25,1.25 !== 1,1.25 !== 1.25,1.25 !== -2147483648,1.25 !== 2147483648,1.25 !== Infinity,1.25 !== -Infinity,1.25 !== NaN],
+    [-2147483648 !== true,-2147483648 !== false,-2147483648 !== null,-2147483648 !== void 0,-2147483648 !== 0,-2147483648 !== 0.0,-2147483648 !== -0,-2147483648 !== "",-2147483648 !== -1,-2147483648 !== -1.25,-2147483648 !== 1,-2147483648 !== 1.25,-2147483648 !== -2147483648,-2147483648 !== 2147483648,-2147483648 !== Infinity,-2147483648 !== -Infinity,-2147483648 !== NaN],
+    [2147483648 !== true,2147483648 !== false,2147483648 !== null,2147483648 !== void 0,2147483648 !== 0,2147483648 !== 0.0,2147483648 !== -0,2147483648 !== "",2147483648 !== -1,2147483648 !== -1.25,2147483648 !== 1,2147483648 !== 1.25,2147483648 !== -2147483648,2147483648 !== 2147483648,2147483648 !== Infinity,2147483648 !== -Infinity,2147483648 !== NaN],
+    [Infinity !== true,Infinity !== false,Infinity !== null,Infinity !== void 0,Infinity !== 0,Infinity !== 0.0,Infinity !== -0,Infinity !== "",Infinity !== -1,Infinity !== -1.25,Infinity !== 1,Infinity !== 1.25,Infinity !== -2147483648,Infinity !== 2147483648,Infinity !== Infinity,Infinity !== -Infinity,Infinity !== NaN],
+    [-Infinity !== true,-Infinity !== false,-Infinity !== null,-Infinity !== void 0,-Infinity !== 0,-Infinity !== 0.0,-Infinity !== -0,-Infinity !== "",-Infinity !== -1,-Infinity !== -1.25,-Infinity !== 1,-Infinity !== 1.25,-Infinity !== -2147483648,-Infinity !== 2147483648,-Infinity !== Infinity,-Infinity !== -Infinity,-Infinity !== NaN],
+    [NaN !== true,NaN !== false,NaN !== null,NaN !== void 0,NaN !== 0,NaN !== 0.0,NaN !== -0,NaN !== "",NaN !== -1,NaN !== -1.25,NaN !== 1,NaN !== 1.25,NaN !== -2147483648,NaN !== 2147483648,NaN !== Infinity,NaN !== -Infinity,NaN !== NaN]
+  ];
+}
+function test() {
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      var a = values[i];
+      var b = values[j];
+      var x = expected[i][j];
+      assertEquals(x, func(a,b));
+      assertEquals(x, left_funcs[i](b));
+      assertEquals(x, right_funcs[j](a));
+    }
+  }
+
+  var result = matrix();
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      assertEquals(expected[i][j], result[i][j]);
+    }
+  }
+}
+test();
+test();
diff --git a/tools/compare-table-gen.js b/tools/compare-table-gen.js
new file mode 100644 (file)
index 0000000..151be81
--- /dev/null
@@ -0,0 +1,108 @@
+// Generates a comparison table test case.
+// Usage: d8 compare-table-gen.js -- lt|lteq|gt|gteq|eq|ne|eq|sne
+
+var strings = ["true", "false", "null", "void 0", "0", "0.0", "-0", "\"\"", "-1", "-1.25", "1", "1.25", "-2147483648", "2147483648", "Infinity", "-Infinity", "NaN"];
+var values = new Array(strings.length);
+for (var i = 0; i < strings.length; i++) {
+  values[i] = eval(strings[i]);
+}
+
+function test() {
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      var a = values[i];
+      var b = values[j];
+      var x = expected[i][j];
+      assertEquals(x, func(a,b));
+      assertEquals(x, left_funcs[i](b));
+      assertEquals(x, right_funcs[j](a));
+    }
+  }
+
+  var result = matrix();
+  for (var i = 0; i < values.length; i++) {
+    for (var j = 0; j < values.length; j++) {
+      assertEquals(expected[i][j], result[i][j]);
+    }
+  }
+}
+
+function gen(name, cmp) {
+
+  print("// Copyright 2015 the V8 project authors. All rights reserved.");
+  print("// Use of this source code is governed by a BSD-style license that can be");
+  print("// found in the LICENSE file.");
+  print();
+  print("var values = [" + strings + "];");
+
+  var body = "(function " + name + "(a,b) { return a " + cmp + " b; })";
+  var func = eval(body);
+
+  print("var expected = [");
+
+  for (var i = 0; i < values.length; i++) {
+    var line = "  [";
+    for (var j = 0; j < values.length; j++) {
+      if (j > 0) line += ",";
+      line += func(values[i], values[j]) ? "true " : "false";
+    }
+    line += "]";
+    if (i < (values.length - 1)) line += ",";
+    print(line);
+  }
+  print("];");
+
+  print("var func = " + body + ";");
+  print("var left_funcs = [");
+
+  for (var i = 0; i < values.length; i++) {
+    var value = strings[i];
+    var body = "(function " + name + "_L" + i + "(b) { return " + value + " " + cmp + " b; })";
+    var end = i < (values.length - 1) ? "," : "";
+    print("  " + body + end);
+  }
+  print("];");
+
+  print("var right_funcs = [");
+  for (var i = 0; i < values.length; i++) {
+    var value = strings[i];
+    var body = "(function " + name + "_R" + i + "(a) { return a " + cmp + " " + value + "; })";
+    var end = i < (values.length - 1) ? "," : "";
+    print("  " + body + end);
+  }
+  print("];");
+
+  print("function matrix() {");
+  print("  return [");
+  for (var i = 0; i < values.length; i++) {
+    var line = "    [";
+    for (var j = 0; j < values.length; j++) {
+      if (j > 0) line += ",";
+      line += strings[i] + " " + cmp + " " + strings[j];
+    }
+    line += "]";
+    if (i < (values.length - 1)) line += ",";
+    print(line);
+  }
+  print("  ];");
+  print("}");
+
+
+  print(test.toString());
+  print("test();");
+  print("test();");
+
+  print();
+  print();
+}
+
+switch (arguments[0]) {
+  case "lt":   gen("lt",   "<"); break;
+  case "lteq": gen("lteq", "<="); break;
+  case "gt":   gen("gt",   ">"); break;
+  case "gteq": gen("gteq", ">="); break;
+  case "eq":   gen("eq",   "=="); break;
+  case "ne":   gen("ne",   "!="); break;
+  case "seq":  gen("seq",  "==="); break;
+  case "sne":  gen("sne",  "!=="); break;
+}