OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 --use-osr --turbo-osr |
| 6 |
| 7 "use strict"; |
| 8 |
| 9 function foo() { |
| 10 var result = new Array(); |
| 11 var out; |
| 12 { |
| 13 let sum = 0; |
| 14 for (var i = 0; i < 10; i++) { |
| 15 { |
| 16 let x = i; |
| 17 if (i == 5) %OptimizeOsr(); |
| 18 sum += i; |
| 19 result.push(function() { return x; }); |
| 20 } |
| 21 } |
| 22 out = sum; |
| 23 } |
| 24 result.push(out); |
| 25 return result; |
| 26 } |
| 27 |
| 28 |
| 29 function check() { |
| 30 var r = foo(); |
| 31 assertEquals(45, r.pop()); |
| 32 for (var i = 9; i >= 0; i--) { |
| 33 assertEquals(i, r.pop()()); |
| 34 } |
| 35 assertEquals(0, r.length); |
| 36 } |
| 37 |
| 38 check(); |
| 39 check(); |
| 40 check(); |
OLD | NEW |