]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/stress/function-reentry-infer-on-self.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / function-reentry-infer-on-self.js
CommitLineData
ed1e77d3
A
1function thingy(f) {
2 f();
3}
4noInline(thingy);
5
6function foo(a) {
7 var x;
8 if (a)
9 x = a;
10 thingy(function() { return x; });
11 var result = 0;
12 for (var i = 0; i < 100000; ++i)
13 result += x;
14 return result;
15}
16
17noInline(foo);
18
19for (var i = 0; i < 10; ++i) {
20 var result = foo(42);
21 if (result != 4200000)
22 throw "Error: bad first result: " + result;
23}
24
25var result = foo(0);
26if ("" + result != "NaN")
27 throw "Error: bad result at end: " + result;
28