Commit b848716c authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[compiler] Fix confusion about OSR BailoutId semantics.

The semantics of the {BailoutId} representing an OSR entry point is
different between the interpreter and the full code generator. These
semantics are hard-coded in various graph builders. We need to ensure
that the correct graph builder is chosen for OSR compilations.

R=rmcilroy@chromium.org
TEST=mjsunit/regress/regress-5380
BUG=v8:5380

Review-Url: https://codereview.chromium.org/2341663002
Cr-Commit-Position: refs/heads/master@{#39444}
parent b37daacd
......@@ -705,6 +705,7 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
// TurboFan can optimize directly from existing bytecode.
if (FLAG_turbo_from_bytecode && use_turbofan && ShouldUseIgnition(info)) {
if (info->is_osr() && !ignition_osr) return MaybeHandle<Code>();
if (!Compiler::EnsureBytecode(info)) {
if (isolate->has_pending_exception()) isolate->clear_pending_exception();
return MaybeHandle<Code>();
......@@ -720,6 +721,16 @@ MaybeHandle<Code> GetOptimizedCode(Handle<JSFunction> function,
parse_info->set_lazy(false);
}
// Verify that OSR compilations are delegated to the correct graph builder.
// Depending on the underlying frame the semantics of the {BailoutId} differ
// and the various graph builders hard-code a certain semantic:
// - Interpreter : The BailoutId represents a bytecode offset.
// - FullCodegen : The BailoutId represents the id of an AST node.
DCHECK_IMPLIES(info->is_osr() && ignition_osr,
info->is_optimizing_from_bytecode());
DCHECK_IMPLIES(info->is_osr() && !ignition_osr,
!info->is_optimizing_from_bytecode());
// In case of concurrent recompilation, all handles below this point will be
// allocated in a deferred handle scope that is detached and handed off to
// the background thread when we return.
......
// Copyright 2016 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 --ignition-staging --turbo
function f(do_osr) {
for (var i = 0; i < 3; ++i) {
if (i == 1 && do_osr) %OptimizeOsr();
}
}
f(false);
f(false);
%BaselineFunctionOnNextCall(f);
f(false);
f(true);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment