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