OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Flags: --mark-shared-functions-for-tier-up --allow-natives-syntax --expose-g
c |
| 6 |
| 7 function foo() { |
| 8 function bar() { |
| 9 } |
| 10 return bar; |
| 11 } |
| 12 |
| 13 // Mark bar's shared function info for tier-up |
| 14 // (but don't optimize). |
| 15 var bar = foo(); |
| 16 %OptimizeFunctionOnNextCall(bar); |
| 17 |
| 18 // Avoid flushing foo (and thereby making bar's shared function info |
| 19 // dead) by marking it to be optimized. |
| 20 %OptimizeFunctionOnNextCall(foo); |
| 21 |
| 22 // Throw away the JSFunction we have for bar and GC until its code has |
| 23 // been flushed. |
| 24 bar = null; |
| 25 for (var i = 0; i < 6; i++) { |
| 26 gc(); |
| 27 } |
| 28 |
| 29 // Now create a new JSFunction from bar's shared function info and call it, |
| 30 // we should not optimize without recompiling the baseline code. |
| 31 foo()(); |
OLD | NEW |