2017-10-09 11:52:11 +00:00
|
|
|
// Copyright 2017 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.
|
|
|
|
|
2022-04-28 14:22:23 +00:00
|
|
|
// Flags: --allow-natives-syntax --turbofan --no-always-turbofan --deopt-every-n-times=6
|
2017-10-09 11:52:11 +00:00
|
|
|
|
|
|
|
// Check that stress deopt count resets correctly
|
|
|
|
|
|
|
|
// Function with two deopt points
|
|
|
|
function f(x) {
|
|
|
|
return x + 1;
|
|
|
|
}
|
|
|
|
|
2019-03-01 10:19:54 +00:00
|
|
|
%PrepareFunctionForOptimization(f);
|
2017-10-09 11:52:11 +00:00
|
|
|
f(1);
|
|
|
|
%OptimizeFunctionOnNextCall(f);
|
|
|
|
|
2018-10-06 19:32:00 +00:00
|
|
|
// stress_deopt_count == 6
|
2017-10-09 11:52:11 +00:00
|
|
|
|
|
|
|
f(1);
|
|
|
|
assertOptimized(f, undefined, undefined, false);
|
|
|
|
|
2018-10-06 19:32:00 +00:00
|
|
|
// stress_deopt_count == 4
|
2017-10-09 11:52:11 +00:00
|
|
|
|
|
|
|
f(1);
|
|
|
|
assertOptimized(f, undefined, undefined, false);
|
|
|
|
|
2018-10-06 19:32:00 +00:00
|
|
|
// stress_deopt_count == 2
|
2017-10-09 11:52:11 +00:00
|
|
|
|
|
|
|
f(1);
|
|
|
|
// deopt & counter reset
|
|
|
|
assertUnoptimized(f, undefined, undefined, false);
|
|
|
|
|
2018-10-06 19:32:00 +00:00
|
|
|
// stress_deopt_count == 6
|
2017-10-09 11:52:11 +00:00
|
|
|
|
2019-03-01 10:19:54 +00:00
|
|
|
%PrepareFunctionForOptimization(f);
|
2017-10-09 11:52:11 +00:00
|
|
|
%OptimizeFunctionOnNextCall(f);
|
|
|
|
f(1);
|
|
|
|
assertOptimized(f, undefined, undefined, false);
|
|
|
|
|
2018-10-06 19:32:00 +00:00
|
|
|
// stress_deopt_count == 4
|
2017-10-09 11:52:11 +00:00
|
|
|
|
|
|
|
f(1);
|
|
|
|
assertOptimized(f, undefined, undefined, false);
|
|
|
|
|
2018-10-06 19:32:00 +00:00
|
|
|
// stress_deopt_count == 2
|
2017-10-09 11:52:11 +00:00
|
|
|
|
|
|
|
f(1);
|
|
|
|
// deopt & counter reset
|
|
|
|
assertUnoptimized(f, undefined, undefined, false);
|