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 --min-preparse-length=10 | 5 // Flags: --allow-natives-syntax |
6 | 6 |
7 let x; | 7 let x; |
8 function f(a) { | 8 function f(a) { |
9 x += a; | 9 x += a; |
10 } | 10 } |
11 function g(a) { | 11 function g(a) { |
12 f(a); return x; | 12 f(a); return x; |
13 } | 13 } |
14 function h(a) { | 14 function h(a) { |
15 x = a; return x; | 15 x = a; return x; |
16 } | 16 } |
17 | 17 |
18 function boom() { return g(1) } | 18 function boom() { return g(1) } |
19 | 19 |
20 assertEquals(1, h(1)); | 20 assertEquals(1, h(1)); |
21 assertEquals(2, boom()); | 21 assertEquals(2, boom()); |
22 assertEquals(3, boom()); | 22 assertEquals(3, boom()); |
23 %OptimizeFunctionOnNextCall(boom); | 23 %OptimizeFunctionOnNextCall(boom); |
24 assertEquals(4, boom()); | 24 assertEquals(4, boom()); |
OLD | NEW |