stress-deopt-count-2.js 996 Bytes
Newer Older
1 2 3 4
// 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.

5
// Flags: --allow-natives-syntax --opt --no-always-opt --deopt-every-n-times=6
6 7 8 9 10 11 12 13 14 15 16

// Check that stress deopt count resets correctly

// Function with two deopt points
function f(x) {
  return x + 1;
}

f(1);
%OptimizeFunctionOnNextCall(f);

17
// stress_deopt_count == 6
18 19 20 21

f(1);
assertOptimized(f, undefined, undefined, false);

22
// stress_deopt_count == 4
23 24 25 26

f(1);
assertOptimized(f, undefined, undefined, false);

27
// stress_deopt_count == 2
28 29 30 31 32

f(1);
// deopt & counter reset
assertUnoptimized(f, undefined, undefined, false);

33
// stress_deopt_count == 6
34 35 36 37 38

%OptimizeFunctionOnNextCall(f);
f(1);
assertOptimized(f, undefined, undefined, false);

39
// stress_deopt_count == 4
40 41 42 43

f(1);
assertOptimized(f, undefined, undefined, false);

44
// stress_deopt_count == 2
45 46 47 48

f(1);
// deopt & counter reset
assertUnoptimized(f, undefined, undefined, false);