v8/test/mjsunit/deopt-recursive-eager-once.js
Michael Starzinger bf10f65976 [turbofan] Better recognize AstGraphBuilder'ed code.
This makes the runtime rely on the {HasBytecodeArray} predicate to
determine whether code generated by TurboFan was build without any
deoptimization support, as opposed to {asm_function}.

R=rmcilroy@chromium.org
BUG=v8:6589

Change-Id: Id124bed47a5fa02d31ff8fd3eee561b2df6c9226
Reviewed-on: https://chromium-review.googlesource.com/571786
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46694}
2017-07-17 08:15:31 +00:00

35 lines
824 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 --no-stress-fullcodegen
function foo(i, deopt = false) {
if (i == 0) {
if (deopt) {
// Trigger an eager deopt.
%_DeoptimizeNow();
}
} else {
foo(i - 1, deopt);
}
}
assertEquals(0, %GetOptimizationCount(foo));
assertEquals(0, %GetDeoptCount(foo));
foo(10);
foo(10);
%OptimizeFunctionOnNextCall(foo);
foo(10);
assertOptimized(foo);
assertEquals(1, %GetOptimizationCount(foo));
assertEquals(0, %GetDeoptCount(foo));
foo(10, true);
assertUnoptimized(foo);
assertEquals(1, %GetOptimizationCount(foo));
assertEquals(1, %GetDeoptCount(foo));