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