summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/bitwise-and
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/expressions/bitwise-and')
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A1.js63
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T1.js43
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T2.js21
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T3.js21
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.2_T1.js71
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.3_T1.js28
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T1.js22
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T2.js26
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T3.js27
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.1.js30
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.2.js30
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.3.js40
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.4.js30
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.5.js30
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.1.js52
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.2.js62
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.3.js32
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.4.js32
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.5.js52
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.6.js32
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.7.js32
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.8.js32
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.9.js32
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/bigint-and-number.js92
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/bigint-errors.js72
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/bigint-non-primitive.js83
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/bigint-toprimitive.js374
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/bigint-wrapped-values.js47
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/bigint.js109
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/order-of-evaluation.js140
-rw-r--r--js/src/tests/test262/language/expressions/bitwise-and/shell.js0
32 files changed, 1757 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A1.js
new file mode 100644
index 0000000000..b9aa7e624c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A1.js
@@ -0,0 +1,63 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ White Space and Line Terminator between BitwiseANDExpression and "&" or
+ between "&" and EqualityExpression are allowed
+es5id: 11.10.1_A1
+description: Checking uses eval
+---*/
+
+//CHECK#1
+if ((eval("1\u0009&\u00091")) !== 1) {
+ throw new Test262Error('#1: (1\\u0009&\\u00091) === 1');
+}
+
+//CHECK#2
+if ((eval("1\u000B&\u000B1")) !== 1) {
+ throw new Test262Error('#2: (1\\u000B&\\u000B1) === 1');
+}
+
+//CHECK#3
+if ((eval("1\u000C&\u000C1")) !== 1) {
+ throw new Test262Error('#3: (1\\u000C&\\u000C1) === 1');
+}
+
+//CHECK#4
+if ((eval("1\u0020&\u00201")) !== 1) {
+ throw new Test262Error('#4: (1\\u0020&\\u00201) === 1');
+}
+
+//CHECK#5
+if ((eval("1\u00A0&\u00A01")) !== 1) {
+ throw new Test262Error('#5: (1\\u00A0&\\u00A01) === 1');
+}
+
+//CHECK#6
+if ((eval("1\u000A&\u000A1")) !== 1) {
+ throw new Test262Error('#6: (1\\u000A&\\u000A1) === 1');
+}
+
+//CHECK#7
+if ((eval("1\u000D&\u000D1")) !== 1) {
+ throw new Test262Error('#7: (1\\u000D&\\u000D1) === 1');
+}
+
+//CHECK#8
+if ((eval("1\u2028&\u20281")) !== 1) {
+ throw new Test262Error('#8: (1\\u2028&\\u20281) === 1');
+}
+
+//CHECK#9
+if ((eval("1\u2029&\u20291")) !== 1) {
+ throw new Test262Error('#9: (1\\u2029&\\u20291) === 1');
+}
+
+
+//CHECK#10
+if ((eval("1\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u2029&\u0009\u000B\u000C\u0020\u00A0\u000A\u000D\u2028\u20291")) !== 1) {
+ throw new Test262Error('#10: (1\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u2029&\\u0009\\u000B\\u000C\\u0020\\u00A0\\u000A\\u000D\\u2028\\u20291) === 1');
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T1.js
new file mode 100644
index 0000000000..73f8709fc2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T1.js
@@ -0,0 +1,43 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y uses GetValue
+es5id: 11.10.1_A2.1_T1
+description: Either Type is not Reference or GetBase is not null
+---*/
+
+//CHECK#1
+if ((1 & 1) !== 1) {
+ throw new Test262Error('#1: (1 & 1) === 1. Actual: ' + ((1 & 1)));
+}
+
+//CHECK#2
+var x = 1;
+if ((x & 1) !== 1) {
+ throw new Test262Error('#2: var x = 1; (x & 1) === 1. Actual: ' + ((x & 1)));
+}
+
+//CHECK#3
+var y = 1;
+if ((1 & y) !== 1) {
+ throw new Test262Error('#3: var y = 1; (1 & y) === 1. Actual: ' + ((1 & y)));
+}
+
+//CHECK#4
+var x = 1;
+var y = 1;
+if ((x & y) !== 1) {
+ throw new Test262Error('#4: var x = 1; var y = 1; (x & y) === 1. Actual: ' + ((x & y)));
+}
+
+//CHECK#5
+var objectx = new Object();
+var objecty = new Object();
+objectx.prop = 1;
+objecty.prop = 1;
+if ((objectx.prop & objecty.prop) !== 1) {
+ throw new Test262Error('#5: var objectx = new Object(); var objecty = new Object(); objectx.prop = 1; objecty.prop = 1; (objectx.prop & objecty.prop) === 1. Actual: ' + ((objectx.prop & objecty.prop)));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T2.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T2.js
new file mode 100644
index 0000000000..a085abc1ba
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T2.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y uses GetValue
+es5id: 11.10.1_A2.1_T2
+description: If GetBase(x) is null, throw ReferenceError
+---*/
+
+//CHECK#1
+try {
+ x & 1;
+ throw new Test262Error('#1.1: x & 1 throw ReferenceError. Actual: ' + (x & 1));
+}
+catch (e) {
+ if ((e instanceof ReferenceError) !== true) {
+ throw new Test262Error('#1.2: x & 1 throw ReferenceError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T3.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T3.js
new file mode 100644
index 0000000000..ab8735b901
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.1_T3.js
@@ -0,0 +1,21 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y uses GetValue
+es5id: 11.10.1_A2.1_T3
+description: If GetBase(y) is null, throw ReferenceError
+---*/
+
+//CHECK#1
+try {
+ 1 & y;
+ throw new Test262Error('#1.1: 1 & y throw ReferenceError. Actual: ' + (1 & y));
+}
+catch (e) {
+ if ((e instanceof ReferenceError) !== true) {
+ throw new Test262Error('#1.2: 1 & y throw ReferenceError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.2_T1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.2_T1.js
new file mode 100644
index 0000000000..11f34a0121
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.2_T1.js
@@ -0,0 +1,71 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y uses [[Default Value]]
+es5id: 11.10.1_A2.2_T1
+description: If Type(value) is Object, evaluate ToPrimitive(value, Number)
+---*/
+
+//CHECK#1
+if (({valueOf: function() {return 1}} & 1) !== 1) {
+ throw new Test262Error('#1: ({valueOf: function() {return 1}} & 1) === 1. Actual: ' + (({valueOf: function() {return 1}} & 1)));
+}
+
+//CHECK#2
+if (({valueOf: function() {return 1}, toString: function() {return 0}} & 1) !== 1) {
+ throw new Test262Error('#2: ({valueOf: function() {return 1}, toString: function() {return 0}} & 1) === 1. Actual: ' + (({valueOf: function() {return 1}, toString: function() {return 0}} & 1)));
+}
+
+//CHECK#3
+if (({valueOf: function() {return 1}, toString: function() {return {}}} & 1) !== 1) {
+ throw new Test262Error('#3: ({valueOf: function() {return 1}, toString: function() {return {}}} & 1) === 1. Actual: ' + (({valueOf: function() {return 1}, toString: function() {return {}}} & 1)));
+}
+
+//CHECK#4
+try {
+ if (({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1) !== 1) {
+ throw new Test262Error('#4.1: ({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1) === 1. Actual: ' + (({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1)));
+ }
+}
+catch (e) {
+ if (e === "error") {
+ throw new Test262Error('#4.2: ({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1) not throw "error"');
+ } else {
+ throw new Test262Error('#4.3: ({valueOf: function() {return 1}, toString: function() {throw "error"}} & 1) not throw Error. Actual: ' + (e));
+ }
+}
+
+//CHECK#5
+if ((1 & {toString: function() {return 1}}) !== 1) {
+ throw new Test262Error('#5.1: (1 & {toString: function() {return 1}}) === 1. Actual: ' + ((1 & {toString: function() {return 1}})));
+}
+
+//CHECK#6
+if ((1 & {valueOf: function() {return {}}, toString: function() {return 1}}) !== 1) {
+ throw new Test262Error('#6: (1 & {valueOf: function() {return {}}, toString: function() {return 1}}) === 1. Actual: ' + ((1 & {valueOf: function() {return {}}, toString: function() {return 1}})));
+}
+
+//CHECK#7
+try {
+ 1 & {valueOf: function() {throw "error"}, toString: function() {return 1}};
+ throw new Test262Error('#7.1: 1 & {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (1 & {valueOf: function() {throw "error"}, toString: function() {return 1}}));
+}
+catch (e) {
+ if (e !== "error") {
+ throw new Test262Error('#7.2: 1 & {valueOf: function() {throw "error"}, toString: function() {return 1}} throw "error". Actual: ' + (e));
+ }
+}
+
+//CHECK#8
+try {
+ 1 & {valueOf: function() {return {}}, toString: function() {return {}}};
+ throw new Test262Error('#8.1: 1 & {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (1 & {valueOf: function() {return {}}, toString: function() {return {}}}));
+}
+catch (e) {
+ if ((e instanceof TypeError) !== true) {
+ throw new Test262Error('#8.2: 1 & {valueOf: function() {return {}}, toString: function() {return {}}} throw TypeError. Actual: ' + (e));
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.3_T1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.3_T1.js
new file mode 100644
index 0000000000..b3ddbf11cf
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.3_T1.js
@@ -0,0 +1,28 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: |
+ ToInt32(first expression) is called first, and then ToInt32(second
+ expression)
+es5id: 11.10.1_A2.3_T1
+description: Checking by using "throw"
+---*/
+
+//CHECK#1
+var x = { valueOf: function () { throw "x"; } };
+var y = { valueOf: function () { throw "y"; } };
+try {
+ x & y;
+ throw new Test262Error('#1.1: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x & y throw "x". Actual: ' + (x & y));
+} catch (e) {
+ if (e === "y") {
+ throw new Test262Error('#1.2: ToInt32(first expression) is called first, and then ToInt32(second expression)');
+ } else {
+ if (e !== "x") {
+ throw new Test262Error('#1.3: var x = { valueOf: function () { throw "x"; } }; var y = { valueOf: function () { throw "y"; } }; x & y throw "x". Actual: ' + (e));
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T1.js
new file mode 100644
index 0000000000..14807c25f7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T1.js
@@ -0,0 +1,22 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: First expression is evaluated first, and then second expression
+es5id: 11.10.1_A2.4_T1
+description: Checking with "="
+---*/
+
+//CHECK#1
+var x = 0;
+if (((x = 1) & x) !== 1) {
+ throw new Test262Error('#1: var x = 0; ((x = 1) & x) === 1. Actual: ' + (((x = 1) & x)));
+}
+
+//CHECK#2
+var x = 0;
+if ((x & (x = 1)) !== 0) {
+ throw new Test262Error('#2: var x = 0; (x & (x = 1)) === 0. Actual: ' + ((x & (x = 1))));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T2.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T2.js
new file mode 100644
index 0000000000..2f6201a800
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T2.js
@@ -0,0 +1,26 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: First expression is evaluated first, and then second expression
+es5id: 11.10.1_A2.4_T2
+description: Checking with "throw"
+---*/
+
+//CHECK#1
+var x = function () { throw "x"; };
+var y = function () { throw "y"; };
+try {
+ x() & y();
+ throw new Test262Error('#1.1: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() & y() throw "x". Actual: ' + (x() & y()));
+} catch (e) {
+ if (e === "y") {
+ throw new Test262Error('#1.2: First expression is evaluated first, and then second expression');
+ } else {
+ if (e !== "x") {
+ throw new Test262Error('#1.3: var x = function () { throw "x"; }; var y = function () { throw "y"; }; x() & y() throw "x". Actual: ' + (e));
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T3.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T3.js
new file mode 100644
index 0000000000..11178c0efb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A2.4_T3.js
@@ -0,0 +1,27 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: First expression is evaluated first, and then second expression
+es5id: 11.10.1_A2.4_T3
+description: Checking with undeclarated variables
+flags: [noStrict]
+---*/
+
+//CHECK#1
+try {
+ x & (x = 1);
+ throw new Test262Error('#1.1: x & (x = 1) throw ReferenceError. Actual: ' + (x & (x = 1)));
+}
+catch (e) {
+ if ((e instanceof ReferenceError) !== true) {
+ throw new Test262Error('#1.2: x & (x = 1) throw ReferenceError. Actual: ' + (e));
+ }
+}
+
+//CHECK#2
+if (((y = 1) & y) !== 1) {
+ throw new Test262Error('#2: ((y = 1) & y) === 1. Actual: ' + (((y = 1) & y)));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.1.js
new file mode 100644
index 0000000000..30041b9ee1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.1.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T1.1
+description: Type(x) and Type(y) are primitive boolean and Boolean object
+---*/
+
+//CHECK#1
+if ((true & true) !== 1) {
+ throw new Test262Error('#1: (true & true) === 1. Actual: ' + ((true & true)));
+}
+
+//CHECK#2
+if ((new Boolean(true) & true) !== 1) {
+ throw new Test262Error('#2: (new Boolean(true) & true) === 1. Actual: ' + ((new Boolean(true) & true)));
+}
+
+//CHECK#3
+if ((true & new Boolean(true)) !== 1) {
+ throw new Test262Error('#3: (true & new Boolean(true)) === 1. Actual: ' + ((true & new Boolean(true))));
+}
+
+//CHECK#4
+if ((new Boolean(true) & new Boolean(true)) !== 1) {
+ throw new Test262Error('#4: (new Boolean(true) & new Boolean(true)) === 1. Actual: ' + ((new Boolean(true) & new Boolean(true))));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.2.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.2.js
new file mode 100644
index 0000000000..0324bb47be
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.2.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T1.2
+description: Type(x) and Type(y) are primitive number and Number object
+---*/
+
+//CHECK#1
+if ((1 & 1) !== 1) {
+ throw new Test262Error('#1: (1 & 1) === 1. Actual: ' + ((1 & 1)));
+}
+
+//CHECK#2
+if ((new Number(1) & 1) !== 1) {
+ throw new Test262Error('#2: (new Number(1) & 1) === 1. Actual: ' + ((new Number(1) & 1)));
+}
+
+//CHECK#3
+if ((1 & new Number(1)) !== 1) {
+ throw new Test262Error('#3: (1 & new Number(1)) === 1. Actual: ' + ((1 & new Number(1))));
+}
+
+//CHECK#4
+if ((new Number(1) & new Number(1)) !== 1) {
+ throw new Test262Error('#4: (new Number(1) & new Number(1)) === 1. Actual: ' + ((new Number(1) & new Number(1))));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.3.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.3.js
new file mode 100644
index 0000000000..78b0d17e07
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.3.js
@@ -0,0 +1,40 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T1.3
+description: Type(x) and Type(y) are primitive string and String object
+---*/
+
+//CHECK#1
+if (("1" & "1") !== 1) {
+ throw new Test262Error('#1: ("1" & "1") === 1. Actual: ' + (("1" & "1")));
+}
+
+//CHECK#2
+if ((new String("1") & "1") !== 1) {
+ throw new Test262Error('#2: (new String("1") & "1") === 1. Actual: ' + ((new String("1") & "1")));
+}
+
+//CHECK#3
+if (("1" & new String("1")) !== 1) {
+ throw new Test262Error('#3: ("1" & new String("1")) === 1. Actual: ' + (("1" & new String("1"))));
+}
+
+//CHECK#4
+if ((new String("1") & new String("1")) !== 1) {
+ throw new Test262Error('#4: (new String("1") & new String("1")) === 1. Actual: ' + ((new String("1") & new String("1"))));
+}
+
+//CHECK#5
+if (("x" & "1") !== 0) {
+ throw new Test262Error('#5: ("x" & "1") === 0. Actual: ' + (("x" & "1")));
+}
+
+//CHECK#6
+if (("1" & "x") !== 0) {
+ throw new Test262Error('#6: ("1" & "x") === 0. Actual: ' + (("1" & "x")));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.4.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.4.js
new file mode 100644
index 0000000000..915deadf16
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.4.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T1.4
+description: Type(x) and Type(y) are null and undefined
+---*/
+
+//CHECK#1
+if ((null & undefined) !== 0) {
+ throw new Test262Error('#1: (null & undefined) === 0. Actual: ' + ((null & undefined)));
+}
+
+//CHECK#2
+if ((undefined & null) !== 0) {
+ throw new Test262Error('#2: (undefined & null) === 0. Actual: ' + ((undefined & null)));
+}
+
+//CHECK#3
+if ((undefined & undefined) !== 0) {
+ throw new Test262Error('#3: (undefined & undefined) === 0. Actual: ' + ((undefined & undefined)));
+}
+
+//CHECK#4
+if ((null & null) !== 0) {
+ throw new Test262Error('#4: (null & null) === 0. Actual: ' + ((null & null)));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.5.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.5.js
new file mode 100644
index 0000000000..519552149b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T1.5.js
@@ -0,0 +1,30 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T1.5
+description: Type(x) and Type(y) are Object object and Function object
+---*/
+
+//CHECK#1
+if (({} & function(){return 1}) !== 0) {
+ throw new Test262Error('#1: ({} & function(){return 1}) === 0. Actual: ' + (({} & function(){return 1})));
+}
+
+//CHECK#2
+if ((function(){return 1} & {}) !== 0) {
+ throw new Test262Error('#2: (function(){return 1} & {}) === 0. Actual: ' + ((function(){return 1} & {})));
+}
+
+//CHECK#3
+if ((function(){return 1} & function(){return 1}) !== 0) {
+ throw new Test262Error('#3: (function(){return 1} & function(){return 1}) === 0. Actual: ' + ((function(){return 1} & function(){return 1})));
+}
+
+//CHECK#4
+if (({} & {}) !== 0) {
+ throw new Test262Error('#4: ({} & {}) === 0. Actual: ' + (({} & {})));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.1.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.1.js
new file mode 100644
index 0000000000..8526ac73d7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.1.js
@@ -0,0 +1,52 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T2.1
+description: >
+ Type(x) is different from Type(y) and both types vary between
+ Number (primitive or object) and Boolean (primitive and object)
+---*/
+
+//CHECK#1
+if ((true & 1) !== 1) {
+ throw new Test262Error('#1: (true & 1) === 1. Actual: ' + ((true & 1)));
+}
+
+//CHECK#2
+if ((1 & true) !== 1) {
+ throw new Test262Error('#2: (1 & true) === 1. Actual: ' + ((1 & true)));
+}
+
+//CHECK#3
+if ((new Boolean(true) & 1) !== 1) {
+ throw new Test262Error('#3: (new Boolean(true) & 1) === 1. Actual: ' + ((new Boolean(true) & 1)));
+}
+
+//CHECK#4
+if ((1 & new Boolean(true)) !== 1) {
+ throw new Test262Error('#4: (1 & new Boolean(true)) === 1. Actual: ' + ((1 & new Boolean(true))));
+}
+
+//CHECK#5
+if ((true & new Number(1)) !== 1) {
+ throw new Test262Error('#5: (true & new Number(1)) === 1. Actual: ' + ((true & new Number(1))));
+}
+
+//CHECK#6
+if ((new Number(1) & true) !== 1) {
+ throw new Test262Error('#6: (new Number(1) & true) === 1. Actual: ' + ((new Number(1) & true)));
+}
+
+//CHECK#7
+if ((new Boolean(true) & new Number(1)) !== 1) {
+ throw new Test262Error('#7: (new Boolean(true) & new Number(1)) === 1. Actual: ' + ((new Boolean(true) & new Number(1))));
+}
+
+//CHECK#8
+if ((new Number(1) & new Boolean(true)) !== 1) {
+ throw new Test262Error('#8: (new Number(1) & new Boolean(true)) === 1. Actual: ' + ((new Number(1) & new Boolean(true))));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.2.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.2.js
new file mode 100644
index 0000000000..ad84b94a9c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.2.js
@@ -0,0 +1,62 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T2.2
+description: >
+ Type(x) is different from Type(y) and both types vary between
+ Number (primitive or object) and String (primitive and object)
+---*/
+
+//CHECK#1
+if (("1" & 1) !== 1) {
+ throw new Test262Error('#1: ("1" & 1) === 1. Actual: ' + (("1" & 1)));
+}
+
+//CHECK#2
+if ((1 & "1") !== 1) {
+ throw new Test262Error('#2: (1 & "1") === 1. Actual: ' + ((1 & "1")));
+}
+
+//CHECK#3
+if ((new String("1") & 1) !== 1) {
+ throw new Test262Error('#3: (new String("1") & 1) === 1. Actual: ' + ((new String("1") & 1)));
+}
+
+//CHECK#4
+if ((1 & new String("1")) !== 1) {
+ throw new Test262Error('#4: (1 & new String("1")) === 1. Actual: ' + ((1 & new String("1"))));
+}
+
+//CHECK#5
+if (("1" & new Number(1)) !== 1) {
+ throw new Test262Error('#5: ("1" & new Number(1)) === 1. Actual: ' + (("1" & new Number(1))));
+}
+
+//CHECK#6
+if ((new Number(1) & "1") !== 1) {
+ throw new Test262Error('#6: (new Number(1) & "1") === 1. Actual: ' + ((new Number(1) & "1")));
+}
+
+//CHECK#7
+if ((new String("1") & new Number(1)) !== 1) {
+ throw new Test262Error('#7: (new String("1") & new Number(1)) === 1. Actual: ' + ((new String("1") & new Number(1))));
+}
+
+//CHECK#8
+if ((new Number(1) & new String("1")) !== 1) {
+ throw new Test262Error('#8: (new Number(1) & new String("1")) === 1. Actual: ' + ((new Number(1) & new String("1"))));
+}
+
+//CHECK#9
+if (("x" & 1) !== 0) {
+ throw new Test262Error('#9: ("x" & 1) === 0. Actual: ' + (("x" & 1)));
+}
+
+//CHECK#10
+if ((1 & "x") !== 0) {
+ throw new Test262Error('#10: (1 & "x") === 0. Actual: ' + ((1 & "x")));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.3.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.3.js
new file mode 100644
index 0000000000..b8f3364c0b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.3.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T2.3
+description: >
+ Type(x) is different from Type(y) and both types vary between
+ Number (primitive or object) and Null
+---*/
+
+//CHECK#1
+if ((1 & null) !== 0) {
+ throw new Test262Error('#1: (1 & null) === 0. Actual: ' + ((1 & null)));
+}
+
+//CHECK#2
+if ((null & 1) !== 0) {
+ throw new Test262Error('#2: (null & 1) === 0. Actual: ' + ((null & 1)));
+}
+
+//CHECK#3
+if ((new Number(1) & null) !== 0) {
+ throw new Test262Error('#3: (new Number(1) & null) === 0. Actual: ' + ((new Number(1) & null)));
+}
+
+//CHECK#4
+if ((null & new Number(1)) !== 0) {
+ throw new Test262Error('#4: (null & new Number(1)) === 0. Actual: ' + ((null & new Number(1))));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.4.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.4.js
new file mode 100644
index 0000000000..58246c2cf0
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.4.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T2.4
+description: >
+ Type(x) is different from Type(y) and both types vary between
+ Number (primitive or object) and Undefined
+---*/
+
+//CHECK#1
+if ((1 & undefined) !== 0) {
+ throw new Test262Error('#1: (1 & undefined) === 0. Actual: ' + ((1 & undefined)));
+}
+
+//CHECK#2
+if ((undefined & 1) !== 0) {
+ throw new Test262Error('#2: (undefined & 1) === 0. Actual: ' + ((undefined & 1)));
+}
+
+//CHECK#3
+if ((new Number(1) & undefined) !== 0) {
+ throw new Test262Error('#3: (new Number(1) & undefined) === 0. Actual: ' + ((new Number(1) & undefined)));
+}
+
+//CHECK#4
+if ((undefined & new Number(1)) !== 0) {
+ throw new Test262Error('#4: (undefined & new Number(1)) === 0. Actual: ' + ((undefined & new Number(1))));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.5.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.5.js
new file mode 100644
index 0000000000..009bd234c3
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.5.js
@@ -0,0 +1,52 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T2.5
+description: >
+ Type(x) us different from Type(y) and both types are String
+ (primitive or object) or Boolean (primitive and object)
+---*/
+
+//CHECK#1
+if ((true & "1") !== 1) {
+ throw new Test262Error('#1: (true & "1") === 1. Actual: ' + ((true & "1")));
+}
+
+//CHECK#2
+if (("1" & true) !== 1) {
+ throw new Test262Error('#2: ("1" & true) === 1. Actual: ' + (("1" & true)));
+}
+
+//CHECK#3
+if ((new Boolean(true) & "1") !== 1) {
+ throw new Test262Error('#3: (new Boolean(true) & "1") === 1. Actual: ' + ((new Boolean(true) & "1")));
+}
+
+//CHECK#4
+if (("1" & new Boolean(true)) !== 1) {
+ throw new Test262Error('#4: ("1" & new Boolean(true)) === 1. Actual: ' + (("1" & new Boolean(true))));
+}
+
+//CHECK#5
+if ((true & new String("1")) !== 1) {
+ throw new Test262Error('#5: (true & new String("1")) === 1. Actual: ' + ((true & new String("1"))));
+}
+
+//CHECK#6
+if ((new String("1") & true) !== 1) {
+ throw new Test262Error('#6: (new String("1") & true) === 1. Actual: ' + ((new String("1") & true)));
+}
+
+//CHECK#7
+if ((new Boolean(true) & new String("1")) !== 1) {
+ throw new Test262Error('#7: (new Boolean(true) & new String("1")) === 1. Actual: ' + ((new Boolean(true) & new String("1"))));
+}
+
+//CHECK#8
+if ((new String("1") & new Boolean(true)) !== 1) {
+ throw new Test262Error('#8: (new String("1") & new Boolean(true)) === 1. Actual: ' + ((new String("1") & new Boolean(true))));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.6.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.6.js
new file mode 100644
index 0000000000..03dd622b91
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.6.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T2.6
+description: >
+ Type(x) is different from Type(y) and both types vary between
+ String (primitive or object) and Undefined
+---*/
+
+//CHECK#1
+if (("1" & undefined) !== 0) {
+ throw new Test262Error('#1: ("1" & undefined) === 0. Actual: ' + (("1" & undefined)));
+}
+
+//CHECK#2
+if ((undefined & "1") !== 0) {
+ throw new Test262Error('#2: (undefined & "1") === 0. Actual: ' + ((undefined & "1")));
+}
+
+//CHECK#3
+if ((new String("1") & undefined) !== 0) {
+ throw new Test262Error('#3: (new String("1") & undefined) === 0. Actual: ' + ((new String("1") & undefined)));
+}
+
+//CHECK#4
+if ((undefined & new String("1")) !== 0) {
+ throw new Test262Error('#4: (undefined & new String("1")) === 0. Actual: ' + ((undefined & new String("1"))));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.7.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.7.js
new file mode 100644
index 0000000000..63acb37e83
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.7.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T2.7
+description: >
+ Type(x) is different from Type(y) and both types vary between
+ String (primitive or object) and Null
+---*/
+
+//CHECK#1
+if (("1" & null) !== 0) {
+ throw new Test262Error('#1: ("1" & null) === 0. Actual: ' + (("1" & null)));
+}
+
+//CHECK#2
+if ((null & "1") !== 0) {
+ throw new Test262Error('#2: (null & "1") === 0. Actual: ' + ((null & "1")));
+}
+
+//CHECK#3
+if ((new String("1") & null) !== 0) {
+ throw new Test262Error('#3: (new String("1") & null) === 0. Actual: ' + ((new String("1") & null)));
+}
+
+//CHECK#4
+if ((null & new String("1")) !== 0) {
+ throw new Test262Error('#4: (null & new String("1")) === 0. Actual: ' + ((null & new String("1"))));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.8.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.8.js
new file mode 100644
index 0000000000..06245a96b7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.8.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T2.8
+description: >
+ Type(x) is different from Type(y) and both types vary between
+ Boolean (primitive or object) and Undefined
+---*/
+
+//CHECK#1
+if ((true & undefined) !== 0) {
+ throw new Test262Error('#1: (true & undefined) === 0. Actual: ' + ((true & undefined)));
+}
+
+//CHECK#2
+if ((undefined & true) !== 0) {
+ throw new Test262Error('#2: (undefined & true) === 0. Actual: ' + ((undefined & true)));
+}
+
+//CHECK#3
+if ((new Boolean(true) & undefined) !== 0) {
+ throw new Test262Error('#3: (new Boolean(true) & undefined) === 0. Actual: ' + ((new Boolean(true) & undefined)));
+}
+
+//CHECK#4
+if ((undefined & new Boolean(true)) !== 0) {
+ throw new Test262Error('#4: (undefined & new Boolean(true)) === 0. Actual: ' + ((undefined & new Boolean(true))));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.9.js b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.9.js
new file mode 100644
index 0000000000..c457285973
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/S11.10.1_A3_T2.9.js
@@ -0,0 +1,32 @@
+// Copyright 2009 the Sputnik authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+info: Operator x & y returns ToNumber(x) & ToNumber(y)
+es5id: 11.10.1_A3_T2.9
+description: >
+ Type(x) is different from Type(y) and both types vary between
+ Boolean (primitive or object) and Null
+---*/
+
+//CHECK#1
+if ((true & null) !== 0) {
+ throw new Test262Error('#1: (true & null) === 0. Actual: ' + ((true & null)));
+}
+
+//CHECK#2
+if ((null & true) !== 0) {
+ throw new Test262Error('#2: (null & true) === 0. Actual: ' + ((null & true)));
+}
+
+//CHECK#3
+if ((new Boolean(true) & null) !== 0) {
+ throw new Test262Error('#3: (new Boolean(true) & null) === 0. Actual: ' + ((new Boolean(true) & null)));
+}
+
+//CHECK#4
+if ((null & new Boolean(true)) !== 0) {
+ throw new Test262Error('#4: (null & new Boolean(true)) === 0. Actual: ' + ((null & new Boolean(true))));
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/bigint-and-number.js b/js/src/tests/test262/language/expressions/bitwise-and/bigint-and-number.js
new file mode 100644
index 0000000000..3703caf8ba
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/bigint-and-number.js
@@ -0,0 +1,92 @@
+// Copyright (C) 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-binary-bitwise-operators-runtime-semantics-evaluation
+description: Mixing BigInt and Number produces a TypeError for bitwise-and operator
+features: [BigInt]
+info: |
+ Let lnum be ? ToNumeric(leftValue).
+ Let rnum be ? ToNumeric(rightValue).
+ If Type(lnum) does not equal Type(rnum), throw a TypeError exception.
+---*/
+assert.throws(TypeError, function() {
+ 1n & 1;
+}, '1n & 1 throws TypeError');
+
+assert.throws(TypeError, function() {
+ 1 & 1n;
+}, '1 & 1n throws TypeError');
+
+assert.throws(TypeError, function() {
+ Object(1n) & 1;
+}, 'Object(1n) & 1 throws TypeError');
+
+assert.throws(TypeError, function() {
+ 1 & Object(1n);
+}, '1 & Object(1n) throws TypeError');
+
+assert.throws(TypeError, function() {
+ 1n & Object(1);
+}, '1n & Object(1) throws TypeError');
+
+assert.throws(TypeError, function() {
+ Object(1) & 1n;
+}, 'Object(1) & 1n throws TypeError');
+
+assert.throws(TypeError, function() {
+ Object(1n) & Object(1);
+}, 'Object(1n) & Object(1) throws TypeError');
+
+assert.throws(TypeError, function() {
+ Object(1) & Object(1n);
+}, 'Object(1) & Object(1n) throws TypeError');
+
+assert.throws(TypeError, function() {
+ 1n & NaN;
+}, '1n & NaN throws TypeError');
+
+assert.throws(TypeError, function() {
+ NaN & 1n;
+}, 'NaN & 1n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 1n & Infinity;
+}, '1n & Infinity throws TypeError');
+
+assert.throws(TypeError, function() {
+ Infinity & 1n;
+}, 'Infinity & 1n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 1n & true;
+}, '1n & true throws TypeError');
+
+assert.throws(TypeError, function() {
+ true & 1n;
+}, 'true & 1n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 1n & '1';
+}, '1n & "1" throws TypeError');
+
+assert.throws(TypeError, function() {
+ '1' & 1n;
+}, '"1" & 1n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 1n & null;
+}, '1n & null throws TypeError');
+
+assert.throws(TypeError, function() {
+ null & 1n;
+}, 'null & 1n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 1n & undefined;
+}, '1n & undefined throws TypeError');
+
+assert.throws(TypeError, function() {
+ undefined & 1n;
+}, 'undefined & 1n throws TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/bigint-errors.js b/js/src/tests/test262/language/expressions/bitwise-and/bigint-errors.js
new file mode 100644
index 0000000000..9341e3a8de
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/bigint-errors.js
@@ -0,0 +1,72 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: bitwise-and operator ToNumeric with BigInt operands
+esid: sec-binary-bitwise-operators-runtime-semantics-evaluation
+features: [BigInt, Symbol, Symbol.toPrimitive, computed-property-names]
+---*/
+assert.throws(TypeError, function() {
+ Symbol('1') & 0n;
+}, 'Symbol("1") & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & Symbol('1');
+}, '0n & Symbol("1") throws TypeError');
+
+assert.throws(TypeError, function() {
+ Object(Symbol('1')) & 0n;
+}, 'Object(Symbol("1")) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & Object(Symbol('1'));
+}, '0n & Object(Symbol("1")) throws TypeError');
+
+assert.throws(TypeError, function() {
+ ({
+ [Symbol.toPrimitive]: function() {
+ return Symbol('1');
+ }
+ }) & 0n;
+}, '({[Symbol.toPrimitive]: function() {return Symbol("1");}}) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & {
+ [Symbol.toPrimitive]: function() {
+ return Symbol('1');
+ }
+ };
+}, '0n & {[Symbol.toPrimitive]: function() {return Symbol("1");}} throws TypeError');
+
+assert.throws(TypeError, function() {
+ ({
+ valueOf: function() {
+ return Symbol('1');
+ }
+ }) & 0n;
+}, '({valueOf: function() {return Symbol("1");}}) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & {
+ valueOf: function() {
+ return Symbol('1');
+ }
+ };
+}, '0n & {valueOf: function() {return Symbol("1");}} throws TypeError');
+
+assert.throws(TypeError, function() {
+ ({
+ toString: function() {
+ return Symbol('1');
+ }
+ }) & 0n;
+}, '({toString: function() {return Symbol("1");}}) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & {
+ toString: function() {
+ return Symbol('1');
+ }
+ };
+}, '0n & {toString: function() {return Symbol("1");}} throws TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/bigint-non-primitive.js b/js/src/tests/test262/language/expressions/bitwise-and/bigint-non-primitive.js
new file mode 100644
index 0000000000..13c93a087c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/bigint-non-primitive.js
@@ -0,0 +1,83 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Bitwise AND for BigInt non-primitive values
+esid: sec-binary-bitwise-operators-runtime-semantics-evaluation
+info: |
+ 5. Let lnum be ? ToNumeric(lval).
+ 6. Let rnum be ? ToNumeric(rval).
+ ...
+ 8. Let T be Type(lnum).
+ 9. If @ is &, return T::bitwiseAND(lnum, rnum).
+
+features: [BigInt]
+---*/
+assert.sameValue(
+ Object(0b101n) & 0b011n,
+ 0b001n,
+ 'The result of (Object(0b101n) & 0b011n) is 0b001n'
+);
+
+assert.sameValue(
+ 0b011n & Object(0b101n),
+ 0b001n,
+ 'The result of (0b011n & Object(0b101n)) is 0b001n'
+);
+
+assert.sameValue(
+ Object(0b101n) & Object(0b011n),
+ 0b001n,
+ 'The result of (Object(0b101n) & Object(0b011n)) is 0b001n'
+);
+
+function err() {
+ throw new Test262Error();
+}
+
+assert.sameValue({
+ [Symbol.toPrimitive]: function() {
+ return 0b101n;
+ },
+
+ valueOf: err,
+ toString: err
+} & 0b011n, 0b001n, 'The result of (({[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) & 0b011n) is 0b001n');
+
+assert.sameValue(0b011n & {
+ [Symbol.toPrimitive]: function() {
+ return 0b101n;
+ },
+
+ valueOf: err,
+ toString: err
+}, 0b001n, 'The result of (0b011n & {[Symbol.toPrimitive]: function() {return 0b101n;}, valueOf: err, toString: err}) is 0b001n');
+
+assert.sameValue({
+ valueOf: function() {
+ return 0b101n;
+ },
+
+ toString: err
+} & 0b011n, 0b001n, 'The result of (({valueOf: function() {return 0b101n;}, toString: err}) & 0b011n) is 0b001n');
+
+assert.sameValue(0b011n & {
+ valueOf: function() {
+ return 0b101n;
+ },
+
+ toString: err
+}, 0b001n, 'The result of (0b011n & {valueOf: function() {return 0b101n;}, toString: err}) is 0b001n');
+
+assert.sameValue({
+ toString: function() {
+ return 0b101n;
+ }
+} & 0b011n, 0b001n, 'The result of (({toString: function() {return 0b101n;}}) & 0b011n) is 0b001n');
+
+assert.sameValue(0b011n & {
+ toString: function() {
+ return 0b101n;
+ }
+}, 0b001n, 'The result of (0b011n & {toString: function() {return 0b101n;}}) is 0b001n');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/bigint-toprimitive.js b/js/src/tests/test262/language/expressions/bitwise-and/bigint-toprimitive.js
new file mode 100644
index 0000000000..ddaa6e406e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/bigint-toprimitive.js
@@ -0,0 +1,374 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: bitwise-and operator ToNumeric with BigInt operands
+esid: sec-binary-bitwise-operators-runtime-semantics-evaluation
+features: [BigInt, Symbol.toPrimitive, computed-property-names]
+---*/
+function err() {
+ throw new Test262Error();
+}
+
+function MyError() {}
+
+assert.sameValue({
+ [Symbol.toPrimitive]: function() {
+ return 2n;
+ },
+
+ valueOf: err,
+ toString: err
+} & 3n, 2n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ [Symbol.toPrimitive]: function() {
+ return 2n;
+ },
+
+ valueOf: err,
+ toString: err
+}, 2n, 'The result of (3n & {[Symbol.toPrimitive]: function() {return 2n;}, valueOf: err, toString: err}) is 2n');
+
+assert.sameValue({
+ valueOf: function() {
+ return 2n;
+ },
+
+ toString: err
+} & 3n, 2n, 'The result of (({valueOf: function() {return 2n;}, toString: err}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ valueOf: function() {
+ return 2n;
+ },
+
+ toString: err
+}, 2n, 'The result of (3n & {valueOf: function() {return 2n;}, toString: err}) is 2n');
+
+assert.sameValue({
+ toString: function() {
+ return 2n;
+ }
+} & 3n, 2n, 'The result of (({toString: function() {return 2n;}}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ toString: function() {
+ return 2n;
+ }
+}, 2n, 'The result of (3n & {toString: function() {return 2n;}}) is 2n');
+
+assert.sameValue({
+ [Symbol.toPrimitive]: undefined,
+
+ valueOf: function() {
+ return 2n;
+ }
+} & 3n, 2n, 'The result of (({[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ [Symbol.toPrimitive]: undefined,
+
+ valueOf: function() {
+ return 2n;
+ }
+}, 2n, 'The result of (3n & {[Symbol.toPrimitive]: undefined, valueOf: function() {return 2n;}}) is 2n');
+
+assert.sameValue({
+ [Symbol.toPrimitive]: null,
+
+ valueOf: function() {
+ return 2n;
+ }
+} & 3n, 2n, 'The result of (({[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ [Symbol.toPrimitive]: null,
+
+ valueOf: function() {
+ return 2n;
+ }
+}, 2n, 'The result of (3n & {[Symbol.toPrimitive]: null, valueOf: function() {return 2n;}}) is 2n');
+
+assert.sameValue({
+ valueOf: null,
+
+ toString: function() {
+ return 2n;
+ }
+} & 3n, 2n, 'The result of (({valueOf: null, toString: function() {return 2n;}}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ valueOf: null,
+
+ toString: function() {
+ return 2n;
+ }
+}, 2n, 'The result of (3n & {valueOf: null, toString: function() {return 2n;}}) is 2n');
+
+assert.sameValue({
+ valueOf: 1,
+
+ toString: function() {
+ return 2n;
+ }
+} & 3n, 2n, 'The result of (({valueOf: 1, toString: function() {return 2n;}}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ valueOf: 1,
+
+ toString: function() {
+ return 2n;
+ }
+}, 2n, 'The result of (3n & {valueOf: 1, toString: function() {return 2n;}}) is 2n');
+
+assert.sameValue({
+ valueOf: {},
+
+ toString: function() {
+ return 2n;
+ }
+} & 3n, 2n, 'The result of (({valueOf: {}, toString: function() {return 2n;}}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ valueOf: {},
+
+ toString: function() {
+ return 2n;
+ }
+}, 2n, 'The result of (3n & {valueOf: {}, toString: function() {return 2n;}}) is 2n');
+
+assert.sameValue({
+ valueOf: function() {
+ return {};
+ },
+
+ toString: function() {
+ return 2n;
+ }
+} & 3n, 2n, 'The result of (({valueOf: function() {return {};}, toString: function() {return 2n;}}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ valueOf: function() {
+ return {};
+ },
+
+ toString: function() {
+ return 2n;
+ }
+}, 2n, 'The result of (3n & {valueOf: function() {return {};}, toString: function() {return 2n;}}) is 2n');
+
+assert.sameValue({
+ valueOf: function() {
+ return Object(12345);
+ },
+
+ toString: function() {
+ return 2n;
+ }
+} & 3n, 2n, 'The result of (({valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ valueOf: function() {
+ return Object(12345);
+ },
+
+ toString: function() {
+ return 2n;
+ }
+}, 2n, 'The result of (3n & {valueOf: function() {return Object(12345);}, toString: function() {return 2n;}}) is 2n');
+
+assert.throws(TypeError, function() {
+ ({
+ [Symbol.toPrimitive]: 1
+ }) & 0n;
+}, '({[Symbol.toPrimitive]: 1}) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & {
+ [Symbol.toPrimitive]: 1
+ };
+}, '0n & {[Symbol.toPrimitive]: 1} throws TypeError');
+
+assert.throws(TypeError, function() {
+ ({
+ [Symbol.toPrimitive]: {}
+ }) & 0n;
+}, '({[Symbol.toPrimitive]: {}}) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & {
+ [Symbol.toPrimitive]: {}
+ };
+}, '0n & {[Symbol.toPrimitive]: {}} throws TypeError');
+
+assert.throws(TypeError, function() {
+ ({
+ [Symbol.toPrimitive]: function() {
+ return Object(1);
+ }
+ }) & 0n;
+}, '({[Symbol.toPrimitive]: function() {return Object(1);}}) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & {
+ [Symbol.toPrimitive]: function() {
+ return Object(1);
+ }
+ };
+}, '0n & {[Symbol.toPrimitive]: function() {return Object(1);}} throws TypeError');
+
+assert.throws(TypeError, function() {
+ ({
+ [Symbol.toPrimitive]: function() {
+ return {};
+ }
+ }) & 0n;
+}, '({[Symbol.toPrimitive]: function() {return {};}}) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & {
+ [Symbol.toPrimitive]: function() {
+ return {};
+ }
+ };
+}, '0n & {[Symbol.toPrimitive]: function() {return {};}} throws TypeError');
+
+assert.throws(MyError, function() {
+ ({
+ [Symbol.toPrimitive]: function() {
+ throw new MyError();
+ }
+ }) & 0n;
+}, '({[Symbol.toPrimitive]: function() {throw new MyError();}}) & 0n throws MyError');
+
+assert.throws(MyError, function() {
+ 0n & {
+ [Symbol.toPrimitive]: function() {
+ throw new MyError();
+ }
+ };
+}, '0n & {[Symbol.toPrimitive]: function() {throw new MyError();}} throws MyError');
+
+assert.throws(MyError, function() {
+ ({
+ valueOf: function() {
+ throw new MyError();
+ }
+ }) & 0n;
+}, '({valueOf: function() {throw new MyError();}}) & 0n throws MyError');
+
+assert.throws(MyError, function() {
+ 0n & {
+ valueOf: function() {
+ throw new MyError();
+ }
+ };
+}, '0n & {valueOf: function() {throw new MyError();}} throws MyError');
+
+assert.throws(MyError, function() {
+ ({
+ toString: function() {
+ throw new MyError();
+ }
+ }) & 0n;
+}, '({toString: function() {throw new MyError();}}) & 0n throws MyError');
+
+assert.throws(MyError, function() {
+ 0n & {
+ toString: function() {
+ throw new MyError();
+ }
+ };
+}, '0n & {toString: function() {throw new MyError();}} throws MyError');
+
+assert.throws(TypeError, function() {
+ ({
+ valueOf: null,
+ toString: null
+ }) & 0n;
+}, '({valueOf: null, toString: null}) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & {
+ valueOf: null,
+ toString: null
+ };
+}, '0n & {valueOf: null, toString: null} throws TypeError');
+
+assert.throws(TypeError, function() {
+ ({
+ valueOf: 1,
+ toString: 1
+ }) & 0n;
+}, '({valueOf: 1, toString: 1}) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & {
+ valueOf: 1,
+ toString: 1
+ };
+}, '0n & {valueOf: 1, toString: 1} throws TypeError');
+
+assert.throws(TypeError, function() {
+ ({
+ valueOf: {},
+ toString: {}
+ }) & 0n;
+}, '({valueOf: {}, toString: {}}) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & {
+ valueOf: {},
+ toString: {}
+ };
+}, '0n & {valueOf: {}, toString: {}} throws TypeError');
+
+assert.throws(TypeError, function() {
+ ({
+ valueOf: function() {
+ return Object(1);
+ },
+
+ toString: function() {
+ return Object(1);
+ }
+ }) & 0n;
+}, '({valueOf: function() {return Object(1);}, toString: function() {return Object(1);}}) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & {
+ valueOf: function() {
+ return Object(1);
+ },
+
+ toString: function() {
+ return Object(1);
+ }
+ };
+}, '0n & {valueOf: function() {return Object(1);}, toString: function() {return Object(1);}} throws TypeError');
+
+assert.throws(TypeError, function() {
+ ({
+ valueOf: function() {
+ return {};
+ },
+
+ toString: function() {
+ return {};
+ }
+ }) & 0n;
+}, '({valueOf: function() {return {};}, toString: function() {return {};}}) & 0n throws TypeError');
+
+assert.throws(TypeError, function() {
+ 0n & {
+ valueOf: function() {
+ return {};
+ },
+
+ toString: function() {
+ return {};
+ }
+ };
+}, '0n & {valueOf: function() {return {};}, toString: function() {return {};}} throws TypeError');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/bigint-wrapped-values.js b/js/src/tests/test262/language/expressions/bitwise-and/bigint-wrapped-values.js
new file mode 100644
index 0000000000..f8cb905f64
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/bigint-wrapped-values.js
@@ -0,0 +1,47 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: bitwise-and operator ToNumeric with BigInt operands
+esid: sec-binary-bitwise-operators-runtime-semantics-evaluation
+features: [BigInt, Symbol.toPrimitive, computed-property-names]
+---*/
+assert.sameValue(Object(2n) & 3n, 2n, 'The result of (Object(2n) & 3n) is 2n');
+assert.sameValue(3n & Object(2n), 2n, 'The result of (3n & Object(2n)) is 2n');
+
+assert.sameValue({
+ [Symbol.toPrimitive]: function() {
+ return 2n;
+ }
+} & 3n, 2n, 'The result of (({[Symbol.toPrimitive]: function() {return 2n;}}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ [Symbol.toPrimitive]: function() {
+ return 2n;
+ }
+}, 2n, 'The result of (3n & {[Symbol.toPrimitive]: function() {return 2n;}}) is 2n');
+
+assert.sameValue({
+ valueOf: function() {
+ return 2n;
+ }
+} & 3n, 2n, 'The result of (({valueOf: function() {return 2n;}}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ valueOf: function() {
+ return 2n;
+ }
+}, 2n, 'The result of (3n & {valueOf: function() {return 2n;}}) is 2n');
+
+assert.sameValue({
+ toString: function() {
+ return 2n;
+ }
+} & 3n, 2n, 'The result of (({toString: function() {return 2n;}}) & 3n) is 2n');
+
+assert.sameValue(3n & {
+ toString: function() {
+ return 2n;
+ }
+}, 2n, 'The result of (3n & {toString: function() {return 2n;}}) is 2n');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/bigint.js b/js/src/tests/test262/language/expressions/bitwise-and/bigint.js
new file mode 100644
index 0000000000..0b6c9fe48d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/bigint.js
@@ -0,0 +1,109 @@
+// Copyright (C) 2017 Josh Wolfe. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Bitwise AND for BigInt values
+esid: sec-bitwise-op
+info: |
+ BitwiseOp(op, x, y)
+
+ 1. Let result be 0.
+ 2. Let shift be 0.
+ 3. Repeat, until (x = 0 or x = -1) and (y = 0 or y = -1),
+ a. Let xDigit be x modulo 2.
+ b. Let yDigit be y modulo 2.
+ c. Let result be result + 2**shift * op(xDigit, yDigit)
+ d. Let shift be shift + 1.
+ e. Let x be (x - xDigit) / 2.
+ f. Let y be (y - yDigit) / 2.
+ 4. If op(x modulo 2, y modulo 2) ≠ 0,
+ a. Let result be result - 2**shift. NOTE: This extends the sign.
+ 5. Return result.
+
+features: [BigInt]
+---*/
+
+assert.sameValue(0b00n & 0b00n, 0b00n, "0b00n & 0b00n === 0b00n");
+assert.sameValue(0b00n & 0b01n, 0b00n, "0b00n & 0b01n === 0b00n");
+assert.sameValue(0b01n & 0b00n, 0b00n, "0b01n & 0b00n === 0b00n");
+assert.sameValue(0b00n & 0b10n, 0b00n, "0b00n & 0b10n === 0b00n");
+assert.sameValue(0b10n & 0b00n, 0b00n, "0b10n & 0b00n === 0b00n");
+assert.sameValue(0b00n & 0b11n, 0b00n, "0b00n & 0b11n === 0b00n");
+assert.sameValue(0b11n & 0b00n, 0b00n, "0b11n & 0b00n === 0b00n");
+assert.sameValue(0b01n & 0b01n, 0b01n, "0b01n & 0b01n === 0b01n");
+assert.sameValue(0b01n & 0b10n, 0b00n, "0b01n & 0b10n === 0b00n");
+assert.sameValue(0b10n & 0b01n, 0b00n, "0b10n & 0b01n === 0b00n");
+assert.sameValue(0b01n & 0b11n, 0b01n, "0b01n & 0b11n === 0b01n");
+assert.sameValue(0b11n & 0b01n, 0b01n, "0b11n & 0b01n === 0b01n");
+assert.sameValue(0b10n & 0b10n, 0b10n, "0b10n & 0b10n === 0b10n");
+assert.sameValue(0b10n & 0b11n, 0b10n, "0b10n & 0b11n === 0b10n");
+assert.sameValue(0b11n & 0b10n, 0b10n, "0b11n & 0b10n === 0b10n");
+assert.sameValue(0xffffffffn & 0n, 0n, "0xffffffffn & 0n === 0n");
+assert.sameValue(0n & 0xffffffffn, 0n, "0n & 0xffffffffn === 0n");
+assert.sameValue(0xffffffffn & 0xffffffffn, 0xffffffffn, "0xffffffffn & 0xffffffffn === 0xffffffffn");
+assert.sameValue(0xffffffffffffffffn & 0n, 0n, "0xffffffffffffffffn & 0n === 0n");
+assert.sameValue(0n & 0xffffffffffffffffn, 0n, "0n & 0xffffffffffffffffn === 0n");
+assert.sameValue(0xffffffffffffffffn & 0xffffffffn, 0xffffffffn, "0xffffffffffffffffn & 0xffffffffn === 0xffffffffn");
+assert.sameValue(0xffffffffn & 0xffffffffffffffffn, 0xffffffffn, "0xffffffffn & 0xffffffffffffffffn === 0xffffffffn");
+assert.sameValue(
+ 0xffffffffffffffffn & 0xffffffffffffffffn, 0xffffffffffffffffn,
+ "0xffffffffffffffffn & 0xffffffffffffffffn === 0xffffffffffffffffn");
+assert.sameValue(
+ 0xbf2ed51ff75d380fd3be813ec6185780n & 0x4aabef2324cedff5387f1f65n, 0x42092803008e813400181700n,
+ "0xbf2ed51ff75d380fd3be813ec6185780n & 0x4aabef2324cedff5387f1f65n === 0x42092803008e813400181700n");
+assert.sameValue(
+ 0x4aabef2324cedff5387f1f65n & 0xbf2ed51ff75d380fd3be813ec6185780n, 0x42092803008e813400181700n,
+ "0x4aabef2324cedff5387f1f65n & 0xbf2ed51ff75d380fd3be813ec6185780n === 0x42092803008e813400181700n");
+assert.sameValue(0n & -1n, 0n, "0n & -1n === 0n");
+assert.sameValue(-1n & 0n, 0n, "-1n & 0n === 0n");
+assert.sameValue(0n & -2n, 0n, "0n & -2n === 0n");
+assert.sameValue(-2n & 0n, 0n, "-2n & 0n === 0n");
+assert.sameValue(1n & -2n, 0n, "1n & -2n === 0n");
+assert.sameValue(-2n & 1n, 0n, "-2n & 1n === 0n");
+assert.sameValue(2n & -2n, 2n, "2n & -2n === 2n");
+assert.sameValue(-2n & 2n, 2n, "-2n & 2n === 2n");
+assert.sameValue(2n & -3n, 0n, "2n & -3n === 0n");
+assert.sameValue(-3n & 2n, 0n, "-3n & 2n === 0n");
+assert.sameValue(-1n & -2n, -2n, "-1n & -2n === -2n");
+assert.sameValue(-2n & -1n, -2n, "-2n & -1n === -2n");
+assert.sameValue(-2n & -2n, -2n, "-2n & -2n === -2n");
+assert.sameValue(-2n & -3n, -4n, "-2n & -3n === -4n");
+assert.sameValue(-3n & -2n, -4n, "-3n & -2n === -4n");
+assert.sameValue(0xffffffffn & -1n, 0xffffffffn, "0xffffffffn & -1n === 0xffffffffn");
+assert.sameValue(-1n & 0xffffffffn, 0xffffffffn, "-1n & 0xffffffffn === 0xffffffffn");
+assert.sameValue(0xffffffffffffffffn & -1n, 0xffffffffffffffffn, "0xffffffffffffffffn & -1n === 0xffffffffffffffffn");
+assert.sameValue(-1n & 0xffffffffffffffffn, 0xffffffffffffffffn, "-1n & 0xffffffffffffffffn === 0xffffffffffffffffn");
+assert.sameValue(
+ 0xbf2ed51ff75d380fd3be813ec6185780n & -0x4aabef2324cedff5387f1f65n, 0xbf2ed51fb554100cd330000ac6004080n,
+ "0xbf2ed51ff75d380fd3be813ec6185780n & -0x4aabef2324cedff5387f1f65n === 0xbf2ed51fb554100cd330000ac6004080n");
+assert.sameValue(
+ -0x4aabef2324cedff5387f1f65n & 0xbf2ed51ff75d380fd3be813ec6185780n, 0xbf2ed51fb554100cd330000ac6004080n,
+ "-0x4aabef2324cedff5387f1f65n & 0xbf2ed51ff75d380fd3be813ec6185780n === 0xbf2ed51fb554100cd330000ac6004080n");
+assert.sameValue(
+ -0xbf2ed51ff75d380fd3be813ec6185780n & 0x4aabef2324cedff5387f1f65n, 0x8a2c72024405ec138670800n,
+ "-0xbf2ed51ff75d380fd3be813ec6185780n & 0x4aabef2324cedff5387f1f65n === 0x8a2c72024405ec138670800n");
+assert.sameValue(
+ 0x4aabef2324cedff5387f1f65n & -0xbf2ed51ff75d380fd3be813ec6185780n, 0x8a2c72024405ec138670800n,
+ "0x4aabef2324cedff5387f1f65n & -0xbf2ed51ff75d380fd3be813ec6185780n === 0x8a2c72024405ec138670800n");
+assert.sameValue(
+ -0xbf2ed51ff75d380fd3be813ec6185780n & -0x4aabef2324cedff5387f1f65n, -0xbf2ed51fffffff2ff7fedffffe7f5f80n,
+ "-0xbf2ed51ff75d380fd3be813ec6185780n & -0x4aabef2324cedff5387f1f65n === -0xbf2ed51fffffff2ff7fedffffe7f5f80n");
+assert.sameValue(
+ -0x4aabef2324cedff5387f1f65n & -0xbf2ed51ff75d380fd3be813ec6185780n, -0xbf2ed51fffffff2ff7fedffffe7f5f80n,
+ "-0x4aabef2324cedff5387f1f65n & -0xbf2ed51ff75d380fd3be813ec6185780n === -0xbf2ed51fffffff2ff7fedffffe7f5f80n");
+assert.sameValue(-0xffffffffn & 0n, 0n, "-0xffffffffn & 0n === 0n");
+assert.sameValue(0n & -0xffffffffn, 0n, "0n & -0xffffffffn === 0n");
+assert.sameValue(
+ -0xffffffffffffffffn & 0x10000000000000000n, 0x10000000000000000n,
+ "-0xffffffffffffffffn & 0x10000000000000000n === 0x10000000000000000n");
+assert.sameValue(
+ 0x10000000000000000n & -0xffffffffffffffffn, 0x10000000000000000n,
+ "0x10000000000000000n & -0xffffffffffffffffn === 0x10000000000000000n");
+assert.sameValue(
+ -0xffffffffffffffffffffffffn & 0x10000000000000000n, 0n,
+ "-0xffffffffffffffffffffffffn & 0x10000000000000000n === 0n");
+assert.sameValue(
+ 0x10000000000000000n & -0xffffffffffffffffffffffffn, 0n,
+ "0x10000000000000000n & -0xffffffffffffffffffffffffn === 0n");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/browser.js b/js/src/tests/test262/language/expressions/bitwise-and/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/browser.js
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/order-of-evaluation.js b/js/src/tests/test262/language/expressions/bitwise-and/order-of-evaluation.js
new file mode 100644
index 0000000000..cde0cee550
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/order-of-evaluation.js
@@ -0,0 +1,140 @@
+// Copyright (C) 2018 Igalia, S.L. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-binary-bitwise-operators-runtime-semantics-evaluation
+description: Type coercion order of operations for bitwise-and operator
+features: [Symbol]
+info: |
+ Evaluate lhs
+ Evaluate rhs
+ ToNumeric(lhs)
+ ToNumeric(rhs)
+---*/
+
+function MyError() {}
+var trace;
+
+// ?GetValue(lhs) throws.
+trace = "";
+assert.throws(MyError, function() {
+ (function() {
+ trace += "1";
+ throw new MyError();
+ })() & (function() {
+ trace += "2";
+ throw new Test262Error("should not be evaluated");
+ })();
+}, "?GetValue(lhs) throws.");
+assert.sameValue(trace, "1", "?GetValue(lhs) throws.");
+
+// ?GetValue(rhs) throws.
+trace = "";
+assert.throws(MyError, function() {
+ (function() {
+ trace += "1";
+ return {
+ valueOf: function() {
+ trace += "3";
+ throw new Test262Error("should not be evaluated");
+ }
+ };
+ })() & (function() {
+ trace += "2";
+ throw new MyError();
+ })();
+}, "?GetValue(rhs) throws.");
+assert.sameValue(trace, "12", "?GetValue(rhs) throws.");
+
+// ?ToPrimive(lhs) throws.
+trace = "";
+assert.throws(MyError, function() {
+ (function() {
+ trace += "1";
+ return {
+ valueOf: function() {
+ trace += "3";
+ throw new MyError();
+ }
+ };
+ })() & (function() {
+ trace += "2";
+ return {
+ valueOf: function() {
+ trace += "4";
+ throw new Test262Error("should not be evaluated");
+ }
+ };
+ })();
+}, "?ToPrimive(lhs) throws.");
+assert.sameValue(trace, "123", "?ToPrimive(lhs) throws.");
+
+// ?ToPrimive(rhs) throws.
+trace = "";
+assert.throws(MyError, function() {
+ (function() {
+ trace += "1";
+ return {
+ valueOf: function() {
+ trace += "3";
+ return 1;
+ }
+ };
+ })() & (function() {
+ trace += "2";
+ return {
+ valueOf: function() {
+ trace += "4";
+ throw new MyError();
+ }
+ };
+ })();
+}, "?ToPrimive(rhs) throws.");
+assert.sameValue(trace, "1234", "?ToPrimive(rhs) throws.");
+
+// ?ToNumeric(lhs) throws.
+trace = "";
+assert.throws(TypeError, function() {
+ (function() {
+ trace += "1";
+ return {
+ valueOf: function() {
+ trace += "3";
+ return Symbol("1");
+ }
+ };
+ })() & (function() {
+ trace += "2";
+ return {
+ valueOf: function() {
+ trace += "4";
+ throw new Test262Error("should not be evaluated");
+ }
+ };
+ })();
+}, "?ToNumeric(lhs) throws.");
+assert.sameValue(trace, "123", "?ToNumeric(lhs) throws.");
+
+// GetValue(lhs) throws.
+trace = "";
+assert.throws(TypeError, function() {
+ (function() {
+ trace += "1";
+ return {
+ valueOf: function() {
+ trace += "3";
+ return 1;
+ }
+ };
+ })() & (function() {
+ trace += "2";
+ return {
+ valueOf: function() {
+ trace += "4";
+ return Symbol("1");
+ }
+ };
+ })();
+}, "GetValue(lhs) throws.");
+assert.sameValue(trace, "1234", "GetValue(lhs) throws.");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/bitwise-and/shell.js b/js/src/tests/test262/language/expressions/bitwise-and/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/bitwise-and/shell.js