saambarati1@gmail.com | 2c9a8bcc | 2015-02-02 19:05:46 +0000 | [diff] [blame] | 1 | load("./driver/driver.js"); |
| 2 | |
| 3 | function tierUpToBaseline(func, arg) |
| 4 | { |
| 5 | for (var i = 0; i < 50; i++) |
| 6 | func(arg); |
| 7 | } |
| 8 | |
| 9 | function tierUpToDFG(func, arg) |
| 10 | { |
| 11 | for (var i = 0; i < 50; i++) |
| 12 | func(arg); |
| 13 | } |
| 14 | |
| 15 | function baselineTest(arg) { |
| 16 | if (arg > 20) { |
| 17 | return 20; |
| 18 | } else { |
| 19 | return 30; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | function dfgTest(arg) { |
| 24 | if (arg > 20) { |
| 25 | return 20; |
| 26 | } else { |
| 27 | return 30; |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | noInline(baselineTest); |
| 32 | noInline(dfgTest); |
| 33 | |
| 34 | tierUpToBaseline(baselineTest, 10); |
| 35 | tierUpToDFG(dfgTest, 10); |
| 36 | |
| 37 | assert(!hasBasicBlockExecuted(baselineTest, "return 20"), "should not have executed yet."); |
| 38 | assert(hasBasicBlockExecuted(baselineTest, "return 30"), "should have executed."); |
| 39 | baselineTest(25); |
| 40 | assert(hasBasicBlockExecuted(baselineTest, "return 20"), "should have executed."); |
| 41 | |
| 42 | assert(!hasBasicBlockExecuted(dfgTest, "return 20"), "should not have executed yet."); |
| 43 | assert(hasBasicBlockExecuted(dfgTest, "return 30"), "should have executed."); |
| 44 | dfgTest(25); |
| 45 | assert(hasBasicBlockExecuted(dfgTest, "return 20"), "should have executed."); |
| 46 | |