2015-02-11 13:26:35 +00:00
|
|
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2015-06-15 09:42:57 +00:00
|
|
|
// Flags: --allow-natives-syntax --use-osr
|
2015-02-11 13:26:35 +00:00
|
|
|
|
|
|
|
function bar(goal) {
|
|
|
|
var count = 0;
|
|
|
|
var sum = 11;
|
|
|
|
var i = 35;
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-02-11 13:26:35 +00:00
|
|
|
while (i-- > 33) {
|
|
|
|
if (count++ == goal) %OptimizeOsr();
|
|
|
|
sum = sum + i;
|
|
|
|
}
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-02-11 13:26:35 +00:00
|
|
|
while (i-- > 31) {
|
|
|
|
if (count++ == goal) %OptimizeOsr();
|
|
|
|
j = 9;
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-02-11 13:26:35 +00:00
|
|
|
while (j-- > 7) {
|
|
|
|
if (count++ == goal) %OptimizeOsr();
|
|
|
|
sum = sum + j * 3;
|
|
|
|
}
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-02-11 13:26:35 +00:00
|
|
|
while (j-- > 5) {
|
|
|
|
if (count++ == goal) %OptimizeOsr();
|
|
|
|
sum = sum + j * 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (i-- > 29) {
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-02-11 13:26:35 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
|
|
|
while (j-- > 3) {
|
|
|
|
var k = 10;
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-02-11 13:26:35 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
|
|
|
while (k-- > 8) {
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-02-11 13:26:35 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
|
|
|
sum = sum + k * 11;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (j-- > 1) {
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-02-11 13:26:35 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
|
|
|
while (k-- > 6) {
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-02-11 13:26:35 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
|
|
|
sum = sum + j * 13;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return sum;
|
|
|
|
}
|
2019-05-03 14:32:12 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-02-11 13:26:35 +00:00
|
|
|
|
|
|
|
for (var i = 0; i < 13; i++) {
|
|
|
|
%DeoptimizeFunction(bar);
|
|
|
|
assertEquals(348, bar(i));
|
|
|
|
}
|