v8/test/mjsunit/deopt-unlinked.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

33 lines
787 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() {}
assertEquals(0, %GetOptimizationCount(foo));
assertEquals(0, %GetDeoptCount(foo));
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
foo();
assertOptimized(foo);
assertEquals(1, %GetOptimizationCount(foo));
assertEquals(0, %GetDeoptCount(foo));
// Unlink the function.
%DeoptimizeFunction(foo);
assertUnoptimized(foo);
assertEquals(1, %GetOptimizationCount(foo));
assertEquals(1, %GetDeoptCount(foo));
foo();
assertUnoptimized(foo);
assertEquals(1, %GetOptimizationCount(foo));
assertEquals(1, %GetDeoptCount(foo));