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