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

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

Issue 2362853003: Revert of [turbofan] Don't take into account source size for inlining heuristics. (Closed)
Patch Set: Created 4 years, 3 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 | test/cctest/test-heap-profiler.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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return 0; 42 return 0;
43 } 43 }
44 44
45 bool CanInlineFunction(Handle<JSFunction> function) { 45 bool CanInlineFunction(Handle<JSFunction> function) {
46 // Built-in functions are handled by the JSBuiltinReducer. 46 // Built-in functions are handled by the JSBuiltinReducer.
47 if (function->shared()->HasBuiltinFunctionId()) return false; 47 if (function->shared()->HasBuiltinFunctionId()) return false;
48 48
49 // Don't inline builtins. 49 // Don't inline builtins.
50 if (function->shared()->IsBuiltin()) return false; 50 if (function->shared()->IsBuiltin()) return false;
51 51
52 // Quick check on source code length to avoid parsing large candidate.
53 if (function->shared()->SourceSize() > FLAG_max_inlined_source_size) {
54 return false;
55 }
56
52 // Quick check on the size of the AST to avoid parsing large candidate. 57 // Quick check on the size of the AST to avoid parsing large candidate.
53 if (function->shared()->ast_node_count() > FLAG_max_inlined_nodes) { 58 if (function->shared()->ast_node_count() > FLAG_max_inlined_nodes) {
54 return false; 59 return false;
55 } 60 }
56 61
57 // Avoid inlining across the boundary of asm.js code. 62 // Avoid inlining across the boundary of asm.js code.
58 if (function->shared()->asm_function()) return false; 63 if (function->shared()->asm_function()) return false;
59 return true; 64 return true;
60 } 65 }
61 66
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 } 280 }
276 } 281 }
277 282
278 void JSInliningHeuristic::PrintCandidates() { 283 void JSInliningHeuristic::PrintCandidates() {
279 PrintF("Candidates for inlining (size=%zu):\n", candidates_.size()); 284 PrintF("Candidates for inlining (size=%zu):\n", candidates_.size());
280 for (const Candidate& candidate : candidates_) { 285 for (const Candidate& candidate : candidates_) {
281 PrintF(" #%d:%s, frequency:%g\n", candidate.node->id(), 286 PrintF(" #%d:%s, frequency:%g\n", candidate.node->id(),
282 candidate.node->op()->mnemonic(), candidate.frequency); 287 candidate.node->op()->mnemonic(), candidate.frequency);
283 for (int i = 0; i < candidate.num_functions; ++i) { 288 for (int i = 0; i < candidate.num_functions; ++i) {
284 Handle<JSFunction> function = candidate.functions[i]; 289 Handle<JSFunction> function = candidate.functions[i];
285 PrintF(" - size:%d, name: %s\n", function->shared()->ast_node_count(), 290 PrintF(" - size[source]:%d, size[ast]:%d, name: %s\n",
291 function->shared()->SourceSize(),
292 function->shared()->ast_node_count(),
286 function->shared()->DebugName()->ToCString().get()); 293 function->shared()->DebugName()->ToCString().get());
287 } 294 }
288 } 295 }
289 } 296 }
290 297
291 Graph* JSInliningHeuristic::graph() const { return jsgraph()->graph(); } 298 Graph* JSInliningHeuristic::graph() const { return jsgraph()->graph(); }
292 299
293 CommonOperatorBuilder* JSInliningHeuristic::common() const { 300 CommonOperatorBuilder* JSInliningHeuristic::common() const {
294 return jsgraph()->common(); 301 return jsgraph()->common();
295 } 302 }
296 303
297 SimplifiedOperatorBuilder* JSInliningHeuristic::simplified() const { 304 SimplifiedOperatorBuilder* JSInliningHeuristic::simplified() const {
298 return jsgraph()->simplified(); 305 return jsgraph()->simplified();
299 } 306 }
300 307
301 } // namespace compiler 308 } // namespace compiler
302 } // namespace internal 309 } // namespace internal
303 } // namespace v8 310 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698