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 outer = 10;
|
2013-06-26 08:43:27 +00:00
|
|
|
while (outer > 0) {
|
2018-05-24 12:26:44 +00:00
|
|
|
var inner = 10;
|
2013-06-26 08:43:27 +00:00
|
|
|
while (inner > 0) {
|
|
|
|
sum += x;
|
|
|
|
inner--;
|
2018-05-24 12:26:44 +00:00
|
|
|
if (inner == 5) {
|
|
|
|
%OptimizeOsr();
|
|
|
|
}
|
2013-06-26 08:43:27 +00:00
|
|
|
}
|
|
|
|
outer--;
|
2019-06-18 16:03:44 +00:00
|
|
|
%PrepareFunctionForOptimization(f);
|
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(500, f(5));
|