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 | |
6 | |
7 function h(g) { | |
8 return g(); | |
9 } | |
10 | |
11 function f() { | |
12 var g; | |
13 for (var i = 0; i < 10; i++) { | |
14 var y = i; | |
15 if (i === 5) { | |
16 g = function() { | |
17 return y; | |
18 }; | |
19 assertEquals(5, h(g)); | |
20 assertEquals(5, h(g)); | |
21 %OptimizeFunctionOnNextCall(h); | |
22 assertEquals(5, h(g)); | |
23 } | |
24 } | |
25 return g; | |
26 } | |
27 | |
28 var myg = f(); | |
29 | |
30 assertEquals(9, h(myg)); | |
OLD | NEW |