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: --allow-natives-syntax --function-context-specialization | |
6 | |
7 function f(n) { | |
8 var a = []; | |
9 function g() { return x } | |
10 for (var i = 0; i < n; ++i) { | |
11 var x = i; | |
12 a[i] = g; | |
13 %OptimizeFunctionOnNextCall(g); | |
14 g(); | |
15 } | |
16 return a; | |
17 } | |
18 var a = f(3); | |
19 assertEquals(3, a.length); | |
20 assertEquals(2, a[0]()); | |
21 assertEquals(2, a[1]()); | |
22 assertEquals(2, a[2]()); | |
OLD | NEW |