OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --use-osr | 5 // Flags: --allow-natives-syntax --use-osr |
6 | 6 |
7 function f() { | 7 function f() { |
8 var sum = 0; | 8 var sum = 0; |
9 for (var i = 0; i < 1000000; i++) { | 9 for (var i = 0; i < 1000; i++) { |
10 var x = i + 2; | 10 var x = i + 2; |
11 var y = x + 5; | 11 var y = x + 5; |
12 var z = y + 3; | 12 var z = y + 3; |
13 sum += z; | 13 sum += z; |
| 14 if (i == 11) %OptimizeOsr(); |
14 } | 15 } |
15 return sum; | 16 return sum; |
16 } | 17 } |
17 | 18 |
18 | 19 |
19 for (var i = 0; i < 2; i++) { | 20 for (var i = 0; i < 2; i++) { |
20 assertEquals(500009500000, f()); | 21 assertEquals(509500, f()); |
21 } | 22 } |
OLD | NEW |