[JSC] Add more tests for r243966
authorysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Apr 2019 22:01:32 +0000 (22:01 +0000)
committerysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Apr 2019 22:01:32 +0000 (22:01 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196711

Reviewed by Saam Barati.

Adding one more test for r243966 fix. The added test will not crash after r243966.

* stress/stress-cleared-calllinkinfo.js: Added.
(runNearStackLimit.t):
(runNearStackLimit):
(repeat):
(cls):
(let.item.of.array.runNearStackLimit):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244049 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JSTests/ChangeLog
JSTests/stress/stress-cleared-calllinkinfo.js [new file with mode: 0644]

index 26fe3cd..cd7d9d0 100644 (file)
@@ -1,3 +1,19 @@
+2019-04-08  Yusuke Suzuki  <ysuzuki@apple.com>
+
+        [JSC] Add more tests for r243966
+        https://bugs.webkit.org/show_bug.cgi?id=196711
+
+        Reviewed by Saam Barati.
+
+        Adding one more test for r243966 fix. The added test will not crash after r243966.
+
+        * stress/stress-cleared-calllinkinfo.js: Added.
+        (runNearStackLimit.t):
+        (runNearStackLimit):
+        (repeat):
+        (cls):
+        (let.item.of.array.runNearStackLimit):
+
 2019-04-08  Saam Barati  <sbarati@apple.com>
 
         WebAssembly.RuntimeError missing exception check
diff --git a/JSTests/stress/stress-cleared-calllinkinfo.js b/JSTests/stress/stress-cleared-calllinkinfo.js
new file mode 100644 (file)
index 0000000..9049fdf
--- /dev/null
@@ -0,0 +1,34 @@
+//@ slow!
+function runNearStackLimit(f) {
+    function t() {
+        try {
+            return t();
+        } catch (e) {
+            String(e);
+            return f();
+        }
+    }
+    return t()
+}
+function repeat(func, count) {
+    for (let i = 0; i < count; i++) {
+        try {
+            func(i);
+        } catch (e) {}
+    }
+}
+let array = [Error, String, RegExp, {}, class cls {}];
+for (let item of array) {
+    runNearStackLimit(() => {
+        return repeat(void 0, 30);
+    })
+}
+
+repeat(function (v) {
+    let func = new Proxy(function () {
+        gc();
+    }, {});
+    runNearStackLimit(() => {
+        new func();
+    })
+}, 5);
\ No newline at end of file