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; |
| 11 { |
| 12 let sum = 0; |
| 13 for (var i = 0; i < 100; i++) { |
| 14 if (i == 50) %OptimizeOsr(); |
| 15 sum += i; |
| 16 } |
| 17 result = sum; |
| 18 } |
| 19 return result; |
| 20 } |
| 21 |
| 22 assertEquals(4950, foo()); |
| 23 assertEquals(4950, foo()); |
| 24 assertEquals(4950, foo()); |
| 25 |
| 26 function bar() { |
| 27 var result; |
| 28 { |
| 29 let sum = 0; |
| 30 for (let i = 0; i < 90; i++) { |
| 31 sum += i; |
| 32 if (i == 45) %OptimizeOsr(); |
| 33 } |
| 34 result = sum; |
| 35 } |
| 36 return result; |
| 37 } |
| 38 |
| 39 assertEquals(4005, bar()); |
| 40 assertEquals(4005, bar()); |
| 41 assertEquals(4005, bar()); |
OLD | NEW |