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) {
|
2022-02-21 14:01:31 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
2015-02-11 13:26:35 +00:00
|
|
|
sum = sum + i;
|
|
|
|
}
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-02-11 13:26:35 +00:00
|
|
|
while (i-- > 31) {
|
2022-02-21 14:01:31 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
2015-02-11 13:26:35 +00:00
|
|
|
j = 9;
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2015-02-11 13:26:35 +00:00
|
|
|
while (j-- > 7) {
|
2022-02-21 14:01:31 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
2015-02-11 13:26:35 +00:00
|
|
|
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) {
|
2022-02-21 14:01:31 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
2015-02-11 13:26:35 +00:00
|
|
|
sum = sum + j * 5;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (i-- > 29) {
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2022-02-21 14:01:31 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
2015-02-11 13:26:35 +00:00
|
|
|
while (j-- > 3) {
|
|
|
|
var k = 10;
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2022-02-21 14:01:31 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
2015-02-11 13:26:35 +00:00
|
|
|
while (k-- > 8) {
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2022-02-21 14:01:31 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
2015-02-11 13:26:35 +00:00
|
|
|
sum = sum + k * 11;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while (j-- > 1) {
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2022-02-21 14:01:31 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
2015-02-11 13:26:35 +00:00
|
|
|
while (k-- > 6) {
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(bar);
|
2022-02-21 14:01:31 +00:00
|
|
|
if (count++ == goal) %OptimizeOsr();
|
2015-02-11 13:26:35 +00:00
|
|
|
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));
|
|
|
|
}
|