Land regression test for https://bugs.webkit.org/show_bug.cgi?id=164081.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Aug 2017 17:42:45 +0000 (17:42 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Aug 2017 17:42:45 +0000 (17:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=175940
<rdar://problem/29003921>

Reviewed by Saam Barati.

* stress/regress-164081.js: Added.
(shouldEqual):
(testcase):

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

JSTests/ChangeLog
JSTests/stress/regress-164081.js [new file with mode: 0644]

index 7c56390..d554493 100644 (file)
@@ -1,3 +1,15 @@
+2017-08-24  Mark Lam  <mark.lam@apple.com>
+
+        Land regression test for https://bugs.webkit.org/show_bug.cgi?id=164081.
+        https://bugs.webkit.org/show_bug.cgi?id=175940
+        <rdar://problem/29003921>
+
+        Reviewed by Saam Barati.
+
+        * stress/regress-164081.js: Added.
+        (shouldEqual):
+        (testcase):
+
 2017-08-24  Ryan Haddad  <ryanhaddad@apple.com>
 
         Skip flaky JSC test stress/test-finally.js.
diff --git a/JSTests/stress/regress-164081.js b/JSTests/stress/regress-164081.js
new file mode 100644 (file)
index 0000000..96b15ed
--- /dev/null
@@ -0,0 +1,34 @@
+//@ runFTLNoCJIT
+
+// Regression test for https://webkit.org/b/164081.
+// This test passes if it does not crash nor throws an error.
+
+function shouldEqual(actual, expected) {
+    if (actual != expected) {
+        throw "ERROR: expect " + expected + ", actual " + actual;
+    }
+}
+
+var count = 10000;
+
+var g_arr = new Array(count);
+for (var z = 0; z < count; z+=2) {
+    testcase(z);
+}
+function testcase(z) {
+    var visited = [];
+
+    g_arr[z]= Function('\'use strict\'');
+    g_arr[z][0]=5;
+    try {
+        g_arr[z+1] = new Uint32Array(8); //can skip
+        g_arr[z+1][6] = 0x41414141; // can skip
+        g_arr[z+1][7] = 0x41414141; // can skip
+        visited.push("set_caller");
+        g_arr[z].caller= 1;
+    } catch (e) {
+        visited.push("caught_exception");
+    }
+    shouldEqual(visited, "set_caller,caught_exception");
+}
+