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 test(expected, func) { |
| 10 assertEquals(expected, func()); |
| 11 assertEquals(expected, func()); |
| 12 assertEquals(expected, func()); |
| 13 } |
| 14 |
| 15 function foo() { |
| 16 var result = 0; |
| 17 { |
| 18 let x = 0; |
| 19 var temp_x = x; |
| 20 var first = 1; |
| 21 outer: while (true) { |
| 22 let x = temp_x; |
| 23 if (first == 1) first = 0; |
| 24 else x = x + 1 | 0; |
| 25 var flag = 1; |
| 26 for (; flag == 1; (flag = 0, temp_x = x)) { |
| 27 if (x < 2) { |
| 28 result = x; %OptimizeOsr(); |
| 29 } else { |
| 30 break outer; |
| 31 } |
| 32 } |
| 33 if (flag == 1) break; |
| 34 } |
| 35 } |
| 36 return result; |
| 37 } |
| 38 |
| 39 test(1, foo); |
| 40 |
| 41 |
| 42 function smo() { |
| 43 var result = 0; |
| 44 { |
| 45 let x = 11; |
| 46 outer: while (true) { |
| 47 let y = x; |
| 48 for (var i = 0; i < 5; i++) { |
| 49 %OptimizeOsr(); |
| 50 if (i) break outer; |
| 51 else result = y; |
| 52 } |
| 53 } |
| 54 } |
| 55 return result; |
| 56 } |
| 57 |
| 58 test(11, smo); |
OLD | NEW |