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

Side by Side Diff: runtime/vm/flow_graph_inliner.cc

Issue 11031040: Don't inline functions above the deoptimization threshold. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review comments. Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/deopt_instructions.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/flow_graph_inliner.h" 5 #include "vm/flow_graph_inliner.h"
6 6
7 #include "vm/assert.h" 7 #include "vm/assert.h"
8 #include "vm/compiler.h" 8 #include "vm/compiler.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/flow_graph.h" 10 #include "vm/flow_graph.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 // Abort if the callee has optional parameters. 101 // Abort if the callee has optional parameters.
102 if (function.HasOptionalParameters()) { 102 if (function.HasOptionalParameters()) {
103 TRACE_INLINING(OS::Print(" Bailout: optional parameters\n")); 103 TRACE_INLINING(OS::Print(" Bailout: optional parameters\n"));
104 return false; 104 return false;
105 } 105 }
106 106
107 // Assuming no optional parameters the actual/formal count should match. 107 // Assuming no optional parameters the actual/formal count should match.
108 ASSERT(arguments->length() == function.num_fixed_parameters()); 108 ASSERT(arguments->length() == function.num_fixed_parameters());
109 109
110 // Abort if this function has deoptimized too much.
111 if (function.deoptimization_counter() >=
112 FLAG_deoptimization_counter_threshold) {
113 function.set_is_inlinable(false);
114 TRACE_INLINING(OS::Print(" Bailout: deoptimization threshold\n"));
115 return false;
116 }
117
110 // Abort if this is a recursive occurrence. 118 // Abort if this is a recursive occurrence.
111 if (IsCallRecursive(function, call)) { 119 if (IsCallRecursive(function, call)) {
112 function.set_is_inlinable(false); 120 function.set_is_inlinable(false);
113 TRACE_INLINING(OS::Print(" Bailout: recursive function\n")); 121 TRACE_INLINING(OS::Print(" Bailout: recursive function\n"));
114 return false; 122 return false;
115 } 123 }
116 124
117 // Abort if the callee has an intrinsic translation. 125 // Abort if the callee has an intrinsic translation.
118 if (Intrinsifier::CanIntrinsify(function)) { 126 if (Intrinsifier::CanIntrinsify(function)) {
119 function.set_is_inlinable(false); 127 function.set_is_inlinable(false);
(...skipping 12 matching lines...) Expand all
132 LongJump* base = isolate->long_jump_base(); 140 LongJump* base = isolate->long_jump_base();
133 LongJump jump; 141 LongJump jump;
134 isolate->set_long_jump_base(&jump); 142 isolate->set_long_jump_base(&jump);
135 if (setjmp(*jump.Set()) == 0) { 143 if (setjmp(*jump.Set()) == 0) {
136 // Parse the callee function. 144 // Parse the callee function.
137 ParsedFunction parsed_function(function); 145 ParsedFunction parsed_function(function);
138 Parser::ParseFunction(&parsed_function); 146 Parser::ParseFunction(&parsed_function);
139 parsed_function.AllocateVariables(); 147 parsed_function.AllocateVariables();
140 148
141 // Load IC data for the callee. 149 // Load IC data for the callee.
142 if ((function.deoptimization_counter() < 150 if (function.HasCode()) {
143 FLAG_deoptimization_counter_threshold) &&
144 function.HasCode()) {
145 const Code& unoptimized_code = 151 const Code& unoptimized_code =
146 Code::Handle(function.unoptimized_code()); 152 Code::Handle(function.unoptimized_code());
147 isolate->set_ic_data_array(unoptimized_code.ExtractTypeFeedbackArray()); 153 isolate->set_ic_data_array(unoptimized_code.ExtractTypeFeedbackArray());
148 } 154 }
149 155
150 // Build the callee graph. 156 // Build the callee graph.
151 FlowGraphBuilder builder(parsed_function); 157 FlowGraphBuilder builder(parsed_function);
152 builder.SetInitialBlockId(caller_graph_->max_block_id()); 158 builder.SetInitialBlockId(caller_graph_->max_block_id());
153 FlowGraph* callee_graph = 159 FlowGraph* callee_graph =
154 builder.BuildGraph(FlowGraphBuilder::kValueContext); 160 builder.BuildGraph(FlowGraphBuilder::kValueContext);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 OS::Print("After Inlining of %s\n", flow_graph_-> 347 OS::Print("After Inlining of %s\n", flow_graph_->
342 parsed_function().function().ToFullyQualifiedCString()); 348 parsed_function().function().ToFullyQualifiedCString());
343 FlowGraphPrinter printer(*flow_graph_); 349 FlowGraphPrinter printer(*flow_graph_);
344 printer.PrintBlocks(); 350 printer.PrintBlocks();
345 } 351 }
346 } 352 }
347 } 353 }
348 } 354 }
349 355
350 } // namespace dart 356 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/deopt_instructions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698