2010-12-07 11:31:57 +00:00
|
|
|
// Copyright 2010 the V8 project authors. All rights reserved.
|
2015-02-09 12:47:31 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2010-12-07 11:31:57 +00:00
|
|
|
|
2015-02-10 09:53:09 +00:00
|
|
|
// Flags: --allow-natives-syntax --use-osr
|
2010-12-07 11:31:57 +00:00
|
|
|
|
|
|
|
function f() {
|
|
|
|
var sum = 0;
|
2015-02-10 09:53:09 +00:00
|
|
|
for (var i = 0; i < 1000; i++) {
|
2010-12-07 11:31:57 +00:00
|
|
|
var x = i + 2;
|
|
|
|
var y = x + 5;
|
|
|
|
var z = y + 3;
|
|
|
|
sum += z;
|
2015-02-10 09:53:09 +00:00
|
|
|
if (i == 11) %OptimizeOsr();
|
2010-12-07 11:31:57 +00:00
|
|
|
}
|
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < 2; i++) {
|
2019-07-08 16:52:18 +00:00
|
|
|
%PrepareFunctionForOptimization(f);
|
2015-02-10 09:53:09 +00:00
|
|
|
assertEquals(509500, f());
|
2010-12-07 11:31:57 +00:00
|
|
|
}
|