]> git.saurik.com Git - apple/javascriptcore.git/blob - tests/stress/simple-polyvariant-call-inlining-example.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / stress / simple-polyvariant-call-inlining-example.js
1 function foo(baz) {
2 return bar(baz);
3 }
4
5 function fuzz(baz) {
6 return bar(baz);
7 }
8
9 function bar(baz) {
10 return baz();
11 }
12
13 function baz1() {
14 return 42;
15 }
16
17 function baz2() {
18 return 24;
19 }
20
21 noInline(foo);
22 noInline(fuzz);
23
24 for (var i = 0; i < 100000; ++i) {
25 var result = foo(baz1);
26 if (result != 42)
27 throw "Error: bad result: " + result;
28 var result = fuzz(baz2);
29 if (result != 24)
30 throw "Error: bad result: " + result;
31 }
32