Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Unified Diff: src/compiler/js-inlining-heuristic.cc

Issue 1435373002: [turbofan] Don't abort inlining on first failed attempt. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-inlining-heuristic.cc
diff --git a/src/compiler/js-inlining-heuristic.cc b/src/compiler/js-inlining-heuristic.cc
index 74b872360599e4508f70eb1394bc50a533ba4c44..38595dbf95cb9b2d4e72be03aad76fb6d206d115 100644
--- a/src/compiler/js-inlining-heuristic.cc
+++ b/src/compiler/js-inlining-heuristic.cc
@@ -101,12 +101,18 @@ void JSInliningHeuristic::Finalize() {
// 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);
+ // TODO(bmeurer): Use std::priority_queue instead of std::set here.
+ while (!candidates_.empty()) {
+ if (cumulative_count_ > FLAG_max_inlined_nodes_cumulative) return;
+ auto i = candidates_.begin();
+ Candidate candidate = *i;
+ candidates_.erase(i);
+ Reduction r = inliner_.ReduceJSCall(candidate.node, candidate.function);
+ if (r.Changed()) {
+ cumulative_count_ += candidate.function->shared()->ast_node_count();
+ return;
+ }
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698