Commit 999ef891 authored by Georg Neis's avatar Georg Neis Committed by V8 LUCI CQ

[compiler] Fix a DCHECK

Inlineability can change when a function gets its deoptimization
disabled. We can bailout if we notice that (but keep in mind that it
can still happen later).

Bug: chromium:1250244, v8:7790
Change-Id: Ib088396f41eceeaae7ccdfce287cd11c5bee738a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3164980Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76896}
parent 899b5443
......@@ -472,11 +472,24 @@ Reduction JSInliner::ReduceJSCall(Node* node) {
// Determine the call target.
base::Optional<SharedFunctionInfoRef> shared_info(DetermineCallTarget(node));
if (!shared_info.has_value()) return NoChange();
DCHECK(shared_info->IsInlineable());
SharedFunctionInfoRef outer_shared_info =
MakeRef(broker(), info_->shared_info());
SharedFunctionInfo::Inlineability inlineability =
shared_info->GetInlineability();
if (inlineability != SharedFunctionInfo::kIsInlineable) {
// The function is no longer inlineable. The only way this can happen is if
// the function had its optimization disabled in the meantime, e.g. because
// another optimization job failed too often.
CHECK_EQ(inlineability, SharedFunctionInfo::kHasOptimizationDisabled);
TRACE("Not inlining " << *shared_info << " into " << outer_shared_info
<< " because it had its optimization disabled.");
return NoChange();
}
// NOTE: Even though we bailout in the kHasOptimizationDisabled case above, we
// won't notice if the function's optimization is disabled after this point.
// Constructor must be constructable.
if (node->opcode() == IrOpcode::kJSConstruct &&
!IsConstructable(shared_info->kind())) {
......
......@@ -244,8 +244,6 @@ SharedFunctionInfo::Inlineability SharedFunctionInfo::GetInlineability(
return kNeedsBinaryCoverage;
}
if (optimization_disabled()) return kHasOptimizationDisabled;
// Built-in functions are handled by the JSCallReducer.
if (HasBuiltinId()) return kIsBuiltin;
......@@ -266,6 +264,8 @@ SharedFunctionInfo::Inlineability SharedFunctionInfo::GetInlineability(
if (HasBreakInfo()) return kMayContainBreakPoints;
if (optimization_disabled()) return kHasOptimizationDisabled;
return kIsInlineable;
}
......
......@@ -533,17 +533,19 @@ class SharedFunctionInfo
inline bool ShouldFlushCode(base::EnumSet<CodeFlushMode> code_flush_mode);
enum Inlineability {
kIsInlineable,
// Different reasons for not being inlineable:
kHasNoScript,
kNeedsBinaryCoverage,
kHasOptimizationDisabled,
kIsBuiltin,
kIsNotUserCode,
kHasNoBytecode,
kExceedsBytecodeLimit,
kMayContainBreakPoints,
kHasOptimizationDisabled,
// Actually inlineable!
kIsInlineable,
};
// Returns the first value that applies (see enum definition for the order).
template <typename IsolateT>
Inlineability GetInlineability(IsolateT* isolate, bool is_turboprop) const;
......
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