[TurboFan] Remove maximum inlining levels check from inlining heuristics
We have a check on maximum number of levels that can be inlined. This in some cases causes performance cliffs, when we cannot inline a small function because it has exceeded the number of levels. This cl removes that check. The intuition is that, having gone down several levels in a particular line stopping inlining that chain and exploring a new call site may not be beneficial. Bug: v8:6871 Change-Id: I120056db38e78ce48dff010b6cf994259238582a Reviewed-on: https://chromium-review.googlesource.com/741705 Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Commit-Queue: Benedikt Meurer <bmeurer@chromium.org> Cr-Commit-Position: refs/heads/master@{#49009}
This commit is contained in:
parent
753edc417c
commit
ecd3a2ea3e
@ -139,24 +139,6 @@ Reduction JSInliningHeuristic::Reduce(Node* node) {
|
|||||||
}
|
}
|
||||||
if (!can_inline) return NoChange();
|
if (!can_inline) return NoChange();
|
||||||
|
|
||||||
// Stop inlining once the maximum allowed level is reached.
|
|
||||||
int level = 0;
|
|
||||||
for (Node* frame_state = NodeProperties::GetFrameStateInput(node);
|
|
||||||
frame_state->opcode() == IrOpcode::kFrameState;
|
|
||||||
frame_state = NodeProperties::GetFrameStateInput(frame_state)) {
|
|
||||||
FrameStateInfo const& frame_info = OpParameter<FrameStateInfo>(frame_state);
|
|
||||||
if (FrameStateFunctionInfo::IsJSFunctionType(frame_info.type())) {
|
|
||||||
if (++level > FLAG_max_inlining_levels) {
|
|
||||||
TRACE(
|
|
||||||
"Not considering call site #%d:%s, because inlining depth "
|
|
||||||
"%d exceeds maximum allowed level %d\n",
|
|
||||||
node->id(), node->op()->mnemonic(), level,
|
|
||||||
FLAG_max_inlining_levels);
|
|
||||||
return NoChange();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Gather feedback on how often this call site has been hit before.
|
// Gather feedback on how often this call site has been hit before.
|
||||||
if (node->opcode() == IrOpcode::kJSCall) {
|
if (node->opcode() == IrOpcode::kJSCall) {
|
||||||
CallParameters const p = CallParametersOf(node->op());
|
CallParameters const p = CallParametersOf(node->op());
|
||||||
|
@ -236,7 +236,6 @@ int DebugFrameHelper::FindIndexedNonNativeFrame(StackTraceFrameIterator* it,
|
|||||||
int count = -1;
|
int count = -1;
|
||||||
for (; !it->done(); it->Advance()) {
|
for (; !it->done(); it->Advance()) {
|
||||||
std::vector<FrameSummary> frames;
|
std::vector<FrameSummary> frames;
|
||||||
frames.reserve(FLAG_max_inlining_levels + 1);
|
|
||||||
it->frame()->Summarize(&frames);
|
it->frame()->Summarize(&frames);
|
||||||
for (size_t i = frames.size(); i != 0; i--) {
|
for (size_t i = frames.size(); i != 0; i--) {
|
||||||
// Omit functions from native and extension scripts.
|
// Omit functions from native and extension scripts.
|
||||||
|
@ -29,7 +29,6 @@ DebugStackTraceIterator::DebugStackTraceIterator(Isolate* isolate, int index)
|
|||||||
is_top_frame_(true) {
|
is_top_frame_(true) {
|
||||||
if (iterator_.done()) return;
|
if (iterator_.done()) return;
|
||||||
std::vector<FrameSummary> frames;
|
std::vector<FrameSummary> frames;
|
||||||
frames.reserve(FLAG_max_inlining_levels + 1);
|
|
||||||
iterator_.frame()->Summarize(&frames);
|
iterator_.frame()->Summarize(&frames);
|
||||||
inlined_frame_index_ = static_cast<int>(frames.size());
|
inlined_frame_index_ = static_cast<int>(frames.size());
|
||||||
Advance();
|
Advance();
|
||||||
@ -61,7 +60,6 @@ void DebugStackTraceIterator::Advance() {
|
|||||||
iterator_.Advance();
|
iterator_.Advance();
|
||||||
if (iterator_.done()) break;
|
if (iterator_.done()) break;
|
||||||
std::vector<FrameSummary> frames;
|
std::vector<FrameSummary> frames;
|
||||||
frames.reserve(FLAG_max_inlining_levels + 1);
|
|
||||||
iterator_.frame()->Summarize(&frames);
|
iterator_.frame()->Summarize(&frames);
|
||||||
inlined_frame_index_ = static_cast<int>(frames.size());
|
inlined_frame_index_ = static_cast<int>(frames.size());
|
||||||
}
|
}
|
||||||
|
@ -414,7 +414,6 @@ DEFINE_BOOL(turbo_splitting, true, "split nodes during scheduling in TurboFan")
|
|||||||
DEFINE_BOOL(function_context_specialization, false,
|
DEFINE_BOOL(function_context_specialization, false,
|
||||||
"enable function context specialization in TurboFan")
|
"enable function context specialization in TurboFan")
|
||||||
DEFINE_BOOL(turbo_inlining, true, "enable inlining in TurboFan")
|
DEFINE_BOOL(turbo_inlining, true, "enable inlining in TurboFan")
|
||||||
DEFINE_INT(max_inlining_levels, 5, "maximum number of inlining levels")
|
|
||||||
DEFINE_INT(max_inlined_bytecode_size, 500,
|
DEFINE_INT(max_inlined_bytecode_size, 500,
|
||||||
"maximum size of bytecode for a single inlining")
|
"maximum size of bytecode for a single inlining")
|
||||||
DEFINE_INT(max_inlined_bytecode_size_cumulative, 1000,
|
DEFINE_INT(max_inlined_bytecode_size_cumulative, 1000,
|
||||||
@ -427,7 +426,6 @@ DEFINE_FLOAT(min_inlining_frequency, 0.15, "minimum frequency for inlining")
|
|||||||
DEFINE_BOOL(polymorphic_inlining, true, "polymorphic inlining")
|
DEFINE_BOOL(polymorphic_inlining, true, "polymorphic inlining")
|
||||||
DEFINE_BOOL(stress_inline, false,
|
DEFINE_BOOL(stress_inline, false,
|
||||||
"set high thresholds for inlining to inline as much as possible")
|
"set high thresholds for inlining to inline as much as possible")
|
||||||
DEFINE_VALUE_IMPLICATION(stress_inline, max_inlining_levels, 999999)
|
|
||||||
DEFINE_VALUE_IMPLICATION(stress_inline, max_inlined_bytecode_size, 999999)
|
DEFINE_VALUE_IMPLICATION(stress_inline, max_inlined_bytecode_size, 999999)
|
||||||
DEFINE_VALUE_IMPLICATION(stress_inline, max_inlined_bytecode_size_cumulative,
|
DEFINE_VALUE_IMPLICATION(stress_inline, max_inlined_bytecode_size_cumulative,
|
||||||
999999)
|
999999)
|
||||||
|
@ -1268,7 +1268,6 @@ FrameSummary::~FrameSummary() {
|
|||||||
|
|
||||||
FrameSummary FrameSummary::GetTop(const StandardFrame* frame) {
|
FrameSummary FrameSummary::GetTop(const StandardFrame* frame) {
|
||||||
std::vector<FrameSummary> frames;
|
std::vector<FrameSummary> frames;
|
||||||
frames.reserve(FLAG_max_inlining_levels + 1);
|
|
||||||
frame->Summarize(&frames);
|
frame->Summarize(&frames);
|
||||||
DCHECK_LT(0, frames.size());
|
DCHECK_LT(0, frames.size());
|
||||||
return frames.back();
|
return frames.back();
|
||||||
@ -1288,7 +1287,6 @@ FrameSummary FrameSummary::GetSingle(const StandardFrame* frame) {
|
|||||||
FrameSummary FrameSummary::Get(const StandardFrame* frame, int index) {
|
FrameSummary FrameSummary::Get(const StandardFrame* frame, int index) {
|
||||||
DCHECK_LE(0, index);
|
DCHECK_LE(0, index);
|
||||||
std::vector<FrameSummary> frames;
|
std::vector<FrameSummary> frames;
|
||||||
frames.reserve(FLAG_max_inlining_levels + 1);
|
|
||||||
frame->Summarize(&frames);
|
frame->Summarize(&frames);
|
||||||
DCHECK_GT(frames.size(), index);
|
DCHECK_GT(frames.size(), index);
|
||||||
return frames[index];
|
return frames[index];
|
||||||
|
@ -390,7 +390,6 @@ class FrameArrayBuilder {
|
|||||||
|
|
||||||
void AppendStandardFrame(StandardFrame* frame) {
|
void AppendStandardFrame(StandardFrame* frame) {
|
||||||
std::vector<FrameSummary> frames;
|
std::vector<FrameSummary> frames;
|
||||||
frames.reserve(FLAG_max_inlining_levels + 1);
|
|
||||||
frame->Summarize(&frames);
|
frame->Summarize(&frames);
|
||||||
// A standard frame may include many summarized frames (due to inlining).
|
// A standard frame may include many summarized frames (due to inlining).
|
||||||
for (size_t i = frames.size(); i != 0 && !full(); i--) {
|
for (size_t i = frames.size(); i != 0 && !full(); i--) {
|
||||||
@ -802,7 +801,6 @@ Handle<FixedArray> Isolate::CaptureCurrentStackTrace(
|
|||||||
// Set initial size to the maximum inlining level + 1 for the outermost
|
// Set initial size to the maximum inlining level + 1 for the outermost
|
||||||
// function.
|
// function.
|
||||||
std::vector<FrameSummary> frames;
|
std::vector<FrameSummary> frames;
|
||||||
frames.reserve(FLAG_max_inlining_levels + 1);
|
|
||||||
frame->Summarize(&frames);
|
frame->Summarize(&frames);
|
||||||
for (size_t i = frames.size(); i != 0 && frames_seen < limit; i--) {
|
for (size_t i = frames.size(); i != 0 && frames_seen < limit; i--) {
|
||||||
FrameSummary& frame = frames[i - 1];
|
FrameSummary& frame = frames[i - 1];
|
||||||
@ -1601,7 +1599,6 @@ bool Isolate::ComputeLocation(MessageLocation* target) {
|
|||||||
// baseline code. For optimized code this will use the deoptimization
|
// baseline code. For optimized code this will use the deoptimization
|
||||||
// information to get canonical location information.
|
// information to get canonical location information.
|
||||||
std::vector<FrameSummary> frames;
|
std::vector<FrameSummary> frames;
|
||||||
frames.reserve(FLAG_max_inlining_levels + 1);
|
|
||||||
frame->Summarize(&frames);
|
frame->Summarize(&frames);
|
||||||
FrameSummary& summary = frames.back();
|
FrameSummary& summary = frames.back();
|
||||||
int pos = summary.SourcePosition();
|
int pos = summary.SourcePosition();
|
||||||
|
@ -434,7 +434,6 @@ RUNTIME_FUNCTION(Runtime_GetFrameCount) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<FrameSummary> frames;
|
std::vector<FrameSummary> frames;
|
||||||
frames.reserve(FLAG_max_inlining_levels + 1);
|
|
||||||
for (StackTraceFrameIterator it(isolate, id); !it.done(); it.Advance()) {
|
for (StackTraceFrameIterator it(isolate, id); !it.done(); it.Advance()) {
|
||||||
frames.clear();
|
frames.clear();
|
||||||
it.frame()->Summarize(&frames);
|
it.frame()->Summarize(&frames);
|
||||||
|
@ -370,7 +370,6 @@ bool ComputeLocation(Isolate* isolate, MessageLocation* target) {
|
|||||||
// baseline code. For optimized code this will use the deoptimization
|
// baseline code. For optimized code this will use the deoptimization
|
||||||
// information to get canonical location information.
|
// information to get canonical location information.
|
||||||
std::vector<FrameSummary> frames;
|
std::vector<FrameSummary> frames;
|
||||||
frames.reserve(FLAG_max_inlining_levels + 1);
|
|
||||||
it.frame()->Summarize(&frames);
|
it.frame()->Summarize(&frames);
|
||||||
auto& summary = frames.back().AsJavaScript();
|
auto& summary = frames.back().AsJavaScript();
|
||||||
Handle<SharedFunctionInfo> shared(summary.function()->shared());
|
Handle<SharedFunctionInfo> shared(summary.function()->shared());
|
||||||
|
Loading…
Reference in New Issue
Block a user