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: --allow-natives-syntax --ignition --turbo-from-bytecode --turbo-filter
=f | 5 // Flags: --allow-natives-syntax --ignition --turbo-filter=f |
6 | 6 |
7 function f(x) { return x + 23 } | 7 function f(x) { return x + 23 } |
8 function g(x) { return f(x) + 42 } | 8 function g(x) { return f(x) + 42 } |
9 | 9 |
10 assertEquals(23, f(0)); | 10 assertEquals(23, f(0)); |
11 assertEquals(24, f(1)); | 11 assertEquals(24, f(1)); |
12 assertEquals(67, g(2)); | 12 assertEquals(67, g(2)); |
13 assertEquals(68, g(3)); | 13 assertEquals(68, g(3)); |
14 | 14 |
15 // Optimize {g} with Crankshaft, causing {f} to be inlined. | 15 // Optimize {g} with Crankshaft, causing {f} to be inlined. |
16 %OptimizeFunctionOnNextCall(g); | 16 %OptimizeFunctionOnNextCall(g); |
17 assertEquals(65, g(0)); | 17 assertEquals(65, g(0)); |
18 | 18 |
19 // Optimize {f} with Turbofan, after it has been inlined. | 19 // Optimize {f} with Turbofan, after it has been inlined. |
20 %OptimizeFunctionOnNextCall(f); | 20 %OptimizeFunctionOnNextCall(f); |
21 assertEquals(23, f(0)); | 21 assertEquals(23, f(0)); |
OLD | NEW |