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

Side by Side Diff: src/compiler/js-inlining-heuristic.cc

Issue 2731723002: [Turbofan] Don't inline if we never saw a function. (Closed)
Patch Set: Created 3 years, 9 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/feedback-vector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/js-inlining-heuristic.h" 5 #include "src/compiler/js-inlining-heuristic.h"
6 6
7 #include "src/compilation-info.h" 7 #include "src/compilation-info.h"
8 #include "src/compiler/common-operator.h" 8 #include "src/compiler/common-operator.h"
9 #include "src/compiler/node-matchers.h" 9 #include "src/compiler/node-matchers.h"
10 #include "src/compiler/simplified-operator.h" 10 #include "src/compiler/simplified-operator.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 157
158 // We inline at most one candidate in every iteration of the fixpoint. 158 // We inline at most one candidate in every iteration of the fixpoint.
159 // This is to ensure that we don't consume the full inlining budget 159 // This is to ensure that we don't consume the full inlining budget
160 // on things that aren't called very often. 160 // on things that aren't called very often.
161 // TODO(bmeurer): Use std::priority_queue instead of std::set here. 161 // TODO(bmeurer): Use std::priority_queue instead of std::set here.
162 while (!candidates_.empty()) { 162 while (!candidates_.empty()) {
163 if (cumulative_count_ > FLAG_max_inlined_nodes_cumulative) return; 163 if (cumulative_count_ > FLAG_max_inlined_nodes_cumulative) return;
164 auto i = candidates_.begin(); 164 auto i = candidates_.begin();
165 Candidate candidate = *i; 165 Candidate candidate = *i;
166 candidates_.erase(i); 166 candidates_.erase(i);
167 // Only include candidates that we've successfully called before.
168 // The candidate list is sorted, so we can exit at the first occurance of
169 // frequency 0 in the list.
170 if (candidate.frequency <= 0.0) return;
167 // Make sure we don't try to inline dead candidate nodes. 171 // Make sure we don't try to inline dead candidate nodes.
168 if (!candidate.node->IsDead()) { 172 if (!candidate.node->IsDead()) {
169 Reduction const reduction = InlineCandidate(candidate); 173 Reduction const reduction = InlineCandidate(candidate);
170 if (reduction.Changed()) return; 174 if (reduction.Changed()) return;
171 } 175 }
172 } 176 }
173 } 177 }
174 178
175 Reduction JSInliningHeuristic::InlineCandidate(Candidate const& candidate) { 179 Reduction JSInliningHeuristic::InlineCandidate(Candidate const& candidate) {
176 int const num_calls = candidate.num_functions; 180 int const num_calls = candidate.num_functions;
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 return jsgraph()->common(); 315 return jsgraph()->common();
312 } 316 }
313 317
314 SimplifiedOperatorBuilder* JSInliningHeuristic::simplified() const { 318 SimplifiedOperatorBuilder* JSInliningHeuristic::simplified() const {
315 return jsgraph()->simplified(); 319 return jsgraph()->simplified();
316 } 320 }
317 321
318 } // namespace compiler 322 } // namespace compiler
319 } // namespace internal 323 } // namespace internal
320 } // namespace v8 324 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/feedback-vector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698