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