Commit 83c1a36a authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Add tracing to SharedFunctionInfo::IsInlineable

In particular, print the reason for returning false (when
FLAG_trace_turbo_inlining is enabled).

Change-Id: I8924562b16612e5030d5870648ff4827d2a0ecc6
Reviewed-on: https://chromium-review.googlesource.com/c/1445981Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59246}
parent e8c3d743
......@@ -12587,34 +12587,57 @@ Handle<Object> SharedFunctionInfo::GetSourceCodeHarmony(
return builder.Finish().ToHandleChecked();
}
namespace {
void TraceInlining(SharedFunctionInfo shared, const char* msg) {
if (FLAG_trace_turbo_inlining) {
std::cout << Brief(shared) << ": IsInlineable? " << msg << "\n";
}
}
} // namespace
bool SharedFunctionInfo::IsInlineable() {
// Check that the function has a script associated with it.
if (!script()->IsScript()) return false;
if (!script()->IsScript()) {
TraceInlining(*this, "false (no Script associated with it)");
return false;
}
if (GetIsolate()->is_precise_binary_code_coverage() &&
!has_reported_binary_coverage()) {
// We may miss invocations if this function is inlined.
TraceInlining(*this, "false (requires precise binary coverage)");
return false;
}
if (optimization_disabled()) return false;
if (optimization_disabled()) {
TraceInlining(*this, "false (optimization disabled)");
return false;
}
// Built-in functions are handled by the JSCallReducer.
if (HasBuiltinFunctionId()) return false;
if (HasBuiltinFunctionId()) {
TraceInlining(*this, "false (is a builtin)");
return false;
}
// Only choose user code for inlining.
if (!IsUserJavaScript()) return false;
if (!IsUserJavaScript()) {
TraceInlining(*this, "false (is not user code)");
return false;
}
// If there is no bytecode array, it is either not compiled or it is compiled
// with WebAssembly for the asm.js pipeline. In either case we don't want to
// inline.
if (!HasBytecodeArray()) return false;
if (!HasBytecodeArray()) {
TraceInlining(*this, "false (has no BytecodeArray)");
return false;
}
// Quick check on the size of the bytecode to avoid inlining large functions.
if (GetBytecodeArray()->length() > FLAG_max_inlined_bytecode_size) {
TraceInlining(*this, "false (length > FLAG_max_inlined_bytecode_size)");
return false;
}
TraceInlining(*this, "true");
return 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