From 23dc1e1d43d95ac8d220fd1e062ad7343d27cf23 Mon Sep 17 00:00:00 2001
From: test262-automation <test262-automation@bocoup.com>
Date: Tue, 13 Nov 2018 18:58:38 +0000
Subject: [PATCH] [javascriptcore-test262-automation] Changes from
 https://github.com/webkit/webkit.git at sha b85a66fba6 on Tue Nov 13 2018
 18:55:51 GMT+0000 (Coordinated Universal Time)

---
 .../stress/big-int-out-of-memory-tests.js     | 63 +++++++++++++++++++
 1 file changed, 63 insertions(+)
 create mode 100644 implementation-contributed/javascriptcore/stress/big-int-out-of-memory-tests.js

diff --git a/implementation-contributed/javascriptcore/stress/big-int-out-of-memory-tests.js b/implementation-contributed/javascriptcore/stress/big-int-out-of-memory-tests.js
new file mode 100644
index 0000000000..ac39387ba1
--- /dev/null
+++ b/implementation-contributed/javascriptcore/stress/big-int-out-of-memory-tests.js
@@ -0,0 +1,63 @@
+//@ runDefault("--useBigInt=true", "--useDFGJIT=false")
+
+function assert(a, message) {
+    if (!a)
+        throw new Error(message);
+}
+
+function lshift(y) {
+    let out = 1n;
+    for (let i = 0; i < y; i++) {
+        out *= 2n;
+    }
+
+    return out;
+}
+
+let a = lshift(16384 * 63);
+for (let i = 0; i < 256; i++) {
+    a *= 18446744073709551615n;
+}
+
+try {
+    let b = a + 1n;
+    assert(false, "Should throw OutOfMemoryError, but executed without exception");
+} catch(e) {
+    assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
+}
+
+try {
+    let b = a - (-1n);
+    assert(false, "Should throw OutOfMemoryError, but executed without exception");
+} catch(e) {
+    assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
+}
+
+try {
+    let b = a * (-1n);
+    assert(false, "Should throw OutOfMemoryError, but executed without exception");
+} catch(e) {
+    assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
+}
+
+try {
+    let b = a / a;
+    assert(false, "Should throw OutOfMemoryError, but executed without exception");
+} catch(e) {
+    assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
+}
+
+try {
+    let b = -a & -1n;
+    assert(false, "Should throw OutOfMemoryError, but executed without exception");
+} catch(e) {
+    assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
+}
+
+try {
+    let b = a ^ -1n;
+    assert(false, "Should throw OutOfMemoryError, but executed without exception");
+} catch(e) {
+    assert(e.message == "Out of memory", "Expected OutOfMemoryError, but got: " + e);
+}
+
-- 
GitLab