OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --allow-natives-syntax --noalways-opt |
| 6 |
| 7 function foo() { |
| 8 function g(o) { |
| 9 return o.f; |
| 10 } |
| 11 return g; |
| 12 } |
| 13 |
| 14 let g1 = foo(); |
| 15 let g2 = foo(); |
| 16 |
| 17 g1({ f : 1}); |
| 18 g1({ f : 2}); |
| 19 g2({ f : 2}); |
| 20 g2({ f : 2}); |
| 21 |
| 22 %OptimizeFunctionOnNextCall(g1); |
| 23 %OptimizeFunctionOnNextCall(g2); |
| 24 |
| 25 g1({ f : 1}); |
| 26 g2({ f : 2}); |
| 27 g1({}); |
| 28 |
| 29 assertUnoptimized(g1); |
| 30 |
| 31 // Deoptimization of g1 should also deoptimize g2 because they should share |
| 32 // the optimized code object. (Unfortunately, this test bakes in various |
| 33 // other assumptions about dealing with optimized code, and thus might break |
| 34 // in future.) |
| 35 assertUnoptimized(g2); |
| 36 |
| 37 g2({}); |
OLD | NEW |