Commit 9b9bb9d6 authored by Tobias Tebbi's avatar Tobias Tebbi Committed by V8 LUCI CQ

[compiler] IsInlinable check too strict because of concurrent inlining

Bug: chromium:1274443
Change-Id: I3f6766dc84019ae017b6da1ae797c946a33079b1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3351968Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Tobias Tebbi <tebbi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78607}
parent 8b8e9960
......@@ -197,16 +197,23 @@ Reduction JSInliningHeuristic::Reduce(Node* node) {
? candidate.functions[i].value().shared()
: candidate.shared_info.value();
candidate.can_inline_function[i] = candidate.bytecode[i].has_value();
CHECK_IMPLIES(candidate.can_inline_function[i], shared.IsInlineable());
// Because of concurrent optimization, optimization of the inlining
// candidate could have been disabled meanwhile.
// JSInliner will check this again and not actually inline the function in
// this case.
CHECK_IMPLIES(candidate.can_inline_function[i],
shared.IsInlineable() ||
shared.GetInlineability() ==
SharedFunctionInfo::kHasOptimizationDisabled);
// Do not allow direct recursion i.e. f() -> f(). We still allow indirect
// recurion like f() -> g() -> f(). The indirect recursion is helpful in
// recursion like f() -> g() -> f(). The indirect recursion is helpful in
// cases where f() is a small dispatch function that calls the appropriate
// function. In the case of direct recursion, we only have some static
// information for the first level of inlining and it may not be that useful
// to just inline one level in recursive calls. In some cases like tail
// recursion we may benefit from recursive inlining, if we have additional
// analysis that converts them to iterative implementations. Though it is
// not obvious if such an anlysis is needed.
// not obvious if such an analysis is needed.
if (frame_info.shared_info().ToHandle(&frame_shared_info) &&
frame_shared_info.equals(shared.object())) {
TRACE("Not considering call site #" << node->id() << ":"
......
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