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 --turbo --turbo-escape | 5 // Flags: --allow-natives-syntax --turbo --turbo-escape |
6 | 6 |
7 function f() { | 7 // Warm up {g} with arrays and strings. |
8 try { | 8 function g(v) { return v.length; } |
9 throw "boom"; | 9 assertEquals(1, g("x")); |
10 } catch(e) { | 10 assertEquals(2, g("xy")); |
11 %_DeoptimizeNow(); | 11 assertEquals(1, g([1])); |
12 } | 12 assertEquals(2, g([1,2])); |
13 } | |
14 | 13 |
| 14 // Inline into {f}, where we see only an array. |
| 15 function f() { assertEquals(0, g([])); } |
15 f(); | 16 f(); |
16 f(); | 17 f(); |
17 %OptimizeFunctionOnNextCall(f); | 18 %OptimizeFunctionOnNextCall(f); |
18 f(); | 19 f(); |
OLD | NEW |