]> git.saurik.com Git - apple/javascriptcore.git/blob - 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
1 var count = 0;
2
3 function bar(f) {
4 if (++count >= 10000)
5 throw f;
6 }
7
8 noInline(bar);
9
10 function foo(a) {
11 var x = a + 1;
12 for (;;) {
13 bar(function() { return x; });
14 }
15 }
16
17 noInline(foo);
18
19 try {
20 foo(42);
21 } catch (f) {
22 var result = f();
23 if (result != 43)
24 throw "Error: bad result: " + result;
25 }
26