blob: ddbc5f8867fdc5731330e88a0c790ae9f44c1acf [file] [log] [blame]
Ben Murdochb0fe1622011-05-05 13:52:32 +01001// Copyright 2010 the V8 project authors. All rights reserved.
Ben Murdoch014dc512016-03-22 12:00:34 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
Kristian Monsen81362e12011-02-04 12:39:27 +00004
Ben Murdoch014dc512016-03-22 12:00:34 +00005// Flags: --allow-natives-syntax --use-osr
Kristian Monsen81362e12011-02-04 12:39:27 +00006
Ben Murdochb0fe1622011-05-05 13:52:32 +01007function f() {
8 var sum = 0;
Ben Murdoch014dc512016-03-22 12:00:34 +00009 for (var i = 0; i < 1000; i++) {
Ben Murdochb0fe1622011-05-05 13:52:32 +010010 var x = i + 2;
11 var y = x + 5;
12 var z = y + 3;
13 sum += z;
Ben Murdoch014dc512016-03-22 12:00:34 +000014 if (i == 11) %OptimizeOsr();
Ben Murdochb0fe1622011-05-05 13:52:32 +010015 }
16 return sum;
Kristian Monsen81362e12011-02-04 12:39:27 +000017}
18
Ben Murdochb0fe1622011-05-05 13:52:32 +010019
20for (var i = 0; i < 2; i++) {
Ben Murdoch014dc512016-03-22 12:00:34 +000021 assertEquals(509500, f());
Ben Murdochb0fe1622011-05-05 13:52:32 +010022}