]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/controlFlowProfiler/test-jit.js
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / tests / controlFlowProfiler / test-jit.js
CommitLineData
ed1e77d3
A
1load("./driver/driver.js");
2
3function tierUpToBaseline(func, arg)
4{
5 for (var i = 0; i < 50; i++)
6 func(arg);
7}
8
9function tierUpToDFG(func, arg)
10{
11 for (var i = 0; i < 50; i++)
12 func(arg);
13}
14
15function baselineTest(arg) {
16 if (arg > 20) {
17 return 20;
18 } else {
19 return 30;
20 }
21}
22
23function dfgTest(arg) {
24 if (arg > 20) {
25 return 20;
26 } else {
27 return 30;
28 }
29}
30
31noInline(baselineTest);
32noInline(dfgTest);
33
34tierUpToBaseline(baselineTest, 10);
35tierUpToDFG(dfgTest, 10);
36
37assert(!hasBasicBlockExecuted(baselineTest, "return 20"), "should not have executed yet.");
38assert(hasBasicBlockExecuted(baselineTest, "return 30"), "should have executed.");
39baselineTest(25);
40assert(hasBasicBlockExecuted(baselineTest, "return 20"), "should have executed.");
41
42assert(!hasBasicBlockExecuted(dfgTest, "return 20"), "should not have executed yet.");
43assert(hasBasicBlockExecuted(dfgTest, "return 30"), "should have executed.");
44dfgTest(25);
45assert(hasBasicBlockExecuted(dfgTest, "return 20"), "should have executed.");
46