From 7e43d64794e66e6a4897e448aa36c19c25d964ea Mon Sep 17 00:00:00 2001
From: test262-automation <test262-automation@bocoup.com>
Date: Fri, 19 Oct 2018 18:44:18 +0000
Subject: [PATCH] [javascriptcore-test262-automation] Changes from
 https://github.com/webkit/webkit.git at sha 5bbf629de8 on Fri Oct 19 2018
 18:41:28 GMT+0000 (Coordinated Universal Time)

---
 .../stress/big-int-subtraction-jit.js         | 19 ++++++++++++++
 ...alue-sub-big-int-prediction-propagation.js | 18 +++++++++++++
 .../stress/value-sub-big-int-untyped.js       | 26 +++++++++++++++++++
 .../stress/value-sub-spec-none-case.js        | 22 ++++++++++++++++
 4 files changed, 85 insertions(+)
 create mode 100644 implementation-contributed/javascriptcore/stress/big-int-subtraction-jit.js
 create mode 100644 implementation-contributed/javascriptcore/stress/value-sub-big-int-prediction-propagation.js
 create mode 100644 implementation-contributed/javascriptcore/stress/value-sub-big-int-untyped.js
 create mode 100644 implementation-contributed/javascriptcore/stress/value-sub-spec-none-case.js

diff --git a/implementation-contributed/javascriptcore/stress/big-int-subtraction-jit.js b/implementation-contributed/javascriptcore/stress/big-int-subtraction-jit.js
new file mode 100644
index 0000000000..2e1f6ae8c2
--- /dev/null
+++ b/implementation-contributed/javascriptcore/stress/big-int-subtraction-jit.js
@@ -0,0 +1,19 @@
+//@ runBigIntEnabled
+
+let assert = {
+    sameValue: function(i, e, m) {
+        if (i !== e)
+            throw new Error(m);
+    }
+}
+
+function bigIntAddition(x, y) {
+    return x - y - 1n;
+}
+noInline(bigIntAddition);
+
+for (let i = 0; i < 10000; i++) {
+    let r = bigIntAddition(3n, 10n);
+    assert.sameValue(r, -8n, 3n + " - " + 10n + " - 1 = " + r);
+}
+
diff --git a/implementation-contributed/javascriptcore/stress/value-sub-big-int-prediction-propagation.js b/implementation-contributed/javascriptcore/stress/value-sub-big-int-prediction-propagation.js
new file mode 100644
index 0000000000..44cbb28119
--- /dev/null
+++ b/implementation-contributed/javascriptcore/stress/value-sub-big-int-prediction-propagation.js
@@ -0,0 +1,18 @@
+//@ runBigIntEnabled
+
+function assert(v, e) {
+    if (v !== e)
+        throw new Error("Expected value: " + e + " but got: " + v)
+}
+
+function bigIntPropagation(a, b) {
+    let c = a - b;
+    return c - 0n;
+}
+noInline(bigIntPropagation);
+
+for (let i = 0; i < 100000; i++) {
+    let out = bigIntPropagation(0xffffffffffffffffffffffffffffffn, 0x1n);
+    assert(out, 0xfffffffffffffffffffffffffffffen)
+}
+
diff --git a/implementation-contributed/javascriptcore/stress/value-sub-big-int-untyped.js b/implementation-contributed/javascriptcore/stress/value-sub-big-int-untyped.js
new file mode 100644
index 0000000000..8c3f7ff2ad
--- /dev/null
+++ b/implementation-contributed/javascriptcore/stress/value-sub-big-int-untyped.js
@@ -0,0 +1,26 @@
+//@ runBigIntEnabled
+
+function assert(v, e) {
+    if (v !== e)
+        throw new Error("Expected value: " + e + " but got: " + v)
+}
+
+function bigIntOperations(a, b) {
+    let c = a - b;
+    return a - c;
+}
+noInline(bigIntOperations);
+
+c = 0;
+let o = { valueOf: function () {
+    c++;
+    return 0b1111n;
+}};
+
+for (let i = 0; i < 100000; i++) {
+    let out = bigIntOperations(o, 0b1010n);
+    assert(out, 10n);
+}
+
+assert(c, 200000);
+
diff --git a/implementation-contributed/javascriptcore/stress/value-sub-spec-none-case.js b/implementation-contributed/javascriptcore/stress/value-sub-spec-none-case.js
new file mode 100644
index 0000000000..2472cef9b3
--- /dev/null
+++ b/implementation-contributed/javascriptcore/stress/value-sub-spec-none-case.js
@@ -0,0 +1,22 @@
+function assert(a, e) {
+    if (a !== e)
+        throw new Error("Bad");
+}
+
+function valueSub() {
+    let sum = 0;
+    do {
+        // We trigger the JIT compilation of valueSub
+        // so Date.now() will have SpecNone as result
+        for (let i = 0; i < 10000; i++)
+            sum++;
+
+        sum += 0.5;
+    } while (Date.now() - sum  < 0);
+
+    assert(sum, 10000.5);
+}
+noInline(valueSub);
+
+valueSub();
+
-- 
GitLab