]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/infinite-loop-that-uses-captured-variables-with-osr-entry.js
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / tests / stress / infinite-loop-that-uses-captured-variables-with-osr-entry.js
diff --git a/tests/stress/infinite-loop-that-uses-captured-variables-with-osr-entry.js b/tests/stress/infinite-loop-that-uses-captured-variables-with-osr-entry.js
new file mode 100644 (file)
index 0000000..c152e1c
--- /dev/null
@@ -0,0 +1,26 @@
+var count = 0;
+
+function bar(f) {
+    if (++count >= 10000)
+        throw f;
+}
+
+noInline(bar);
+
+function foo(a) {
+    var x = a + 1;
+    for (;;) {
+        bar(function() { return x; });
+    }
+}
+
+noInline(foo);
+
+try {
+    foo(42);
+} catch (f) {
+    var result = f();
+    if (result != 43)
+        throw "Error: bad result: " + result;
+}
+