ad1fcd4343
Bug: v8:9183 Change-Id: Iceeccc8ab1e4e77b428e7e2feec39bff3317f241 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1617675 Commit-Queue: Jaroslav Sevcik <jarin@chromium.org> Reviewed-by: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#61665}
30 lines
626 B
JavaScript
30 lines
626 B
JavaScript
// 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.
|
|
|
|
// Flags: --allow-natives-syntax --opt --no-always-opt
|
|
|
|
function foo(i, deopt = false) {
|
|
if (i == 0) {
|
|
if (deopt) {
|
|
// Trigger an eager deopt.
|
|
%_DeoptimizeNow();
|
|
}
|
|
} else {
|
|
foo(i - 1, deopt);
|
|
}
|
|
}
|
|
%PrepareFunctionForOptimization(foo);
|
|
|
|
%PrepareFunctionForOptimization(foo);
|
|
foo(10);
|
|
foo(10);
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
foo(10);
|
|
|
|
assertOptimized(foo);
|
|
|
|
foo(10, true);
|
|
|
|
assertUnoptimized(foo);
|