2013-06-26 08:43:27 +00:00
|
|
|
// Copyright 2013 the V8 project authors. All rights reserved.
|
2018-05-24 12:26:44 +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
|
|
|
|
2018-05-24 12:26:44 +00:00
|
|
|
// Flags: --use-osr --allow-natives-syntax
|
2010-12-07 11:31:57 +00:00
|
|
|
|
2013-06-26 08:43:27 +00:00
|
|
|
function f(x) {
|
2010-12-07 11:31:57 +00:00
|
|
|
var sum = 0;
|
2018-05-24 12:26:44 +00:00
|
|
|
var count = 10;
|
2013-06-26 08:43:27 +00:00
|
|
|
while (count > 0) {
|
|
|
|
sum += x;
|
|
|
|
count--;
|
2022-02-21 14:01:31 +00:00
|
|
|
if (count == 5) {
|
|
|
|
%OptimizeOsr();
|
2018-05-24 12:26:44 +00:00
|
|
|
}
|
2010-12-07 11:31:57 +00:00
|
|
|
}
|
|
|
|
return sum;
|
|
|
|
}
|
2019-05-03 14:32:12 +00:00
|
|
|
%PrepareFunctionForOptimization(f);
|
2010-12-07 11:31:57 +00:00
|
|
|
|
2018-05-24 12:26:44 +00:00
|
|
|
assertEquals(50, f(5));
|