Diff
Modified: trunk/JSTests/ChangeLog (232445 => 232446)
--- trunk/JSTests/ChangeLog 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/ChangeLog 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,3 +1,17 @@
+2018-06-02 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r232439.
+ https://bugs.webkit.org/show_bug.cgi?id=186238
+
+ It breaks gtk-linux-32-release (Requested by caiolima on
+ #webkit).
+
+ Reverted changeset:
+
+ "[ESNext][BigInt] Implement support for addition operations"
+ https://bugs.webkit.org/show_bug.cgi?id=179002
+ https://trac.webkit.org/changeset/232439
+
2018-06-01 Yusuke Suzuki <[email protected]>
Baseline op_jtrue emits an insane amount of code
Modified: trunk/JSTests/bigIntTests.yaml (232445 => 232446)
--- trunk/JSTests/bigIntTests.yaml 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/bigIntTests.yaml 2018-06-02 23:03:36 UTC (rev 232446)
@@ -187,38 +187,3 @@
- path: stress/big-int-mod-jit.js
cmd: runBigIntEnabled
-- path: stress/big-int-add-wrapped-value.js
- cmd: runBigIntEnabled
-
-- path: stress/big-int-addition-basic.js
- cmd: runBigIntEnabled
-
-- path: stress/big-int-addition-jit.js
- cmd: runBigIntEnabled
-
-- path: stress/big-int-addition-memory-stress.js
- cmd: runBigIntEnabled
-
-- path: stress/big-int-addition-string-coercion.js
- cmd: runBigIntEnabled
-
-- path: stress/big-int-addition-to-primitive-precedence.js
- cmd: runBigIntEnabled
-
-- path: stress/big-int-addition-to-primitive.js
- cmd: runBigIntEnabled
-
-- path: stress/big-int-addition-type-error.js
- cmd: runBigIntEnabled
-
-- path: stress/big-int-sub-wrapped-value.js
- cmd: runBigIntEnabled
-
-- path:stress/big-int-subtraction-basic.js
- cmd: runBigIntEnabled
-
-- path: stress/big-int-subtraction-jit.js
- cmd: runBigIntEnabled
-
-- path: stress/big-int-subtraction-type-error.js
- cmd: runBigIntEnabled
Deleted: trunk/JSTests/stress/addition-order-evaluation.js (232445 => 232446)
--- trunk/JSTests/stress/addition-order-evaluation.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/addition-order-evaluation.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,23 +0,0 @@
-function assert(a, message) {
- if (!a)
- throw new Error(message);
-}
-
-let o = {
- valueOf: function () { throw new Error("Oops"); }
-};
-
-try {
- let n = Symbol("3") + o;
- assert(false, message + ": Should throw Error, but executed without exception");
-} catch (e) {
- assert(e.message === "Oops","Expected Error('Oops'), got: " + e);
-}
-
-try {
- let n = o + Symbol("3");
- assert(false, message + ": Should throw Error, but executed without exception");
-} catch (e) {
- assert(e.message === "Oops","Expected Error('Oops'), got: " + e);
-}
-
Deleted: trunk/JSTests/stress/big-int-add-wrapped-value.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-add-wrapped-value.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-add-wrapped-value.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,37 +0,0 @@
-//@ runBigIntEnabled
-
-assert = {
- sameValue: function (input, expected, message) {
- if (input !== expected)
- throw new Error(message);
- }
-};
-
-function testAdd(x, y, z, message) {
- assert.sameValue(x + y, z, message);
- assert.sameValue(y + x, z, message);
-}
-
-testAdd(Object(2n), 1n, 3n, "ToPrimitive: unbox object with internal slot");
-
-let o = {
- [Symbol.toPrimitive]: function() {
- return 2n;
- }
-};
-testAdd(o, 1n, 3n, "ToPrimitive: @@toPrimitive");
-
-o = {
- valueOf: function() {
- return 2n;
- }
-};
-testAdd(o, 1n, 3n, "ToPrimitive: valueOf");
-
-o = {
- toString: function() {
- return 2n;
- }
-}
-testAdd(o, 1n, 3n, "ToPrimitive: toString");
-
Deleted: trunk/JSTests/stress/big-int-addition-basic.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-addition-basic.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-addition-basic.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,169 +0,0 @@
-//@ runBigIntEnabled
-
-assert = {
- sameValue: function (input, expected, message) {
- if (input !== expected)
- throw new Error(message);
- }
-};
-
-function testAdd(x, y, z) {
- assert.sameValue(x + y, z, x + " + " + y + " = " + z);
- assert.sameValue(y + x, z, y + " + " + x + " = " + z);
-}
-
-testAdd(10n, 239n, 249n);
-testAdd(0xFEDCBA9876543210n, 0xFEDCBA9876543210n, 0x1FDB97530ECA86420n);
-testAdd(0xFEDCBA9876543210n, 0xFEDCBA987654320Fn, 0x1FDB97530ECA8641Fn);
-testAdd(0xFEDCBA9876543210n, 0xFEDCBA98n, 0xFEDCBA997530ECA8n);
-testAdd(0xFEDCBA9876543210n, 0xFEDCBA97n, 0xFEDCBA997530ECA7n);
-testAdd(0xFEDCBA9876543210n, 0x1234n, 0xFEDCBA9876544444n);
-testAdd(0xFEDCBA9876543210n, 0x3n, 0xFEDCBA9876543213n);
-testAdd(0xFEDCBA9876543210n, 0x2n, 0xFEDCBA9876543212n);
-testAdd(0xFEDCBA9876543210n, 0x1n, 0xFEDCBA9876543211n);
-testAdd(0xFEDCBA9876543210n, 0x0n, 0xFEDCBA9876543210n);
-testAdd(0xFEDCBA9876543210n, -0x1n, 0xFEDCBA987654320Fn);
-testAdd(0xFEDCBA9876543210n, -0x2n, 0xFEDCBA987654320En);
-testAdd(0xFEDCBA9876543210n, -0x3n, 0xFEDCBA987654320Dn);
-testAdd(0xFEDCBA9876543210n, -0x1234n, 0xFEDCBA9876541FDCn);
-testAdd(0xFEDCBA9876543210n, -0xFEDCBA97n, 0xFEDCBA9777777779n);
-testAdd(0xFEDCBA9876543210n, -0xFEDCBA98n, 0xFEDCBA9777777778n);
-testAdd(0xFEDCBA9876543210n, -0xFEDCBA987654320Fn, 0x1n);
-testAdd(0xFEDCBA9876543210n, -0xFEDCBA9876543210n, 0x0n);
-testAdd(0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn, 0x1FDB97530ECA8641En);
-testAdd(0xFEDCBA987654320Fn, 0xFEDCBA98n, 0xFEDCBA997530ECA7n);
-testAdd(0xFEDCBA987654320Fn, 0xFEDCBA97n, 0xFEDCBA997530ECA6n);
-testAdd(0xFEDCBA987654320Fn, 0x1234n, 0xFEDCBA9876544443n);
-testAdd(0xFEDCBA987654320Fn, 0x3n, 0xFEDCBA9876543212n);
-testAdd(0xFEDCBA987654320Fn, 0x2n, 0xFEDCBA9876543211n);
-testAdd(0xFEDCBA987654320Fn, 0x1n, 0xFEDCBA9876543210n);
-testAdd(0xFEDCBA987654320Fn, 0x0n, 0xFEDCBA987654320Fn);
-testAdd(0xFEDCBA987654320Fn, -0x1n, 0xFEDCBA987654320En);
-testAdd(0xFEDCBA987654320Fn, -0x2n, 0xFEDCBA987654320Dn);
-testAdd(0xFEDCBA987654320Fn, -0x3n, 0xFEDCBA987654320Cn);
-testAdd(0xFEDCBA987654320Fn, -0x1234n, 0xFEDCBA9876541FDBn);
-testAdd(0xFEDCBA987654320Fn, -0xFEDCBA97n, 0xFEDCBA9777777778n);
-testAdd(0xFEDCBA987654320Fn, -0xFEDCBA98n, 0xFEDCBA9777777777n);
-testAdd(0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, 0x0n);
-testAdd(0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, -0x1n);
-testAdd(0xFEDCBA98n, 0xFEDCBA98n, 0x1FDB97530n);
-testAdd(0xFEDCBA98n, 0xFEDCBA97n, 0x1FDB9752Fn);
-testAdd(0xFEDCBA98n, 0x1234n, 0xFEDCCCCCn);
-testAdd(0xFEDCBA98n, 0x3n, 0xFEDCBA9Bn);
-testAdd(0xFEDCBA98n, 0x2n, 0xFEDCBA9An);
-testAdd(0xFEDCBA98n, 0x1n, 0xFEDCBA99n);
-testAdd(0xFEDCBA98n, 0x0n, 0xFEDCBA98n);
-testAdd(0xFEDCBA98n, -0x1n, 0xFEDCBA97n);
-testAdd(0xFEDCBA98n, -0x2n, 0xFEDCBA96n);
-testAdd(0xFEDCBA98n, -0x3n, 0xFEDCBA95n);
-testAdd(0xFEDCBA98n, -0x1234n, 0xFEDCA864n);
-testAdd(0xFEDCBA98n, -0xFEDCBA97n, 0x1n);
-testAdd(0xFEDCBA98n, -0xFEDCBA98n, 0x0n);
-testAdd(0xFEDCBA98n, -0xFEDCBA987654320Fn, -0xFEDCBA9777777777n);
-testAdd(0xFEDCBA98n, -0xFEDCBA9876543210n, -0xFEDCBA9777777778n);
-testAdd(0xFEDCBA97n, 0xFEDCBA97n, 0x1FDB9752En);
-testAdd(0xFEDCBA97n, 0x1234n, 0xFEDCCCCBn);
-testAdd(0xFEDCBA97n, 0x3n, 0xFEDCBA9An);
-testAdd(0xFEDCBA97n, 0x2n, 0xFEDCBA99n);
-testAdd(0xFEDCBA97n, 0x1n, 0xFEDCBA98n);
-testAdd(0xFEDCBA97n, 0x0n, 0xFEDCBA97n);
-testAdd(0xFEDCBA97n, -0x1n, 0xFEDCBA96n);
-testAdd(0xFEDCBA97n, -0x2n, 0xFEDCBA95n);
-testAdd(0xFEDCBA97n, -0x3n, 0xFEDCBA94n);
-testAdd(0xFEDCBA97n, -0x1234n, 0xFEDCA863n);
-testAdd(0xFEDCBA97n, -0xFEDCBA97n, 0x0n);
-testAdd(0xFEDCBA97n, -0xFEDCBA98n, -0x1n);
-testAdd(0xFEDCBA97n, -0xFEDCBA987654320Fn, -0xFEDCBA9777777778n);
-testAdd(0xFEDCBA97n, -0xFEDCBA9876543210n, -0xFEDCBA9777777779n);
-testAdd(0x1234n, 0x1234n, 0x2468n);
-testAdd(0x1234n, 0x3n, 0x1237n);
-testAdd(0x1234n, 0x2n, 0x1236n);
-testAdd(0x1234n, 0x1n, 0x1235n);
-testAdd(0x1234n, 0x0n, 0x1234n);
-testAdd(0x1234n, -0x1n, 0x1233n);
-testAdd(0x1234n, -0x2n, 0x1232n);
-testAdd(0x1234n, -0x3n, 0x1231n);
-testAdd(0x1234n, -0x1234n, 0x0n);
-testAdd(0x1234n, -0xFEDCBA97n, -0xFEDCA863n);
-testAdd(0x1234n, -0xFEDCBA98n, -0xFEDCA864n);
-testAdd(0x1234n, -0xFEDCBA987654320Fn, -0xFEDCBA9876541FDBn);
-testAdd(0x1234n, -0xFEDCBA9876543210n, -0xFEDCBA9876541FDCn);
-testAdd(0x3n, 0x3n, 0x6n);
-testAdd(0x3n, 0x2n, 0x5n);
-testAdd(0x3n, 0x1n, 0x4n);
-testAdd(0x3n, 0x0n, 0x3n);
-testAdd(0x3n, -0x1n, 0x2n);
-testAdd(0x3n, -0x2n, 0x1n);
-testAdd(0x3n, -0x3n, 0x0n);
-testAdd(0x3n, -0x1234n, -0x1231n);
-testAdd(0x3n, -0xFEDCBA97n, -0xFEDCBA94n);
-testAdd(0x3n, -0xFEDCBA98n, -0xFEDCBA95n);
-testAdd(0x3n, -0xFEDCBA987654320Fn, -0xFEDCBA987654320Cn);
-testAdd(0x3n, -0xFEDCBA9876543210n, -0xFEDCBA987654320Dn);
-testAdd(0x2n, 0x2n, 0x4n);
-testAdd(0x2n, 0x1n, 0x3n);
-testAdd(0x2n, 0x0n, 0x2n);
-testAdd(0x2n, -0x1n, 0x1n);
-testAdd(0x2n, -0x2n, 0x0n);
-testAdd(0x2n, -0x3n, -0x1n);
-testAdd(0x2n, -0x1234n, -0x1232n);
-testAdd(0x2n, -0xFEDCBA97n, -0xFEDCBA95n);
-testAdd(0x2n, -0xFEDCBA98n, -0xFEDCBA96n);
-testAdd(0x2n, -0xFEDCBA987654320Fn, -0xFEDCBA987654320Dn);
-testAdd(0x2n, -0xFEDCBA9876543210n, -0xFEDCBA987654320En);
-testAdd(0x1n, 0x1n, 0x2n);
-testAdd(0x1n, 0x0n, 0x1n);
-testAdd(0x1n, -0x1n, 0x0n);
-testAdd(0x1n, -0x2n, -0x1n);
-testAdd(0x1n, -0x3n, -0x2n);
-testAdd(0x1n, -0x1234n, -0x1233n);
-testAdd(0x1n, -0xFEDCBA97n, -0xFEDCBA96n);
-testAdd(0x1n, -0xFEDCBA98n, -0xFEDCBA97n);
-testAdd(0x1n, -0xFEDCBA987654320Fn, -0xFEDCBA987654320En);
-testAdd(0x1n, -0xFEDCBA9876543210n, -0xFEDCBA987654320Fn);
-testAdd(0x0n, 0x0n, 0x0n);
-testAdd(0x0n, -0x1n, -0x1n);
-testAdd(0x0n, -0x2n, -0x2n);
-testAdd(0x0n, -0x3n, -0x3n);
-testAdd(0x0n, -0x1234n, -0x1234n);
-testAdd(0x0n, -0xFEDCBA97n, -0xFEDCBA97n);
-testAdd(0x0n, -0xFEDCBA98n, -0xFEDCBA98n);
-testAdd(0x0n, -0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn);
-testAdd(0x0n, -0xFEDCBA9876543210n, -0xFEDCBA9876543210n);
-testAdd(-0x1n, -0x1n, -0x2n);
-testAdd(-0x1n, -0x2n, -0x3n);
-testAdd(-0x1n, -0x3n, -0x4n);
-testAdd(-0x1n, -0x1234n, -0x1235n);
-testAdd(-0x1n, -0xFEDCBA97n, -0xFEDCBA98n);
-testAdd(-0x1n, -0xFEDCBA98n, -0xFEDCBA99n);
-testAdd(-0x1n, -0xFEDCBA987654320Fn, -0xFEDCBA9876543210n);
-testAdd(-0x1n, -0xFEDCBA9876543210n, -0xFEDCBA9876543211n);
-testAdd(-0x2n, -0x2n, -0x4n);
-testAdd(-0x2n, -0x3n, -0x5n);
-testAdd(-0x2n, -0x1234n, -0x1236n);
-testAdd(-0x2n, -0xFEDCBA97n, -0xFEDCBA99n);
-testAdd(-0x2n, -0xFEDCBA98n, -0xFEDCBA9An);
-testAdd(-0x2n, -0xFEDCBA987654320Fn, -0xFEDCBA9876543211n);
-testAdd(-0x2n, -0xFEDCBA9876543210n, -0xFEDCBA9876543212n);
-testAdd(-0x3n, -0x3n, -0x6n);
-testAdd(-0x3n, -0x1234n, -0x1237n);
-testAdd(-0x3n, -0xFEDCBA97n, -0xFEDCBA9An);
-testAdd(-0x3n, -0xFEDCBA98n, -0xFEDCBA9Bn);
-testAdd(-0x3n, -0xFEDCBA987654320Fn, -0xFEDCBA9876543212n);
-testAdd(-0x3n, -0xFEDCBA9876543210n, -0xFEDCBA9876543213n);
-testAdd(-0x1234n, -0x1234n, -0x2468n);
-testAdd(-0x1234n, -0xFEDCBA97n, -0xFEDCCCCBn);
-testAdd(-0x1234n, -0xFEDCBA98n, -0xFEDCCCCCn);
-testAdd(-0x1234n, -0xFEDCBA987654320Fn, -0xFEDCBA9876544443n);
-testAdd(-0x1234n, -0xFEDCBA9876543210n, -0xFEDCBA9876544444n);
-testAdd(-0xFEDCBA97n, -0xFEDCBA97n, -0x1FDB9752En);
-testAdd(-0xFEDCBA97n, -0xFEDCBA98n, -0x1FDB9752Fn);
-testAdd(-0xFEDCBA97n, -0xFEDCBA987654320Fn, -0xFEDCBA997530ECA6n);
-testAdd(-0xFEDCBA97n, -0xFEDCBA9876543210n, -0xFEDCBA997530ECA7n);
-testAdd(-0xFEDCBA98n, -0xFEDCBA98n, -0x1FDB97530n);
-testAdd(-0xFEDCBA98n, -0xFEDCBA987654320Fn, -0xFEDCBA997530ECA7n);
-testAdd(-0xFEDCBA98n, -0xFEDCBA9876543210n, -0xFEDCBA997530ECA8n);
-testAdd(-0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, -0x1FDB97530ECA8641En);
-testAdd(-0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, -0x1FDB97530ECA8641Fn);
-testAdd(-0xFEDCBA9876543210n, -0xFEDCBA9876543210n, -0x1FDB97530ECA86420n);
-
Deleted: trunk/JSTests/stress/big-int-addition-jit.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-addition-jit.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-addition-jit.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,19 +0,0 @@
-//@ runBigIntEnabled
-
-let assert = {
- sameValue: function(i, e, m) {
- if (i !== e)
- throw new Error(m);
- }
-}
-
-function bigIntAddition(x, y) {
- return x + y;
-}
-noInline(bigIntAddition);
-
-for (let i = 0; i < 10000; i++) {
- let r = bigIntAddition(3n, 10n);
- assert.sameValue(r, 13n, 3n + " + " + 10n + " = " + r);
-}
-
Deleted: trunk/JSTests/stress/big-int-addition-memory-stress.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-addition-memory-stress.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-addition-memory-stress.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,14 +0,0 @@
-//@ runBigIntEnabled
-
-function assert(a) {
- if (!a)
- throw new Error("Bad assertion");
-}
-
-let a = 0n;
-for (let i = 0; i < 1000000; i++) {
- a += 30n;
-}
-
-assert(a === 30000000n);
-
Deleted: trunk/JSTests/stress/big-int-addition-string-coercion.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-addition-string-coercion.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-addition-string-coercion.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,25 +0,0 @@
-//@ runBigIntEnabled
-
-function assert(input, expected) {
- if (input !== expected)
- throw new Error("Bad!");
-}
-
-assert(-1n + "", "-1");
-assert("" + -1n, "-1");
-assert(0n + "", "0");
-assert("" + 0n, "0");
-assert(1n + "", "1");
-assert("" + 1n, "1");
-assert(123456789000000000000000n + "", "123456789000000000000000");
-assert("" + 123456789000000000000000n, "123456789000000000000000");
-assert(-123456789000000000000000n + "", "-123456789000000000000000");
-assert("" + -123456789000000000000000n, "-123456789000000000000000");
-
-assert([] + -123456789000000000000000n, "-123456789000000000000000");
-assert(-123456789000000000000000n + [], "-123456789000000000000000");
-
-let a = {};
-assert(a + 3n, "[object Object]3");
-assert(3n + a, "3[object Object]");
-
Deleted: trunk/JSTests/stress/big-int-addition-to-primitive-precedence.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-addition-to-primitive-precedence.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-addition-to-primitive-precedence.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,39 +0,0 @@
-//@ runBigIntEnabled
-
-assert = {
- sameValue: function (input, expected, message) {
- if (input !== expected)
- throw new Error(message);
- }
-};
-
-function testAdd(x, y, z, message) {
- assert.sameValue(x + y, z, message);
- assert.sameValue(y + x, z, message);
-}
-
-testAdd(Object(2n), 1n, 3n, "ToPrimitive: unbox object with internal slot");
-
-let o = {
- [Symbol.toPrimitive]: function() {
- return 2n;
- },
- valueOf: function () {
- throw new Error("Should never execute it");
- },
- toString: function () {
- throw new Error("Should never execute it");
- }
-};
-testAdd(o, 1n, 3n, "ToPrimitive: @@toPrimitive");
-
-o = {
- valueOf: function() {
- return 2n;
- },
- toString: function () {
- throw new Error("Should never execute it");
- }
-};
-testAdd(o, 1n, 3n, "ToPrimitive: valueOf");
-
Deleted: trunk/JSTests/stress/big-int-addition-to-primitive.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-addition-to-primitive.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-addition-to-primitive.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,39 +0,0 @@
-//@ runBigIntEnabled
-
-function assert(a) {
- if (!a)
- throw new Error("Bad assertion");
-}
-
-assert.sameValue = function (input, expected, message) {
- if (input !== expected)
- throw new Error(message);
-}
-
-function testAdd(x, y, z) {
- assert.sameValue(x + y, z, x + " + " + y + " = " + z);
- assert.sameValue(y + x, z, y + " + " + x + " = " + z);
-}
-
-let o = {
- [Symbol.toPrimitive]: function () { return 300000000000000n; }
-}
-
-testAdd(500000000000438n, o, 800000000000438n);
-
-o.valueOf = function () {
- throw new Error("Should never execute it");
-};
-
-testAdd(700000000000438n, o, 1000000000000438n);
-
-o.toString = function () {
- throw new Error("Should never execute it");
-};
-
-testAdd(700000000000438n, o, 1000000000000438n);
-
-delete o.valueOf;
-
-testAdd(700000000000438n, o, 1000000000000438n);
-
Deleted: trunk/JSTests/stress/big-int-addition-type-error.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-addition-type-error.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-addition-type-error.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,104 +0,0 @@
-//@ runBigIntEnabled
-
-function assert(a, message) {
- if (!a)
- throw new Error(message);
-}
-
-function assertThrowTypeError(a, b, message) {
- try {
- let n = a + b;
- assert(false, message + ": Should throw TypeError, but executed without exception");
- } catch (e) {
- assert(e instanceof TypeError, message + ": expected TypeError, got: " + e);
- }
-}
-
-assertThrowTypeError(30n, Symbol("foo"), "BigInt + Symbol");
-assertThrowTypeError(Symbol("bar"), 18757382984821n, "Symbol + BigInt");
-assertThrowTypeError(30n, 3320, "BigInt + Int32");
-assertThrowTypeError(33256, 18757382984821n, "Int32 + BigInt");
-assertThrowTypeError(30n, 0.543, "BigInt + Double");
-assertThrowTypeError(230.19293, 18757382984821n, "Double + BigInt");
-assertThrowTypeError(30n, NaN, "BigInt + NaN");
-assertThrowTypeError(NaN, 18757382984821n, "NaN + BigInt");
-assertThrowTypeError(30n, NaN, "BigInt + NaN");
-assertThrowTypeError(NaN, 18757382984821n, "NaN + BigInt");
-assertThrowTypeError(30n, +Infinity, "BigInt + NaN");
-assertThrowTypeError(+Infinity, 18757382984821n, "NaN + BigInt");
-assertThrowTypeError(30n, -Infinity, "BigInt + -Infinity");
-assertThrowTypeError(-Infinity, 18757382984821n, "-Infinity + BigInt");
-assertThrowTypeError(30n, null, "BigInt + null");
-assertThrowTypeError(null, 18757382984821n, "null + BigInt");
-assertThrowTypeError(30n, undefined, "BigInt + undefined");
-assertThrowTypeError(undefined, 18757382984821n, "undefined + BigInt");
-assertThrowTypeError(30n, true, "BigInt + true");
-assertThrowTypeError(true, 18757382984821n, "true + BigInt");
-assertThrowTypeError(30n, false, "BigInt + false");
-assertThrowTypeError(false, 18757382984821n, "false + BigInt");
-
-// Error when returning from object
-
-let o = {
- valueOf: function () { return Symbol("Foo"); }
-};
-
-assertThrowTypeError(30n, o, "BigInt + Object.valueOf returning Symbol");
-assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning Symbol + BigInt");
-
-o = {
- valueOf: function () { return 33256; }
-};
-
-assertThrowTypeError(30n, o, "BigInt + Object.valueOf returning Int32");
-assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning Int32 + BigInt");
-
-o = {
- valueOf: function () { return 0.453; }
-};
-
-assertThrowTypeError(30n, o, "BigInt + Object.valueOf returning Double");
-assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning Double + BigInt");
-
-o = {
- toString: function () { return Symbol("Foo"); }
-};
-
-assertThrowTypeError(30n, o, "BigInt + Object.toString returning Symbol");
-assertThrowTypeError(o, 18757382984821n, "Object.toString returning Symbol + BigInt");
-
-o = {
- toString: function () { return 33256; }
-};
-
-assertThrowTypeError(30n, o, "BigInt + Object.toString returning Int32");
-assertThrowTypeError(o, 18757382984821n, "Object.toString returning Int32 + BigInt");
-
-o = {
- toString: function () { return 0.453; }
-};
-
-assertThrowTypeError(30n, o, "BigInt + Object.toString returning Double");
-assertThrowTypeError(o, 18757382984821n, "Object.toString returning Double + BigInt");
-
-o = {
- [Symbol.toPrimitive]: function () { return Symbol("Foo"); }
-};
-
-assertThrowTypeError(30n, o, "BigInt + Object.@@toPrimitive returning Symbol");
-assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning Symbol + BigInt");
-
-o = {
- [Symbol.toPrimitive]: function () { return 33256; }
-};
-
-assertThrowTypeError(30n, o, "BigInt + Object.@@toPrimitive returning Int32");
-assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning Int32 + BigInt");
-
-o = {
- [Symbol.toPrimitive]: function () { return 0.453; }
-};
-
-assertThrowTypeError(30n, o, "BigInt + Object.@@toPrimitive returning Double");
-assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning Double + BigInt");
-
Modified: trunk/JSTests/stress/big-int-no-conversion-to-number.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-no-conversion-to-number.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-no-conversion-to-number.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -7,6 +7,6 @@
message = error.message;
}
-if (message !== "Invalid mix of BigInt and other type in addition.") {
+if (message !== "Conversion from 'BigInt' to 'number' is not allowed.") {
throw new Error("Error message has changed to something unexpected");
}
Deleted: trunk/JSTests/stress/big-int-sub-wrapped-value.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-sub-wrapped-value.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-sub-wrapped-value.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,36 +0,0 @@
-//@ runBigIntEnabled
-
-assert = {
- sameValue: function (input, expected, message) {
- if (input !== expected)
- throw new Error(message);
- }
-};
-
-function testSub(x, y, z, message) {
- assert.sameValue(x - y, z, message);
-}
-
-testSub(Object(2n), 1n, 1n, "ToPrimitive: unbox object with internal slot");
-
-let o = {
- [Symbol.toPrimitive]: function() {
- return 2n;
- }
-};
-testSub(o, 1n, 1n, "ToPrimitive: @@toPrimitive");
-
-o = {
- valueOf: function() {
- return 2n;
- }
-};
-testSub(o, 1n, 1n, "ToPrimitive: valueOf");
-
-o = {
- toString: function() {
- return 2n;
- }
-}
-testSub(o, 1n, 1n, "ToPrimitive: toString");
-
Deleted: trunk/JSTests/stress/big-int-subtraction-basic.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-subtraction-basic.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-subtraction-basic.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,303 +0,0 @@
-//@ runBigIntEnabled
-
-assert = {
- sameValue: function (input, expected, message) {
- if (input !== expected)
- throw new Error(message);
- }
-};
-
-function testSub(x, y, z) {
- assert.sameValue(x - y, z, x + " - " + y + " = " + z);
-}
-
-testSub(0xFEDCBA9876543210n, 0xFEDCBA9876543210n, 0x0n);
-testSub(0xFEDCBA9876543210n, 0xFEDCBA987654320Fn, 0x1n);
-testSub(0xFEDCBA9876543210n, 0xFEDCBA98n, 0xFEDCBA9777777778n);
-testSub(0xFEDCBA9876543210n, 0xFEDCBA97n, 0xFEDCBA9777777779n);
-testSub(0xFEDCBA9876543210n, 0x1234n, 0xFEDCBA9876541FDCn);
-testSub(0xFEDCBA9876543210n, 0x3n, 0xFEDCBA987654320Dn);
-testSub(0xFEDCBA9876543210n, 0x2n, 0xFEDCBA987654320En);
-testSub(0xFEDCBA9876543210n, 0x1n, 0xFEDCBA987654320Fn);
-testSub(0xFEDCBA9876543210n, 0x0n, 0xFEDCBA9876543210n);
-testSub(0xFEDCBA9876543210n, -0x1n, 0xFEDCBA9876543211n);
-testSub(0xFEDCBA9876543210n, -0x2n, 0xFEDCBA9876543212n);
-testSub(0xFEDCBA9876543210n, -0x3n, 0xFEDCBA9876543213n);
-testSub(0xFEDCBA9876543210n, -0x1234n, 0xFEDCBA9876544444n);
-testSub(0xFEDCBA9876543210n, -0xFEDCBA97n, 0xFEDCBA997530ECA7n);
-testSub(0xFEDCBA9876543210n, -0xFEDCBA98n, 0xFEDCBA997530ECA8n);
-testSub(0xFEDCBA9876543210n, -0xFEDCBA987654320Fn, 0x1FDB97530ECA8641Fn);
-testSub(0xFEDCBA9876543210n, -0xFEDCBA9876543210n, 0x1FDB97530ECA86420n);
-testSub(0xFEDCBA987654320Fn, 0xFEDCBA9876543210n, -0x1n);
-testSub(0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn, 0x0n);
-testSub(0xFEDCBA987654320Fn, 0xFEDCBA98n, 0xFEDCBA9777777777n);
-testSub(0xFEDCBA987654320Fn, 0xFEDCBA97n, 0xFEDCBA9777777778n);
-testSub(0xFEDCBA987654320Fn, 0x1234n, 0xFEDCBA9876541FDBn);
-testSub(0xFEDCBA987654320Fn, 0x3n, 0xFEDCBA987654320Cn);
-testSub(0xFEDCBA987654320Fn, 0x2n, 0xFEDCBA987654320Dn);
-testSub(0xFEDCBA987654320Fn, 0x1n, 0xFEDCBA987654320En);
-testSub(0xFEDCBA987654320Fn, 0x0n, 0xFEDCBA987654320Fn);
-testSub(0xFEDCBA987654320Fn, -0x1n, 0xFEDCBA9876543210n);
-testSub(0xFEDCBA987654320Fn, -0x2n, 0xFEDCBA9876543211n);
-testSub(0xFEDCBA987654320Fn, -0x3n, 0xFEDCBA9876543212n);
-testSub(0xFEDCBA987654320Fn, -0x1234n, 0xFEDCBA9876544443n);
-testSub(0xFEDCBA987654320Fn, -0xFEDCBA97n, 0xFEDCBA997530ECA6n);
-testSub(0xFEDCBA987654320Fn, -0xFEDCBA98n, 0xFEDCBA997530ECA7n);
-testSub(0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, 0x1FDB97530ECA8641En);
-testSub(0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, 0x1FDB97530ECA8641Fn);
-testSub(0xFEDCBA98n, 0xFEDCBA9876543210n, -0xFEDCBA9777777778n);
-testSub(0xFEDCBA98n, 0xFEDCBA987654320Fn, -0xFEDCBA9777777777n);
-testSub(0xFEDCBA98n, 0xFEDCBA98n, 0x0n);
-testSub(0xFEDCBA98n, 0xFEDCBA97n, 0x1n);
-testSub(0xFEDCBA98n, 0x1234n, 0xFEDCA864n);
-testSub(0xFEDCBA98n, 0x3n, 0xFEDCBA95n);
-testSub(0xFEDCBA98n, 0x2n, 0xFEDCBA96n);
-testSub(0xFEDCBA98n, 0x1n, 0xFEDCBA97n);
-testSub(0xFEDCBA98n, 0x0n, 0xFEDCBA98n);
-testSub(0xFEDCBA98n, -0x1n, 0xFEDCBA99n);
-testSub(0xFEDCBA98n, -0x2n, 0xFEDCBA9An);
-testSub(0xFEDCBA98n, -0x3n, 0xFEDCBA9Bn);
-testSub(0xFEDCBA98n, -0x1234n, 0xFEDCCCCCn);
-testSub(0xFEDCBA98n, -0xFEDCBA97n, 0x1FDB9752Fn);
-testSub(0xFEDCBA98n, -0xFEDCBA98n, 0x1FDB97530n);
-testSub(0xFEDCBA98n, -0xFEDCBA987654320Fn, 0xFEDCBA997530ECA7n);
-testSub(0xFEDCBA98n, -0xFEDCBA9876543210n, 0xFEDCBA997530ECA8n);
-testSub(0xFEDCBA97n, 0xFEDCBA9876543210n, -0xFEDCBA9777777779n);
-testSub(0xFEDCBA97n, 0xFEDCBA987654320Fn, -0xFEDCBA9777777778n);
-testSub(0xFEDCBA97n, 0xFEDCBA98n, -0x1n);
-testSub(0xFEDCBA97n, 0xFEDCBA97n, 0x0n);
-testSub(0xFEDCBA97n, 0x1234n, 0xFEDCA863n);
-testSub(0xFEDCBA97n, 0x3n, 0xFEDCBA94n);
-testSub(0xFEDCBA97n, 0x2n, 0xFEDCBA95n);
-testSub(0xFEDCBA97n, 0x1n, 0xFEDCBA96n);
-testSub(0xFEDCBA97n, 0x0n, 0xFEDCBA97n);
-testSub(0xFEDCBA97n, -0x1n, 0xFEDCBA98n);
-testSub(0xFEDCBA97n, -0x2n, 0xFEDCBA99n);
-testSub(0xFEDCBA97n, -0x3n, 0xFEDCBA9An);
-testSub(0xFEDCBA97n, -0x1234n, 0xFEDCCCCBn);
-testSub(0xFEDCBA97n, -0xFEDCBA97n, 0x1FDB9752En);
-testSub(0xFEDCBA97n, -0xFEDCBA98n, 0x1FDB9752Fn);
-testSub(0xFEDCBA97n, -0xFEDCBA987654320Fn, 0xFEDCBA997530ECA6n);
-testSub(0xFEDCBA97n, -0xFEDCBA9876543210n, 0xFEDCBA997530ECA7n);
-testSub(0x1234n, 0xFEDCBA9876543210n, -0xFEDCBA9876541FDCn);
-testSub(0x1234n, 0xFEDCBA987654320Fn, -0xFEDCBA9876541FDBn);
-testSub(0x1234n, 0xFEDCBA98n, -0xFEDCA864n);
-testSub(0x1234n, 0xFEDCBA97n, -0xFEDCA863n);
-testSub(0x1234n, 0x1234n, 0x0n);
-testSub(0x1234n, 0x3n, 0x1231n);
-testSub(0x1234n, 0x2n, 0x1232n);
-testSub(0x1234n, 0x1n, 0x1233n);
-testSub(0x1234n, 0x0n, 0x1234n);
-testSub(0x1234n, -0x1n, 0x1235n);
-testSub(0x1234n, -0x2n, 0x1236n);
-testSub(0x1234n, -0x3n, 0x1237n);
-testSub(0x1234n, -0x1234n, 0x2468n);
-testSub(0x1234n, -0xFEDCBA97n, 0xFEDCCCCBn);
-testSub(0x1234n, -0xFEDCBA98n, 0xFEDCCCCCn);
-testSub(0x1234n, -0xFEDCBA987654320Fn, 0xFEDCBA9876544443n);
-testSub(0x1234n, -0xFEDCBA9876543210n, 0xFEDCBA9876544444n);
-testSub(0x3n, 0xFEDCBA9876543210n, -0xFEDCBA987654320Dn);
-testSub(0x3n, 0xFEDCBA987654320Fn, -0xFEDCBA987654320Cn);
-testSub(0x3n, 0xFEDCBA98n, -0xFEDCBA95n);
-testSub(0x3n, 0xFEDCBA97n, -0xFEDCBA94n);
-testSub(0x3n, 0x1234n, -0x1231n);
-testSub(0x3n, 0x3n, 0x0n);
-testSub(0x3n, 0x2n, 0x1n);
-testSub(0x3n, 0x1n, 0x2n);
-testSub(0x3n, 0x0n, 0x3n);
-testSub(0x3n, -0x1n, 0x4n);
-testSub(0x3n, -0x2n, 0x5n);
-testSub(0x3n, -0x3n, 0x6n);
-testSub(0x3n, -0x1234n, 0x1237n);
-testSub(0x3n, -0xFEDCBA97n, 0xFEDCBA9An);
-testSub(0x3n, -0xFEDCBA98n, 0xFEDCBA9Bn);
-testSub(0x3n, -0xFEDCBA987654320Fn, 0xFEDCBA9876543212n);
-testSub(0x3n, -0xFEDCBA9876543210n, 0xFEDCBA9876543213n);
-testSub(0x2n, 0xFEDCBA9876543210n, -0xFEDCBA987654320En);
-testSub(0x2n, 0xFEDCBA987654320Fn, -0xFEDCBA987654320Dn);
-testSub(0x2n, 0xFEDCBA98n, -0xFEDCBA96n);
-testSub(0x2n, 0xFEDCBA97n, -0xFEDCBA95n);
-testSub(0x2n, 0x1234n, -0x1232n);
-testSub(0x2n, 0x3n, -0x1n);
-testSub(0x2n, 0x2n, 0x0n);
-testSub(0x2n, 0x1n, 0x1n);
-testSub(0x2n, 0x0n, 0x2n);
-testSub(0x2n, -0x1n, 0x3n);
-testSub(0x2n, -0x2n, 0x4n);
-testSub(0x2n, -0x3n, 0x5n);
-testSub(0x2n, -0x1234n, 0x1236n);
-testSub(0x2n, -0xFEDCBA97n, 0xFEDCBA99n);
-testSub(0x2n, -0xFEDCBA98n, 0xFEDCBA9An);
-testSub(0x2n, -0xFEDCBA987654320Fn, 0xFEDCBA9876543211n);
-testSub(0x2n, -0xFEDCBA9876543210n, 0xFEDCBA9876543212n);
-testSub(0x1n, 0xFEDCBA9876543210n, -0xFEDCBA987654320Fn);
-testSub(0x1n, 0xFEDCBA987654320Fn, -0xFEDCBA987654320En);
-testSub(0x1n, 0xFEDCBA98n, -0xFEDCBA97n);
-testSub(0x1n, 0xFEDCBA97n, -0xFEDCBA96n);
-testSub(0x1n, 0x1234n, -0x1233n);
-testSub(0x1n, 0x3n, -0x2n);
-testSub(0x1n, 0x2n, -0x1n);
-testSub(0x1n, 0x1n, 0x0n);
-testSub(0x1n, 0x0n, 0x1n);
-testSub(0x1n, -0x1n, 0x2n);
-testSub(0x1n, -0x2n, 0x3n);
-testSub(0x1n, -0x3n, 0x4n);
-testSub(0x1n, -0x1234n, 0x1235n);
-testSub(0x1n, -0xFEDCBA97n, 0xFEDCBA98n);
-testSub(0x1n, -0xFEDCBA98n, 0xFEDCBA99n);
-testSub(0x1n, -0xFEDCBA987654320Fn, 0xFEDCBA9876543210n);
-testSub(0x1n, -0xFEDCBA9876543210n, 0xFEDCBA9876543211n);
-testSub(0x0n, 0xFEDCBA9876543210n, -0xFEDCBA9876543210n);
-testSub(0x0n, 0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn);
-testSub(0x0n, 0xFEDCBA98n, -0xFEDCBA98n);
-testSub(0x0n, 0xFEDCBA97n, -0xFEDCBA97n);
-testSub(0x0n, 0x1234n, -0x1234n);
-testSub(0x0n, 0x3n, -0x3n);
-testSub(0x0n, 0x2n, -0x2n);
-testSub(0x0n, 0x1n, -0x1n);
-testSub(0x0n, 0x0n, 0x0n);
-testSub(0x0n, -0x1n, 0x1n);
-testSub(0x0n, -0x2n, 0x2n);
-testSub(0x0n, -0x3n, 0x3n);
-testSub(0x0n, -0x1234n, 0x1234n);
-testSub(0x0n, -0xFEDCBA97n, 0xFEDCBA97n);
-testSub(0x0n, -0xFEDCBA98n, 0xFEDCBA98n);
-testSub(0x0n, -0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn);
-testSub(0x0n, -0xFEDCBA9876543210n, 0xFEDCBA9876543210n);
-testSub(-0x1n, 0xFEDCBA9876543210n, -0xFEDCBA9876543211n);
-testSub(-0x1n, 0xFEDCBA987654320Fn, -0xFEDCBA9876543210n);
-testSub(-0x1n, 0xFEDCBA98n, -0xFEDCBA99n);
-testSub(-0x1n, 0xFEDCBA97n, -0xFEDCBA98n);
-testSub(-0x1n, 0x1234n, -0x1235n);
-testSub(-0x1n, 0x3n, -0x4n);
-testSub(-0x1n, 0x2n, -0x3n);
-testSub(-0x1n, 0x1n, -0x2n);
-testSub(-0x1n, 0x0n, -0x1n);
-testSub(-0x1n, -0x1n, 0x0n);
-testSub(-0x1n, -0x2n, 0x1n);
-testSub(-0x1n, -0x3n, 0x2n);
-testSub(-0x1n, -0x1234n, 0x1233n);
-testSub(-0x1n, -0xFEDCBA97n, 0xFEDCBA96n);
-testSub(-0x1n, -0xFEDCBA98n, 0xFEDCBA97n);
-testSub(-0x1n, -0xFEDCBA987654320Fn, 0xFEDCBA987654320En);
-testSub(-0x1n, -0xFEDCBA9876543210n, 0xFEDCBA987654320Fn);
-testSub(-0x2n, 0xFEDCBA9876543210n, -0xFEDCBA9876543212n);
-testSub(-0x2n, 0xFEDCBA987654320Fn, -0xFEDCBA9876543211n);
-testSub(-0x2n, 0xFEDCBA98n, -0xFEDCBA9An);
-testSub(-0x2n, 0xFEDCBA97n, -0xFEDCBA99n);
-testSub(-0x2n, 0x1234n, -0x1236n);
-testSub(-0x2n, 0x3n, -0x5n);
-testSub(-0x2n, 0x2n, -0x4n);
-testSub(-0x2n, 0x1n, -0x3n);
-testSub(-0x2n, 0x0n, -0x2n);
-testSub(-0x2n, -0x1n, -0x1n);
-testSub(-0x2n, -0x2n, 0x0n);
-testSub(-0x2n, -0x3n, 0x1n);
-testSub(-0x2n, -0x1234n, 0x1232n);
-testSub(-0x2n, -0xFEDCBA97n, 0xFEDCBA95n);
-testSub(-0x2n, -0xFEDCBA98n, 0xFEDCBA96n);
-testSub(-0x2n, -0xFEDCBA987654320Fn, 0xFEDCBA987654320Dn);
-testSub(-0x2n, -0xFEDCBA9876543210n, 0xFEDCBA987654320En);
-testSub(-0x3n, 0xFEDCBA9876543210n, -0xFEDCBA9876543213n);
-testSub(-0x3n, 0xFEDCBA987654320Fn, -0xFEDCBA9876543212n);
-testSub(-0x3n, 0xFEDCBA98n, -0xFEDCBA9Bn);
-testSub(-0x3n, 0xFEDCBA97n, -0xFEDCBA9An);
-testSub(-0x3n, 0x1234n, -0x1237n);
-testSub(-0x3n, 0x3n, -0x6n);
-testSub(-0x3n, 0x2n, -0x5n);
-testSub(-0x3n, 0x1n, -0x4n);
-testSub(-0x3n, 0x0n, -0x3n);
-testSub(-0x3n, -0x1n, -0x2n);
-testSub(-0x3n, -0x2n, -0x1n);
-testSub(-0x3n, -0x3n, 0x0n);
-testSub(-0x3n, -0x1234n, 0x1231n);
-testSub(-0x3n, -0xFEDCBA97n, 0xFEDCBA94n);
-testSub(-0x3n, -0xFEDCBA98n, 0xFEDCBA95n);
-testSub(-0x3n, -0xFEDCBA987654320Fn, 0xFEDCBA987654320Cn);
-testSub(-0x3n, -0xFEDCBA9876543210n, 0xFEDCBA987654320Dn);
-testSub(-0x1234n, 0xFEDCBA9876543210n, -0xFEDCBA9876544444n);
-testSub(-0x1234n, 0xFEDCBA987654320Fn, -0xFEDCBA9876544443n);
-testSub(-0x1234n, 0xFEDCBA98n, -0xFEDCCCCCn);
-testSub(-0x1234n, 0xFEDCBA97n, -0xFEDCCCCBn);
-testSub(-0x1234n, 0x1234n, -0x2468n);
-testSub(-0x1234n, 0x3n, -0x1237n);
-testSub(-0x1234n, 0x2n, -0x1236n);
-testSub(-0x1234n, 0x1n, -0x1235n);
-testSub(-0x1234n, 0x0n, -0x1234n);
-testSub(-0x1234n, -0x1n, -0x1233n);
-testSub(-0x1234n, -0x2n, -0x1232n);
-testSub(-0x1234n, -0x3n, -0x1231n);
-testSub(-0x1234n, -0x1234n, 0x0n);
-testSub(-0x1234n, -0xFEDCBA97n, 0xFEDCA863n);
-testSub(-0x1234n, -0xFEDCBA98n, 0xFEDCA864n);
-testSub(-0x1234n, -0xFEDCBA987654320Fn, 0xFEDCBA9876541FDBn);
-testSub(-0x1234n, -0xFEDCBA9876543210n, 0xFEDCBA9876541FDCn);
-testSub(-0xFEDCBA97n, 0xFEDCBA9876543210n, -0xFEDCBA997530ECA7n);
-testSub(-0xFEDCBA97n, 0xFEDCBA987654320Fn, -0xFEDCBA997530ECA6n);
-testSub(-0xFEDCBA97n, 0xFEDCBA98n, -0x1FDB9752Fn);
-testSub(-0xFEDCBA97n, 0xFEDCBA97n, -0x1FDB9752En);
-testSub(-0xFEDCBA97n, 0x1234n, -0xFEDCCCCBn);
-testSub(-0xFEDCBA97n, 0x3n, -0xFEDCBA9An);
-testSub(-0xFEDCBA97n, 0x2n, -0xFEDCBA99n);
-testSub(-0xFEDCBA97n, 0x1n, -0xFEDCBA98n);
-testSub(-0xFEDCBA97n, 0x0n, -0xFEDCBA97n);
-testSub(-0xFEDCBA97n, -0x1n, -0xFEDCBA96n);
-testSub(-0xFEDCBA97n, -0x2n, -0xFEDCBA95n);
-testSub(-0xFEDCBA97n, -0x3n, -0xFEDCBA94n);
-testSub(-0xFEDCBA97n, -0x1234n, -0xFEDCA863n);
-testSub(-0xFEDCBA97n, -0xFEDCBA97n, 0x0n);
-testSub(-0xFEDCBA97n, -0xFEDCBA98n, 0x1n);
-testSub(-0xFEDCBA97n, -0xFEDCBA987654320Fn, 0xFEDCBA9777777778n);
-testSub(-0xFEDCBA97n, -0xFEDCBA9876543210n, 0xFEDCBA9777777779n);
-testSub(-0xFEDCBA98n, 0xFEDCBA9876543210n, -0xFEDCBA997530ECA8n);
-testSub(-0xFEDCBA98n, 0xFEDCBA987654320Fn, -0xFEDCBA997530ECA7n);
-testSub(-0xFEDCBA98n, 0xFEDCBA98n, -0x1FDB97530n);
-testSub(-0xFEDCBA98n, 0xFEDCBA97n, -0x1FDB9752Fn);
-testSub(-0xFEDCBA98n, 0x1234n, -0xFEDCCCCCn);
-testSub(-0xFEDCBA98n, 0x3n, -0xFEDCBA9Bn);
-testSub(-0xFEDCBA98n, 0x2n, -0xFEDCBA9An);
-testSub(-0xFEDCBA98n, 0x1n, -0xFEDCBA99n);
-testSub(-0xFEDCBA98n, 0x0n, -0xFEDCBA98n);
-testSub(-0xFEDCBA98n, -0x1n, -0xFEDCBA97n);
-testSub(-0xFEDCBA98n, -0x2n, -0xFEDCBA96n);
-testSub(-0xFEDCBA98n, -0x3n, -0xFEDCBA95n);
-testSub(-0xFEDCBA98n, -0x1234n, -0xFEDCA864n);
-testSub(-0xFEDCBA98n, -0xFEDCBA97n, -0x1n);
-testSub(-0xFEDCBA98n, -0xFEDCBA98n, 0x0n);
-testSub(-0xFEDCBA98n, -0xFEDCBA987654320Fn, 0xFEDCBA9777777777n);
-testSub(-0xFEDCBA98n, -0xFEDCBA9876543210n, 0xFEDCBA9777777778n);
-testSub(-0xFEDCBA987654320Fn, 0xFEDCBA9876543210n, -0x1FDB97530ECA8641Fn);
-testSub(-0xFEDCBA987654320Fn, 0xFEDCBA987654320Fn, -0x1FDB97530ECA8641En);
-testSub(-0xFEDCBA987654320Fn, 0xFEDCBA98n, -0xFEDCBA997530ECA7n);
-testSub(-0xFEDCBA987654320Fn, 0xFEDCBA97n, -0xFEDCBA997530ECA6n);
-testSub(-0xFEDCBA987654320Fn, 0x1234n, -0xFEDCBA9876544443n);
-testSub(-0xFEDCBA987654320Fn, 0x3n, -0xFEDCBA9876543212n);
-testSub(-0xFEDCBA987654320Fn, 0x2n, -0xFEDCBA9876543211n);
-testSub(-0xFEDCBA987654320Fn, 0x1n, -0xFEDCBA9876543210n);
-testSub(-0xFEDCBA987654320Fn, 0x0n, -0xFEDCBA987654320Fn);
-testSub(-0xFEDCBA987654320Fn, -0x1n, -0xFEDCBA987654320En);
-testSub(-0xFEDCBA987654320Fn, -0x2n, -0xFEDCBA987654320Dn);
-testSub(-0xFEDCBA987654320Fn, -0x3n, -0xFEDCBA987654320Cn);
-testSub(-0xFEDCBA987654320Fn, -0x1234n, -0xFEDCBA9876541FDBn);
-testSub(-0xFEDCBA987654320Fn, -0xFEDCBA97n, -0xFEDCBA9777777778n);
-testSub(-0xFEDCBA987654320Fn, -0xFEDCBA98n, -0xFEDCBA9777777777n);
-testSub(-0xFEDCBA987654320Fn, -0xFEDCBA987654320Fn, 0x0n);
-testSub(-0xFEDCBA987654320Fn, -0xFEDCBA9876543210n, 0x1n);
-testSub(-0xFEDCBA9876543210n, 0xFEDCBA9876543210n, -0x1FDB97530ECA86420n);
-testSub(-0xFEDCBA9876543210n, 0xFEDCBA987654320Fn, -0x1FDB97530ECA8641Fn);
-testSub(-0xFEDCBA9876543210n, 0xFEDCBA98n, -0xFEDCBA997530ECA8n);
-testSub(-0xFEDCBA9876543210n, 0xFEDCBA97n, -0xFEDCBA997530ECA7n);
-testSub(-0xFEDCBA9876543210n, 0x1234n, -0xFEDCBA9876544444n);
-testSub(-0xFEDCBA9876543210n, 0x3n, -0xFEDCBA9876543213n);
-testSub(-0xFEDCBA9876543210n, 0x2n, -0xFEDCBA9876543212n);
-testSub(-0xFEDCBA9876543210n, 0x1n, -0xFEDCBA9876543211n);
-testSub(-0xFEDCBA9876543210n, 0x0n, -0xFEDCBA9876543210n);
-testSub(-0xFEDCBA9876543210n, -0x1n, -0xFEDCBA987654320Fn);
-testSub(-0xFEDCBA9876543210n, -0x2n, -0xFEDCBA987654320En);
-testSub(-0xFEDCBA9876543210n, -0x3n, -0xFEDCBA987654320Dn);
-testSub(-0xFEDCBA9876543210n, -0x1234n, -0xFEDCBA9876541FDCn);
-testSub(-0xFEDCBA9876543210n, -0xFEDCBA97n, -0xFEDCBA9777777779n);
-testSub(-0xFEDCBA9876543210n, -0xFEDCBA98n, -0xFEDCBA9777777778n);
-testSub(-0xFEDCBA9876543210n, -0xFEDCBA987654320Fn, -0x1n);
-testSub(-0xFEDCBA9876543210n, -0xFEDCBA9876543210n, 0x0n);
-
Deleted: trunk/JSTests/stress/big-int-subtraction-jit.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-subtraction-jit.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-subtraction-jit.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,19 +0,0 @@
-//@ runBigIntEnabled
-
-let assert = {
- sameValue: function(i, e, m) {
- if (i !== e)
- throw new Error(m);
- }
-}
-
-function bigIntAddition(x, y) {
- return x - y;
-}
-noInline(bigIntAddition);
-
-for (let i = 0; i < 10000; i++) {
- let r = bigIntAddition(3n, 10n);
- assert.sameValue(r, -7n, 3n + " - " + 10n + " = " + r);
-}
-
Deleted: trunk/JSTests/stress/big-int-subtraction-type-error.js (232445 => 232446)
--- trunk/JSTests/stress/big-int-subtraction-type-error.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/big-int-subtraction-type-error.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,125 +0,0 @@
-//@ runBigIntEnabled
-
-function assert(a, message) {
- if (!a)
- throw new Error(message);
-}
-
-function assertThrowTypeError(a, b, message) {
- try {
- let n = a - b;
- assert(false, message + ": Should throw TypeError, but executed without exception");
- } catch (e) {
- assert(e instanceof TypeError, message + ": expected TypeError, got: " + e);
- }
-}
-
-assertThrowTypeError(30n, Symbol("foo"), "BingInt - Symbol");
-assertThrowTypeError(Symbol("bar"), 18757382984821n, "Symbol - BigInt");
-assertThrowTypeError(30n, 3320, "BingInt - Int32");
-assertThrowTypeError(33256, 18757382984821n, "Int32 - BigInt");
-assertThrowTypeError(30n, 0.543, "BingInt - Double");
-assertThrowTypeError(230.19293, 18757382984821n, "Double - BigInt");
-assertThrowTypeError(18757382984821n, "abc", "BigInt - String");
-assertThrowTypeError("def", 18757382984821n, "String - BigInt");
-assertThrowTypeError(18757382984821n, "", "BigInt - Empty String");
-assertThrowTypeError("", 18757382984821n, "Empty - BigInt");
-assertThrowTypeError(18757382984821n, NaN, "BigInt - NaN");
-assertThrowTypeError(NaN, 18757382984821n, "NaN - BigInt");
-assertThrowTypeError(18757382984821n, undefined, "BigInt - undefined");
-assertThrowTypeError(undefined, 18757382984821n, "undefined - BigInt");
-assertThrowTypeError(18757382984821n, true, "BigInt - true");
-assertThrowTypeError(true, 18757382984821n, "true - BigInt");
-assertThrowTypeError(18757382984821n, false, "BigInt - false");
-assertThrowTypeError(false, 18757382984821n, "false - BigInt");
-assertThrowTypeError(18757382984821n, +Infinity, "BigInt - Infinity");
-assertThrowTypeError(+Infinity, 18757382984821n, "Infinity - BigInt");
-assertThrowTypeError(18757382984821n, -Infinity, "BigInt - -Infinity");
-assertThrowTypeError(-Infinity, 18757382984821n, "-Infinity - BigInt");
-
-// Error when returning from object
-
-let o = {
- valueOf: function () { return Symbol("Foo"); }
-};
-
-assertThrowTypeError(30n, o, "BingInt - Object.valueOf returning Symbol");
-assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning Symbol - BigInt");
-
-o = {
- valueOf: function () { return 33256; }
-};
-
-assertThrowTypeError(30n, o, "BingInt - Object.valueOf returning Int32");
-assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning Int32 - BigInt");
-
-o = {
- valueOf: function () { return 0.453; }
-};
-
-assertThrowTypeError(30n, o, "BingInt - Object.valueOf returning Double");
-assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning Double - BigInt");
-
-o = {
- valueOf: function () { return ""; }
-};
-
-assertThrowTypeError(30n, o, "BingInt - Object.valueOf returning String");
-assertThrowTypeError(o, 18757382984821n, "Object.valueOf returning String - BigInt");
-
-o = {
- toString: function () { return Symbol("Foo"); }
-};
-
-assertThrowTypeError(30n, o, "BingInt - Object.toString returning Symbol");
-assertThrowTypeError(o, 18757382984821n, "Object.toString returning Symbol - BigInt");
-
-o = {
- toString: function () { return 33256; }
-};
-
-assertThrowTypeError(30n, o, "BingInt - Object.toString returning Int32");
-assertThrowTypeError(o, 18757382984821n, "Object.toString returning Int32 - BigInt");
-
-o = {
- toString: function () { return 0.453; }
-};
-
-assertThrowTypeError(30n, o, "BingInt - Object.toString returning Double");
-assertThrowTypeError(o, 18757382984821n, "Object.toString returning Double - BigInt");
-
-o = {
- toString: function () { return "abc"; }
-};
-
-assertThrowTypeError(30n, o, "BingInt - Object.toString returning String");
-assertThrowTypeError(o, 18757382984821n, "Object.toString returning String - BigInt");
-
-o = {
- [Symbol.toPrimitive]: function () { return Symbol("Foo"); }
-};
-
-assertThrowTypeError(30n, o, "BingInt - Object.@@toPrimitive returning Symbol");
-assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning Symbol - BigInt");
-
-o = {
- [Symbol.toPrimitive]: function () { return 33256; }
-};
-
-assertThrowTypeError(30n, o, "BingInt - Object.@@toPrimitive returning Int32");
-assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning Int32 - BigInt");
-
-o = {
- [Symbol.toPrimitive]: function () { return 0.453; }
-};
-
-assertThrowTypeError(30n, o, "BingInt - Object.@@toPrimitive returning Double");
-assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning Double - BigInt");
-
-o = {
- [Symbol.toPrimitive]: function () { return "Abc"; }
-};
-
-assertThrowTypeError(30n, o, "BingInt - Object.@@toPrimitive returning String");
-assertThrowTypeError(o, 18757382984821n, "Object.@@toPrimitive returning String - BigInt");
-
Deleted: trunk/JSTests/stress/sub-order-evaluation.js (232445 => 232446)
--- trunk/JSTests/stress/sub-order-evaluation.js 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/JSTests/stress/sub-order-evaluation.js 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,27 +0,0 @@
-function assert(a, message) {
- if (!a)
- throw new Error(message);
-}
-
-function assertThrowTypeError(a, b, message) {
- try {
- let n = a - b;
- assert(false, message + ": Should throw TypeError, but executed without exception");
- } catch (e) {
- assert(e instanceof TypeError, message + ": expected TypeError, got: " + e);
- }
-}
-
-let o = {
- valueOf: function () { throw new Error("Oops"); }
-};
-
-assertThrowTypeError(Symbol("3"), o, "Symbol + Object should throw TypeError");
-
-try {
- let n = o - Symbol("3");
- assert(false, message + ": Should throw Error, but executed without exception");
-} catch (e) {
- assert(e.message === "Oops","Expected Error('Oops'), got: " + e);
-}
-
Modified: trunk/Source/_javascript_Core/ChangeLog (232445 => 232446)
--- trunk/Source/_javascript_Core/ChangeLog 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/Source/_javascript_Core/ChangeLog 2018-06-02 23:03:36 UTC (rev 232446)
@@ -1,3 +1,17 @@
+2018-06-02 Commit Queue <[email protected]>
+
+ Unreviewed, rolling out r232439.
+ https://bugs.webkit.org/show_bug.cgi?id=186238
+
+ It breaks gtk-linux-32-release (Requested by caiolima on
+ #webkit).
+
+ Reverted changeset:
+
+ "[ESNext][BigInt] Implement support for addition operations"
+ https://bugs.webkit.org/show_bug.cgi?id=179002
+ https://trac.webkit.org/changeset/232439
+
2018-06-01 Yusuke Suzuki <[email protected]>
Baseline op_jtrue emits an insane amount of code
Modified: trunk/Source/_javascript_Core/jit/JITOperations.cpp (232445 => 232446)
--- trunk/Source/_javascript_Core/jit/JITOperations.cpp 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/Source/_javascript_Core/jit/JITOperations.cpp 2018-06-02 23:03:36 UTC (rev 232446)
@@ -2816,16 +2816,22 @@
return JSValue::encode(jsNumber(-number));
}
-ALWAYS_INLINE static EncodedJSValue unprofiledSub(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2)
+ALWAYS_INLINE static EncodedJSValue unprofiledSub(VM& vm, ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2)
{
+ auto scope = DECLARE_THROW_SCOPE(vm);
JSValue op1 = JSValue::decode(encodedOp1);
JSValue op2 = JSValue::decode(encodedOp2);
-
- return JSValue::encode(jsSub(exec, op1, op2));
+
+ double a = op1.toNumber(exec);
+ RETURN_IF_EXCEPTION(scope, encodedJSValue());
+ scope.release();
+ double b = op2.toNumber(exec);
+ return JSValue::encode(jsNumber(a - b));
}
-ALWAYS_INLINE static EncodedJSValue profiledSub(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true)
+ALWAYS_INLINE static EncodedJSValue profiledSub(VM& vm, ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile& arithProfile, bool shouldObserveLHSAndRHSTypes = true)
{
+ auto scope = DECLARE_THROW_SCOPE(vm);
JSValue op1 = JSValue::decode(encodedOp1);
JSValue op2 = JSValue::decode(encodedOp2);
@@ -2832,7 +2838,12 @@
if (shouldObserveLHSAndRHSTypes)
arithProfile.observeLHSAndRHS(op1, op2);
- JSValue result = jsSub(exec, op1, op2);
+ double a = op1.toNumber(exec);
+ RETURN_IF_EXCEPTION(scope, encodedJSValue());
+ double b = op2.toNumber(exec);
+ RETURN_IF_EXCEPTION(scope, encodedJSValue());
+
+ JSValue result = jsNumber(a - b);
arithProfile.observeResult(result);
return JSValue::encode(result);
}
@@ -2841,7 +2852,7 @@
{
VM* vm = &exec->vm();
NativeCallFrameTracer tracer(vm, exec);
- return unprofiledSub(exec, encodedOp1, encodedOp2);
+ return unprofiledSub(*vm, exec, encodedOp1, encodedOp2);
}
EncodedJSValue JIT_OPERATION operationValueSubProfiled(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, ArithProfile* arithProfile)
@@ -2851,7 +2862,7 @@
VM* vm = &exec->vm();
NativeCallFrameTracer tracer(vm, exec);
- return profiledSub(exec, encodedOp1, encodedOp2, *arithProfile);
+ return profiledSub(*vm, exec, encodedOp1, encodedOp2, *arithProfile);
}
EncodedJSValue JIT_OPERATION operationValueSubOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC* subIC)
@@ -2868,7 +2879,7 @@
exec->codeBlock()->dumpMathICStats();
#endif
- return unprofiledSub(exec, encodedOp1, encodedOp2);
+ return unprofiledSub(*vm, exec, encodedOp1, encodedOp2);
}
EncodedJSValue JIT_OPERATION operationValueSubNoOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC*)
@@ -2876,7 +2887,7 @@
VM* vm = &exec->vm();
NativeCallFrameTracer tracer(vm, exec);
- return unprofiledSub(exec, encodedOp1, encodedOp2);
+ return unprofiledSub(*vm, exec, encodedOp1, encodedOp2);
}
EncodedJSValue JIT_OPERATION operationValueSubProfiledOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC* subIC)
@@ -2894,7 +2905,7 @@
exec->codeBlock()->dumpMathICStats();
#endif
- return profiledSub(exec, encodedOp1, encodedOp2, *arithProfile, false);
+ return profiledSub(*vm, exec, encodedOp1, encodedOp2, *arithProfile, false);
}
EncodedJSValue JIT_OPERATION operationValueSubProfiledNoOptimize(ExecState* exec, EncodedJSValue encodedOp1, EncodedJSValue encodedOp2, JITSubIC* subIC)
@@ -2904,7 +2915,7 @@
ArithProfile* arithProfile = subIC->arithProfile();
ASSERT(arithProfile);
- return profiledSub(exec, encodedOp1, encodedOp2, *arithProfile);
+ return profiledSub(*vm, exec, encodedOp1, encodedOp2, *arithProfile);
}
void JIT_OPERATION operationProcessTypeProfilerLog(ExecState* exec)
Modified: trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp (232445 => 232446)
--- trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/Source/_javascript_Core/runtime/CommonSlowPaths.cpp 2018-06-02 23:03:36 UTC (rev 232446)
@@ -405,7 +405,7 @@
CHECK_EXCEPTION();
if (primValue.isBigInt()) {
- JSBigInt* result = JSBigInt::unaryMinus(vm, asBigInt(primValue));
+ JSBigInt* result = JSBigInt::unaryMinus(exec->vm(), asBigInt(primValue));
RETURN_WITH_PROFILING(result, {
updateArithProfileForUnaryArithOp(pc, result, operand);
});
@@ -517,24 +517,10 @@
BEGIN();
JSValue left = OP_C(2).jsValue();
JSValue right = OP_C(3).jsValue();
- auto leftNumeric = left.toNumeric(exec);
- CHECK_EXCEPTION();
- auto rightNumeric = right.toNumeric(exec);
- CHECK_EXCEPTION();
-
- if (WTF::holds_alternative<JSBigInt*>(leftNumeric) || WTF::holds_alternative<JSBigInt*>(rightNumeric)) {
- if (WTF::holds_alternative<JSBigInt*>(leftNumeric) && WTF::holds_alternative<JSBigInt*>(rightNumeric)) {
- JSBigInt* result = JSBigInt::sub(vm, WTF::get<JSBigInt*>(leftNumeric), WTF::get<JSBigInt*>(rightNumeric));
- RETURN_WITH_PROFILING(result, {
- updateArithProfileForBinaryArithOp(exec, pc, result, left, right);
- });
- }
-
- THROW(createTypeError(exec, "Invalid mix of BigInt and other type in subtraction."));
- }
-
- double a = WTF::get<double>(leftNumeric);
- double b = WTF::get<double>(rightNumeric);
+ double a = left.toNumber(exec);
+ if (UNLIKELY(throwScope.exception()))
+ RETURN(JSValue());
+ double b = right.toNumber(exec);
JSValue result = jsNumber(a - b);
RETURN_WITH_PROFILING(result, {
updateArithProfileForBinaryArithOp(exec, pc, result, left, right);
@@ -553,7 +539,7 @@
if (WTF::holds_alternative<JSBigInt*>(leftNumeric) || WTF::holds_alternative<JSBigInt*>(rightNumeric)) {
if (WTF::holds_alternative<JSBigInt*>(leftNumeric) && WTF::holds_alternative<JSBigInt*>(rightNumeric)) {
- JSBigInt* result = JSBigInt::divide(exec, WTF::get<JSBigInt*>(leftNumeric), WTF::get<JSBigInt*>(rightNumeric));
+ JSValue result(JSBigInt::divide(exec, WTF::get<JSBigInt*>(leftNumeric), WTF::get<JSBigInt*>(rightNumeric)));
CHECK_EXCEPTION();
RETURN_WITH_PROFILING(result, {
updateArithProfileForBinaryArithOp(exec, pc, result, left, right);
Modified: trunk/Source/_javascript_Core/runtime/JSBigInt.cpp (232445 => 232446)
--- trunk/Source/_javascript_Core/runtime/JSBigInt.cpp 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/Source/_javascript_Core/runtime/JSBigInt.cpp 2018-06-02 23:03:36 UTC (rev 232446)
@@ -195,31 +195,31 @@
return { };
}
-JSBigInt* JSBigInt::parseInt(ExecState* exec, StringView s, ErrorParseMode parserMode)
+JSBigInt* JSBigInt::parseInt(ExecState* state, StringView s, ErrorParseMode parserMode)
{
if (s.is8Bit())
- return parseInt(exec, s.characters8(), s.length(), parserMode);
- return parseInt(exec, s.characters16(), s.length(), parserMode);
+ return parseInt(state, s.characters8(), s.length(), parserMode);
+ return parseInt(state, s.characters16(), s.length(), parserMode);
}
-JSBigInt* JSBigInt::parseInt(ExecState* exec, VM& vm, StringView s, uint8_t radix, ErrorParseMode parserMode, ParseIntSign sign)
+JSBigInt* JSBigInt::parseInt(ExecState* state, VM& vm, StringView s, uint8_t radix, ErrorParseMode parserMode, ParseIntSign sign)
{
if (s.is8Bit())
- return parseInt(exec, vm, s.characters8(), s.length(), 0, radix, parserMode, sign, ParseIntMode::DisallowEmptyString);
- return parseInt(exec, vm, s.characters16(), s.length(), 0, radix, parserMode, sign, ParseIntMode::DisallowEmptyString);
+ return parseInt(state, vm, s.characters8(), s.length(), 0, radix, parserMode, sign, ParseIntMode::DisallowEmptyString);
+ return parseInt(state, vm, s.characters16(), s.length(), 0, radix, parserMode, sign, ParseIntMode::DisallowEmptyString);
}
-JSBigInt* JSBigInt::stringToBigInt(ExecState* exec, StringView s)
+JSBigInt* JSBigInt::stringToBigInt(ExecState* state, StringView s)
{
- return parseInt(exec, s, ErrorParseMode::IgnoreExceptions);
+ return parseInt(state, s, ErrorParseMode::IgnoreExceptions);
}
-String JSBigInt::toString(ExecState* exec, unsigned radix)
+String JSBigInt::toString(ExecState* state, unsigned radix)
{
if (this->isZero())
- return exec->vm().smallStrings.singleCharacterStringRep('0');
+ return state->vm().smallStrings.singleCharacterStringRep('0');
- return toStringGeneric(exec, this, radix);
+ return toStringGeneric(state, this, radix);
}
inline bool JSBigInt::isZero()
@@ -237,9 +237,9 @@
internalMultiplyAdd(this, factor, summand, length(), this);
}
-JSBigInt* JSBigInt::multiply(ExecState* exec, JSBigInt* x, JSBigInt* y)
+JSBigInt* JSBigInt::multiply(ExecState* state, JSBigInt* x, JSBigInt* y)
{
- VM& vm = exec->vm();
+ VM& vm = state->vm();
if (x->isZero())
return x;
@@ -257,14 +257,14 @@
return result->rightTrim(vm);
}
-JSBigInt* JSBigInt::divide(ExecState* exec, JSBigInt* x, JSBigInt* y)
+JSBigInt* JSBigInt::divide(ExecState* state, JSBigInt* x, JSBigInt* y)
{
// 1. If y is 0n, throw a RangeError exception.
- VM& vm = exec->vm();
+ VM& vm = state->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
if (y->isZero()) {
- throwRangeError(exec, scope, ASCIILiteral("0 is an invalid divisor value."));
+ throwRangeError(state, scope, ASCIILiteral("0 is an invalid divisor value."));
return nullptr;
}
@@ -310,14 +310,14 @@
return result;
}
-JSBigInt* JSBigInt::remainder(ExecState* exec, JSBigInt* x, JSBigInt* y)
+JSBigInt* JSBigInt::remainder(ExecState* state, JSBigInt* x, JSBigInt* y)
{
// 1. If y is 0n, throw a RangeError exception.
- VM& vm = exec->vm();
+ VM& vm = state->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
if (y->isZero()) {
- throwRangeError(exec, scope, ASCIILiteral("0 is an invalid divisor value."));
+ throwRangeError(state, scope, ASCIILiteral("0 is an invalid divisor value."));
return nullptr;
}
@@ -346,41 +346,7 @@
return remainder->rightTrim(vm);
}
-JSBigInt* JSBigInt::add(VM& vm, JSBigInt* x, JSBigInt* y)
-{
- bool xSign = x->sign();
- // x + y == x + y
- // -x + -y == -(x + y)
- if (xSign == y->sign())
- return absoluteAdd(vm, x, y, xSign);
-
- // x + -y == x - y == -(y - x)
- // -x + y == y - x == -(x - y)
- ComparisonResult comparisonResult = absoluteCompare(x, y);
- if (comparisonResult == ComparisonResult::GreaterThan || comparisonResult == ComparisonResult::Equal)
- return absoluteSub(vm, x, y, xSign);
-
- return absoluteSub(vm, y, x, !xSign);
-}
-
-JSBigInt* JSBigInt::sub(VM& vm, JSBigInt* x, JSBigInt* y)
-{
- bool xSign = x->sign();
- if (xSign != y->sign()) {
- // x - (-y) == x + y
- // (-x) - y == -(x + y)
- return absoluteAdd(vm, x, y, xSign);
- }
- // x - y == -(y - x)
- // (-x) - (-y) == y - x == -(x - y)
- ComparisonResult comparisonResult = absoluteCompare(x, y);
- if (comparisonResult == ComparisonResult::GreaterThan || comparisonResult == ComparisonResult::Equal)
- return absoluteSub(vm, x, y, xSign);
-
- return absoluteSub(vm, y, x, !xSign);
-}
-
#if USE(JSVALUE32_64)
#define HAVE_TWO_DIGIT 1
typedef uint64_t TwoDigit;
@@ -678,85 +644,6 @@
return x->digit(i) > y->digit(i) ? ComparisonResult::GreaterThan : ComparisonResult::LessThan;
}
-JSBigInt* JSBigInt::absoluteAdd(VM& vm, JSBigInt* x, JSBigInt* y, bool resultSign)
-{
- if (x->length() < y->length())
- return absoluteAdd(vm, y, x, resultSign);
-
- if (x->isZero()) {
- ASSERT(y->isZero());
- return x;
- }
-
- if (y->isZero())
- return resultSign == x->sign() ? x : unaryMinus(vm, x);
-
- JSBigInt* result = JSBigInt::createWithLength(vm, x->length() + 1);
- ASSERT(result);
- Digit carry = 0;
- unsigned i = 0;
- for (; i < y->length(); i++) {
- Digit newCarry = 0;
- Digit sum = digitAdd(x->digit(i), y->digit(i), newCarry);
- sum = digitAdd(sum, carry, newCarry);
- result->setDigit(i, sum);
- carry = newCarry;
- }
-
- for (; i < x->length(); i++) {
- Digit newCarry = 0;
- Digit sum = digitAdd(x->digit(i), carry, newCarry);
- result->setDigit(i, sum);
- carry = newCarry;
- }
-
- result->setDigit(i, carry);
- result->setSign(resultSign);
-
- return result->rightTrim(vm);
-}
-
-JSBigInt* JSBigInt::absoluteSub(VM& vm, JSBigInt* x, JSBigInt* y, bool resultSign)
-{
- ComparisonResult comparisonResult = absoluteCompare(x, y);
- ASSERT(x->length() >= y->length());
- ASSERT(comparisonResult == ComparisonResult::GreaterThan || comparisonResult == ComparisonResult::Equal);
-
- if (x->isZero()) {
- ASSERT(y->isZero());
- return x;
- }
-
- if (y->isZero())
- return resultSign == x->sign() ? x : unaryMinus(vm, x);
-
- if (comparisonResult == ComparisonResult::Equal)
- return JSBigInt::createZero(vm);
-
- JSBigInt* result = JSBigInt::createWithLength(vm, x->length());
- Digit borrow = 0;
- unsigned i = 0;
- for (; i < y->length(); i++) {
- Digit newBorrow = 0;
- Digit difference = digitSub(x->digit(i), y->digit(i), newBorrow);
- difference = digitSub(difference, borrow, newBorrow);
- result->setDigit(i, difference);
- borrow = newBorrow;
- }
-
- for (; i < x->length(); i++) {
- Digit newBorrow = 0;
- Digit difference = digitSub(x->digit(i), borrow, newBorrow);
- result->setDigit(i, difference);
- borrow = newBorrow;
- }
-
- ASSERT(!borrow);
- result->setSign(resultSign);
- result->rightTrim(vm);
- return result;
-}
-
// Divides {x} by {divisor}, returning the result in {quotient} and {remainder}.
// Mathematically, the contract is:
// quotient = (x - remainder) / divisor, with 0 <= remainder < divisor.
@@ -1041,13 +928,13 @@
return maximumCharactersRequired;
}
-String JSBigInt::toStringGeneric(ExecState* exec, JSBigInt* x, unsigned radix)
+String JSBigInt::toStringGeneric(ExecState* state, JSBigInt* x, unsigned radix)
{
// FIXME: [JSC] Revisit usage of Vector into JSBigInt::toString
// https://bugs.webkit.org/show_bug.cgi?id=18067
Vector<LChar> resultString;
- VM& vm = exec->vm();
+ VM& vm = state->vm();
ASSERT(radix >= 2 && radix <= 36);
ASSERT(!x->isZero());
@@ -1060,7 +947,7 @@
if (maximumCharactersRequired > JSString::MaxLength) {
auto scope = DECLARE_THROW_SCOPE(vm);
- throwOutOfMemoryError(exec, scope);
+ throwOutOfMemoryError(state, scope);
return String();
}
@@ -1155,7 +1042,7 @@
return trimmedBigInt;
}
-JSBigInt* JSBigInt::allocateFor(ExecState* exec, VM& vm, unsigned radix, unsigned charcount)
+JSBigInt* JSBigInt::allocateFor(ExecState* state, VM& vm, unsigned radix, unsigned charcount)
{
ASSERT(2 <= radix && radix <= 36);
@@ -1177,9 +1064,9 @@
}
}
- if (exec) {
+ if (state) {
auto scope = DECLARE_THROW_SCOPE(vm);
- throwOutOfMemoryError(exec, scope);
+ throwOutOfMemoryError(state, scope);
}
return nullptr;
}
@@ -1189,18 +1076,18 @@
return Base::estimatedSize(cell) + jsCast<JSBigInt*>(cell)->m_length * sizeof(Digit);
}
-double JSBigInt::toNumber(ExecState* exec) const
+double JSBigInt::toNumber(ExecState* state) const
{
- VM& vm = exec->vm();
+ VM& vm = state->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
- throwTypeError(exec, scope, ASCIILiteral("Conversion from 'BigInt' to 'number' is not allowed."));
+ throwTypeError(state, scope, ASCIILiteral("Conversion from 'BigInt' to 'number' is not allowed."));
return 0.0;
}
-bool JSBigInt::getPrimitiveNumber(ExecState* exec, double& number, JSValue& result) const
+bool JSBigInt::getPrimitiveNumber(ExecState* state, double& number, JSValue& result) const
{
result = this;
- number = toNumber(exec);
+ number = toNumber(state);
return true;
}
@@ -1210,9 +1097,9 @@
}
template <typename CharType>
-JSBigInt* JSBigInt::parseInt(ExecState* exec, CharType* data, unsigned length, ErrorParseMode errorParseMode)
+JSBigInt* JSBigInt::parseInt(ExecState* state, CharType* data, unsigned length, ErrorParseMode errorParseMode)
{
- VM& vm = exec->vm();
+ VM& vm = state->vm();
unsigned p = 0;
while (p < length && isStrWhiteSpace(data[p]))
@@ -1221,13 +1108,13 @@
// Check Radix from frist characters
if (static_cast<unsigned>(p) + 1 < static_cast<unsigned>(length) && data[p] == '0') {
if (isASCIIAlphaCaselessEqual(data[p + 1], 'b'))
- return parseInt(exec, vm, data, length, p + 2, 2, errorParseMode, ParseIntSign::Unsigned, ParseIntMode::DisallowEmptyString);
+ return parseInt(state, vm, data, length, p + 2, 2, errorParseMode, ParseIntSign::Unsigned, ParseIntMode::DisallowEmptyString);
if (isASCIIAlphaCaselessEqual(data[p + 1], 'x'))
- return parseInt(exec, vm, data, length, p + 2, 16, errorParseMode, ParseIntSign::Unsigned, ParseIntMode::DisallowEmptyString);
+ return parseInt(state, vm, data, length, p + 2, 16, errorParseMode, ParseIntSign::Unsigned, ParseIntMode::DisallowEmptyString);
if (isASCIIAlphaCaselessEqual(data[p + 1], 'o'))
- return parseInt(exec, vm, data, length, p + 2, 8, errorParseMode, ParseIntSign::Unsigned, ParseIntMode::DisallowEmptyString);
+ return parseInt(state, vm, data, length, p + 2, 8, errorParseMode, ParseIntSign::Unsigned, ParseIntMode::DisallowEmptyString);
}
ParseIntSign sign = ParseIntSign::Unsigned;
@@ -1240,7 +1127,7 @@
}
}
- JSBigInt* result = parseInt(exec, vm, data, length, p, 10, errorParseMode, sign);
+ JSBigInt* result = parseInt(state, vm, data, length, p, 10, errorParseMode, sign);
if (result && !result->isZero())
result->setSign(sign == ParseIntSign::Signed);
@@ -1249,7 +1136,7 @@
}
template <typename CharType>
-JSBigInt* JSBigInt::parseInt(ExecState* exec, VM& vm, CharType* data, unsigned length, unsigned startIndex, unsigned radix, ErrorParseMode errorParseMode, ParseIntSign sign, ParseIntMode parseMode)
+JSBigInt* JSBigInt::parseInt(ExecState* state, VM& vm, CharType* data, unsigned length, unsigned startIndex, unsigned radix, ErrorParseMode errorParseMode, ParseIntSign sign, ParseIntMode parseMode)
{
ASSERT(length >= 0);
unsigned p = startIndex;
@@ -1257,9 +1144,9 @@
auto scope = DECLARE_THROW_SCOPE(vm);
if (parseMode != ParseIntMode::AllowEmptyString && startIndex == length) {
- ASSERT(exec);
+ ASSERT(state);
if (errorParseMode == ErrorParseMode::ThrowExceptions)
- throwVMError(exec, scope, createSyntaxError(exec, "Failed to parse String to BigInt"));
+ throwVMError(state, scope, createSyntaxError(state, "Failed to parse String to BigInt"));
return nullptr;
}
@@ -1281,7 +1168,7 @@
unsigned limita = 'a' + (radix - 10);
unsigned limitA = 'A' + (radix - 10);
- JSBigInt* result = allocateFor(exec, vm, radix, length - p);
+ JSBigInt* result = allocateFor(state, vm, radix, length - p);
RETURN_IF_EXCEPTION(scope, nullptr);
result->initialize(InitializationType::WithZero);
@@ -1304,9 +1191,9 @@
if (p == length)
return result->rightTrim(vm);
- ASSERT(exec);
+ ASSERT(state);
if (errorParseMode == ErrorParseMode::ThrowExceptions)
- throwVMError(exec, scope, createSyntaxError(exec, "Failed to parse String to BigInt"));
+ throwVMError(state, scope, createSyntaxError(state, "Failed to parse String to BigInt"));
return nullptr;
}
Modified: trunk/Source/_javascript_Core/runtime/JSBigInt.h (232445 => 232446)
--- trunk/Source/_javascript_Core/runtime/JSBigInt.h 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/Source/_javascript_Core/runtime/JSBigInt.h 2018-06-02 23:03:36 UTC (rev 232446)
@@ -107,8 +107,6 @@
ComparisonResult static compareToDouble(JSBigInt* x, double y);
- static JSBigInt* add(VM&, JSBigInt* x, JSBigInt* y);
- static JSBigInt* sub(VM&, JSBigInt* x, JSBigInt* y);
static JSBigInt* divide(ExecState*, JSBigInt* x, JSBigInt* y);
static JSBigInt* remainder(ExecState*, JSBigInt* x, JSBigInt* y);
static JSBigInt* unaryMinus(VM&, JSBigInt* x);
@@ -171,8 +169,6 @@
JSBigInt* rightTrim(VM&);
void inplaceMultiplyAdd(Digit multiplier, Digit part);
- static JSBigInt* absoluteAdd(VM&, JSBigInt* x, JSBigInt* y, bool resultSign);
- static JSBigInt* absoluteSub(VM&, JSBigInt* x, JSBigInt* y, bool resultSign);
static size_t allocationSize(unsigned length);
static size_t offsetOfData();
Modified: trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h (232445 => 232446)
--- trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/Source/_javascript_Core/runtime/JSCJSValueInlines.h 2018-06-02 23:03:36 UTC (rev 232446)
@@ -25,7 +25,6 @@
#pragma once
-#include "CatchScope.h"
#include "Error.h"
#include "ExceptionHelpers.h"
#include "Identifier.h"
Modified: trunk/Source/_javascript_Core/runtime/Operations.cpp (232445 => 232446)
--- trunk/Source/_javascript_Core/runtime/Operations.cpp 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/Source/_javascript_Core/runtime/Operations.cpp 2018-06-02 23:03:36 UTC (rev 232446)
@@ -23,7 +23,6 @@
#include "Operations.h"
#include "Error.h"
-#include "JSBigInt.h"
#include "JSCInlines.h"
#include "JSObject.h"
#include "JSString.h"
@@ -65,19 +64,10 @@
return jsString(callFrame, p1String, asString(p2));
}
- auto leftNumeric = p1.toNumeric(callFrame);
+ double p1Number = p1.toNumber(callFrame);
RETURN_IF_EXCEPTION(scope, { });
- auto rightNumeric = p2.toNumeric(callFrame);
- RETURN_IF_EXCEPTION(scope, { });
-
- if (WTF::holds_alternative<JSBigInt*>(leftNumeric) || WTF::holds_alternative<JSBigInt*>(rightNumeric)) {
- if (WTF::holds_alternative<JSBigInt*>(leftNumeric) && WTF::holds_alternative<JSBigInt*>(rightNumeric))
- return JSBigInt::add(vm, WTF::get<JSBigInt*>(leftNumeric), WTF::get<JSBigInt*>(rightNumeric));
-
- return throwTypeError(callFrame, scope, ASCIILiteral("Invalid mix of BigInt and other type in addition."));
- }
-
- return jsNumber(WTF::get<double>(leftNumeric) + WTF::get<double>(rightNumeric));
+ scope.release();
+ return jsNumber(p1Number + p2.toNumber(callFrame));
}
JSValue jsTypeStringForValue(VM& vm, JSGlobalObject* globalObject, JSValue v)
Modified: trunk/Source/_javascript_Core/runtime/Operations.h (232445 => 232446)
--- trunk/Source/_javascript_Core/runtime/Operations.h 2018-06-02 23:02:50 UTC (rev 232445)
+++ trunk/Source/_javascript_Core/runtime/Operations.h 2018-06-02 23:03:36 UTC (rev 232446)
@@ -348,26 +348,6 @@
return jsAddSlowCase(callFrame, v1, v2);
}
-ALWAYS_INLINE JSValue jsSub(ExecState* state, JSValue v1, JSValue v2)
-{
- VM& vm = state->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- auto leftNumeric = v1.toNumeric(state);
- RETURN_IF_EXCEPTION(scope, { });
- auto rightNumeric = v2.toNumeric(state);
- RETURN_IF_EXCEPTION(scope, { });
-
- if (WTF::holds_alternative<JSBigInt*>(leftNumeric) || WTF::holds_alternative<JSBigInt*>(rightNumeric)) {
- if (WTF::holds_alternative<JSBigInt*>(leftNumeric) && WTF::holds_alternative<JSBigInt*>(rightNumeric))
- return JSBigInt::sub(vm, WTF::get<JSBigInt*>(leftNumeric), WTF::get<JSBigInt*>(rightNumeric));
-
- return throwTypeError(state, scope, ASCIILiteral("Invalid mix of BigInt and other type in subtraction."));
- }
-
- return jsNumber(WTF::get<double>(leftNumeric) - WTF::get<double>(rightNumeric));
-}
-
ALWAYS_INLINE JSValue jsMul(ExecState* state, JSValue v1, JSValue v2)
{
VM& vm = state->vm();