OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // Flags: --mark-shared-functions-for-tier-up --allow-natives-syntax --ignition-
staging --turbo | 5 // Flags: --mark-shared-functions-for-tier-up --allow-natives-syntax |
| 6 // Flags: --ignition-staging --turbo --no-always-opt |
6 | 7 |
7 (function() { | 8 (function() { |
8 var sum = 0; | 9 var sum = 0; |
9 var i = 0; | 10 var i = 0; |
10 for (var i = 0; i < 3; ++i) { | 11 for (var i = 0; i < 3; ++i) { |
11 var f = function(x) { | 12 var f = function(x) { |
12 return 2 * x; | 13 return 2 * x; |
13 } | 14 } |
14 sum += f(i); | 15 sum += f(i); |
15 | 16 |
16 if (%GetOptimizationStatus(f) == 3 || %GetOptimizationStatus(f) == 4) { | 17 if (%GetOptimizationStatus(f) == 3 || %GetOptimizationStatus(f) == 4) { |
17 // If we are always or never optimizing f, just exit, this test is useless
. | 18 // If we are always or never optimizing f, just exit, this test is useless
. |
18 return; | 19 return; |
19 } | 20 } |
20 | 21 |
21 if (i == 1) { | 22 if (i == 1) { |
22 // f must be interpreted code. | 23 // f must be interpreted code. |
23 assertEquals(8, %GetOptimizationStatus(f)); | 24 assertEquals(8, %GetOptimizationStatus(f)); |
24 | 25 |
25 // Run twice (i = 0, 1), then tier-up. | 26 // Run twice (i = 0, 1), then tier-up. |
26 %OptimizeFunctionOnNextCall(f); | 27 %OptimizeFunctionOnNextCall(f); |
27 } else if (i == 2) { | 28 } else if (i == 2) { |
28 // Tier-up at i = 2 should go up to turbofan. | 29 // Tier-up at i = 2 should go up to turbofan. |
29 assertEquals(7, %GetOptimizationStatus(f)); | 30 assertEquals(7, %GetOptimizationStatus(f)); |
30 } | 31 } |
31 } | 32 } |
32 })() | 33 })() |
OLD | NEW |