]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/tricky-inferred-infinite-loop-that-uses-captured-variables-and-creates-the-activation-outside-the-loop.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / tricky-inferred-infinite-loop-that-uses-captured-variables-and-creates-the-activation-outside-the-loop.js
CommitLineData
81345200
A
1var count = 0;
2
3function bar(f) {
4 if (++count < 10)
5 return;
6 count = 0;
7 throw f;
8}
9
10noInline(bar);
11
12var shouldContinue = true;
13
14function foo(a) {
15 var x = a + 1;
16 var f = (function() { return x; });
17 while (shouldContinue) {
18 bar(f);
19 }
20}
21
22noInline(foo);
23
24for (var i = 0; i < 10000; ++i) {
25 try {
26 foo(i);
27 } catch (f) {
28 var result = f();
29 if (result != i + 1)
30 throw "Error: bad result for i = " + i + ": " + result;
31 }
32}
33