[turbofan] Make inlining heuristic less greedy.

Only inline one candidate per iteration to make sure we really inline
the stuff that is called most often.

R=mstarzinger@chromium.org
BUG=v8:4493, v8:4544
LOG=n

Review URL: https://codereview.chromium.org/1439773003

Cr-Commit-Position: refs/heads/master@{#31958}
This commit is contained in:
bmeurer 2015-11-12 05:27:57 -08:00 committed by Commit bot
parent c4e19c7d8d
commit 0b0581421e

View File

@ -98,14 +98,15 @@ void JSInliningHeuristic::Finalize() {
if (candidates_.empty()) return; // Nothing to do without candidates.
if (FLAG_trace_turbo_inlining) PrintCandidates();
while (!candidates_.empty()) {
if (cumulative_count_ > FLAG_max_inlined_nodes_cumulative) break;
auto i = candidates_.begin();
Candidate const& candidate = *i;
inliner_.ReduceJSCall(candidate.node, candidate.function);
cumulative_count_ += candidate.function->shared()->ast_node_count();
candidates_.erase(i);
}
// We inline at most one candidate in every iteration of the fixpoint.
// This is to ensure that we don't consume the full inlining budget
// on things that aren't called very often.
if (cumulative_count_ > FLAG_max_inlined_nodes_cumulative) return;
auto i = candidates_.begin();
Candidate const& candidate = *i;
inliner_.ReduceJSCall(candidate.node, candidate.function);
cumulative_count_ += candidate.function->shared()->ast_node_count();
candidates_.erase(i);
}