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 --no-igniti
on --no-ignition-staging --no-turbo | 5 // Flags: --mark-shared-functions-for-tier-up --allow-natives-syntax |
| 6 // Flags: --no-ignition --no-ignition-staging --no-turbo |
| 7 // Flags: --crankshaft --no-always-opt |
6 | 8 |
7 (function() { | 9 (function() { |
8 var sum = 0; | 10 var sum = 0; |
9 var i = 0; | 11 var i = 0; |
10 for (var i = 0; i < 3; ++i) { | 12 for (var i = 0; i < 3; ++i) { |
11 var f = function(x) { | 13 var f = function(x) { |
12 return 2 * x; | 14 return 2 * x; |
13 } | 15 } |
14 sum += f(i); | 16 sum += f(i); |
15 | 17 |
16 if (%GetOptimizationStatus(f) == 3 || %GetOptimizationStatus(f) == 4) { | 18 if (%GetOptimizationStatus(f) == 3 || %GetOptimizationStatus(f) == 4) { |
17 // If we are always or never optimizing f, just exit, this test is useless
. | 19 // If we are always or never optimizing f, just exit, this test is useless
. |
18 return; | 20 return; |
19 } | 21 } |
20 | 22 |
21 if (i == 1) { | 23 if (i == 1) { |
22 // f must be baseline code. | 24 // f must be baseline code. |
23 assertEquals(2, %GetOptimizationStatus(f)); | 25 assertEquals(2, %GetOptimizationStatus(f)); |
24 | 26 |
25 // Run twice (i = 0, 1), then tier-up. | 27 // Run twice (i = 0, 1), then tier-up. |
26 %OptimizeFunctionOnNextCall(f); | 28 %OptimizeFunctionOnNextCall(f); |
27 } else if (i == 2) { | 29 } else if (i == 2) { |
28 // Tier-up at i = 2 should go up to crankshaft. | 30 // Tier-up at i = 2 should go up to crankshaft. |
29 assertEquals(1, %GetOptimizationStatus(f)); | 31 assertEquals(1, %GetOptimizationStatus(f)); |
30 } | 32 } |
31 } | 33 } |
32 })() | 34 })() |
OLD | NEW |