2018-09-14 18:32:18 +02: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.
|
|
|
|
|
2018-10-05 20:38:20 +02:00
|
|
|
// Flags: --allow-natives-syntax --opt --no-always-opt --deopt-every-n-times=3
|
2018-09-14 18:32:18 +02:00
|
|
|
|
|
|
|
// Check that stress deopt count resets correctly
|
|
|
|
|
|
|
|
// Function with two deopt points
|
|
|
|
function f(x) {
|
|
|
|
return x + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
f(1);
|
|
|
|
%OptimizeFunctionOnNextCall(f);
|
|
|
|
|
2018-10-05 20:38:20 +02:00
|
|
|
// stress_deopt_count == 3
|
2018-09-14 18:32:18 +02:00
|
|
|
|
|
|
|
f(1);
|
|
|
|
assertOptimized(f, undefined, undefined, false);
|
|
|
|
|
2018-10-05 20:38:20 +02:00
|
|
|
// stress_deopt_count == 2
|
2018-09-14 18:32:18 +02:00
|
|
|
|
|
|
|
f(1);
|
|
|
|
assertOptimized(f, undefined, undefined, false);
|
|
|
|
|
2018-10-05 20:38:20 +02:00
|
|
|
// stress_deopt_count == 1
|
2018-09-14 18:32:18 +02:00
|
|
|
|
|
|
|
f(1);
|
|
|
|
// deopt & counter reset
|
|
|
|
assertUnoptimized(f, undefined, undefined, false);
|
|
|
|
|
2018-10-05 20:38:20 +02:00
|
|
|
// stress_deopt_count == 3
|
2018-09-14 18:32:18 +02:00
|
|
|
|
|
|
|
%OptimizeFunctionOnNextCall(f);
|
|
|
|
f(1);
|
|
|
|
assertOptimized(f, undefined, undefined, false);
|
|
|
|
|
2018-10-05 20:38:20 +02:00
|
|
|
// stress_deopt_count == 2
|
2018-09-14 18:32:18 +02:00
|
|
|
|
|
|
|
f(1);
|
|
|
|
assertOptimized(f, undefined, undefined, false);
|
|
|
|
|
2018-10-05 20:38:20 +02:00
|
|
|
// stress_deopt_count == 1
|
2018-09-14 18:32:18 +02:00
|
|
|
|
|
|
|
f(1);
|
|
|
|
// deopt & counter reset
|
|
|
|
assertUnoptimized(f, undefined, undefined, false);
|