Commit 5a624dc4 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

[turbofan] Fix crash with --trace-turbo-inlining

When the flag is on and some of the functions don't have bytecode,
we should gracefully print "no bytecode" instead of crashing.

Bug: chromium:983267
Change-Id: Id4e3385cd871a2dd5bead38c29a41b38319cc8d3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1731003Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#63031}
parent a82ffb17
...@@ -736,12 +736,16 @@ void JSInliningHeuristic::PrintCandidates() { ...@@ -736,12 +736,16 @@ void JSInliningHeuristic::PrintCandidates() {
<< candidate.node->op()->mnemonic() << candidate.node->op()->mnemonic()
<< ", frequency: " << candidate.frequency << std::endl; << ", frequency: " << candidate.frequency << std::endl;
for (int i = 0; i < candidate.num_functions; ++i) { for (int i = 0; i < candidate.num_functions; ++i) {
if (candidate.bytecode[i].has_value()) {
PrintF(" - size:%d,", candidate.bytecode[i].value().length());
} else {
PrintF(" - no bytecode,");
}
SharedFunctionInfoRef shared = SharedFunctionInfoRef shared =
candidate.functions[i].has_value() candidate.functions[i].has_value()
? candidate.functions[i].value().shared() ? candidate.functions[i].value().shared()
: candidate.shared_info.value(); : candidate.shared_info.value();
PrintF(" - size:%d, name: %s\n", candidate.bytecode[i].value().length(), PrintF(" name: %s\n", shared.object()->DebugName().ToCString().get());
shared.object()->DebugName().ToCString().get());
} }
} }
} }
......
// Copyright 2019 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 --trace-turbo-inlining
// Flags: --max-inlined-bytecode-size-small=0
function f() {}
function g() {}
function h() {}
function test(n) {
h;
(n == 0 ? f : (n > 0 ? g : h))();
}
%EnsureFeedbackVectorForFunction(f);
%EnsureFeedbackVectorForFunction(g);
%PrepareFunctionForOptimization(test);
test(0);
test(1);
%OptimizeFunctionOnNextCall(test);
test(0);
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