Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| 11 #include "vm/flow_graph_builder.h" | 11 #include "vm/flow_graph_builder.h" |
| 12 #include "vm/flow_graph_optimizer.h" | 12 #include "vm/flow_graph_optimizer.h" |
| 13 #include "vm/il_printer.h" | 13 #include "vm/il_printer.h" |
| 14 #include "vm/intrinsifier.h" | 14 #include "vm/intrinsifier.h" |
| 15 #include "vm/longjump.h" | 15 #include "vm/longjump.h" |
| 16 #include "vm/object.h" | 16 #include "vm/object.h" |
| 17 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
| 18 | 18 |
| 19 namespace dart { | 19 namespace dart { |
| 20 | 20 |
| 21 DEFINE_FLAG(bool, trace_inlining, false, "Trace inlining"); | 21 DEFINE_FLAG(bool, trace_inlining, false, "Trace inlining"); |
| 22 DEFINE_FLAG(charp, inlining_filter, NULL, "Inline only in named function"); | 22 DEFINE_FLAG(charp, inlining_filter, NULL, "Inline only in named function"); |
| 23 DEFINE_FLAG(int, inlining_size_threshold, 250, | 23 DEFINE_FLAG(int, inlining_size_threshold, 250, |
| 24 "Inline only functions with up to threshold instructions"); | 24 "Inline only functions with up to threshold instructions (default 250)"); |
| 25 DEFINE_FLAG(int, inlining_depth_threshold, 1, | |
| 26 "Inline recursively up to threshold depth (default 1)"); | |
| 25 DEFINE_FLAG(bool, inline_control_flow, true, | 27 DEFINE_FLAG(bool, inline_control_flow, true, |
| 26 "Inline functions with control flow."); | 28 "Inline functions with control flow."); |
| 27 DECLARE_FLAG(bool, print_flow_graph); | 29 DECLARE_FLAG(bool, print_flow_graph); |
| 28 DECLARE_FLAG(int, deoptimization_counter_threshold); | 30 DECLARE_FLAG(int, deoptimization_counter_threshold); |
| 29 | 31 |
| 30 #define TRACE_INLINING(statement) \ | 32 #define TRACE_INLINING(statement) \ |
| 31 do { \ | 33 do { \ |
| 32 if (FLAG_trace_inlining) statement; \ | 34 if (FLAG_trace_inlining) statement; \ |
| 33 } while (false) | 35 } while (false) |
| 34 | 36 |
| 35 | 37 |
| 36 // Test if a call is recursive by looking in the deoptimization environment. | 38 // Test if a call is recursive by looking in the deoptimization environment. |
| 37 static bool IsCallRecursive(const Function& function, Definition* call) { | 39 static bool IsCallRecursive(const Function& function, Definition* call) { |
| 38 Environment* env = call->env(); | 40 Environment* env = call->env(); |
| 39 while (env != NULL) { | 41 while (env != NULL) { |
| 40 if (function.raw() == env->function().raw()) return true; | 42 if (function.raw() == env->function().raw()) return true; |
| 41 env = env->outer(); | 43 env = env->outer(); |
| 42 } | 44 } |
| 43 return false; | 45 return false; |
| 44 } | 46 } |
| 45 | 47 |
| 46 | 48 |
| 47 class CallSiteInliner : public FlowGraphVisitor { | 49 // A collection of call sites to consider for inlining. |
| 50 class CallSites : public FlowGraphVisitor { | |
| 48 public: | 51 public: |
| 49 explicit CallSiteInliner(FlowGraph* flow_graph) | 52 explicit CallSites(FlowGraph* flow_graph) |
| 50 : FlowGraphVisitor(flow_graph->postorder()), | 53 : FlowGraphVisitor(flow_graph->postorder()), // We don't use this order. |
| 51 caller_graph_(flow_graph), | |
| 52 next_ssa_temp_index_(flow_graph->max_virtual_register_number()), | |
| 53 inlined_(false), | |
| 54 initial_size_(flow_graph->InstructionCount()), | |
| 55 inlined_size_(0), | |
| 56 static_calls_(), | 54 static_calls_(), |
| 57 closure_calls_(), | 55 closure_calls_(), |
| 58 instance_calls_() { } | 56 instance_calls_() { } |
| 59 | 57 |
| 58 GrowableArray<StaticCallInstr*>* static_calls() { | |
| 59 return &static_calls_; | |
| 60 } | |
| 61 | |
| 62 GrowableArray<ClosureCallInstr*>* closure_calls() { | |
| 63 return &closure_calls_; | |
| 64 } | |
| 65 | |
| 66 GrowableArray<PolymorphicInstanceCallInstr*>* instance_calls() { | |
| 67 return &instance_calls_; | |
| 68 } | |
| 69 | |
| 70 bool HasCalls() const { | |
| 71 return !(static_calls_.is_empty() && | |
| 72 closure_calls_.is_empty() && | |
| 73 instance_calls_.is_empty()); | |
| 74 } | |
| 75 | |
| 76 void Clear() { | |
| 77 static_calls_.Clear(); | |
| 78 closure_calls_.Clear(); | |
| 79 instance_calls_.Clear(); | |
| 80 } | |
| 81 | |
| 82 void FindCallSites(FlowGraph* graph) { | |
| 83 BlockIterator block_it = graph->postorder_iterator(); | |
|
Kevin Millikin (Google)
2012/10/10 09:45:25
I'd rather have this in the for at the cost of an
zerny-google
2012/10/10 13:17:06
Done.
| |
| 84 for (; !block_it.Done(); block_it.Advance()) { | |
| 85 ForwardInstructionIterator it(block_it.Current()); | |
| 86 for (; !it.Done(); it.Advance()) { | |
| 87 it.Current()->Accept(this); | |
| 88 } | |
| 89 } | |
| 90 } | |
| 91 | |
| 60 void VisitClosureCall(ClosureCallInstr* call) { | 92 void VisitClosureCall(ClosureCallInstr* call) { |
| 61 closure_calls_.Add(call); | 93 closure_calls_.Add(call); |
| 62 } | 94 } |
| 63 | 95 |
| 64 void VisitPolymorphicInstanceCall(PolymorphicInstanceCallInstr* call) { | 96 void VisitPolymorphicInstanceCall(PolymorphicInstanceCallInstr* call) { |
| 65 instance_calls_.Add(call); | 97 instance_calls_.Add(call); |
| 66 } | 98 } |
| 67 | 99 |
| 68 void VisitStaticCall(StaticCallInstr* call) { | 100 void VisitStaticCall(StaticCallInstr* call) { |
| 69 if (call->function().is_inlinable()) static_calls_.Add(call); | 101 if (call->function().is_inlinable()) static_calls_.Add(call); |
| 70 } | 102 } |
| 71 | 103 |
| 72 void FindCallSites() { | 104 private: |
| 73 VisitBlocks(); | 105 GrowableArray<StaticCallInstr*> static_calls_; |
| 74 } | 106 GrowableArray<ClosureCallInstr*> closure_calls_; |
| 107 GrowableArray<PolymorphicInstanceCallInstr*> instance_calls_; | |
| 108 | |
| 109 DISALLOW_COPY_AND_ASSIGN(CallSites); | |
| 110 }; | |
| 111 | |
| 112 | |
| 113 class CallSiteInliner : public ValueObject { | |
| 114 public: | |
| 115 explicit CallSiteInliner(FlowGraph* flow_graph) | |
| 116 : caller_graph_(flow_graph), | |
| 117 next_ssa_temp_index_(flow_graph->max_virtual_register_number()), | |
| 118 inlined_(false), | |
| 119 initial_size_(flow_graph->InstructionCount()), | |
| 120 inlined_size_(0), | |
| 121 inlining_depth_(1), | |
| 122 collected_call_sites_(NULL), | |
| 123 inlining_call_sites_(NULL) { } | |
| 75 | 124 |
| 76 void InlineCalls() { | 125 void InlineCalls() { |
| 77 InlineStaticCalls(); | 126 // If inlining depth is less then one abort. |
| 78 InlineClosureCalls(); | 127 if (FLAG_inlining_depth_threshold < 1) return; |
| 79 InlineInstanceCalls(); | 128 // Create two call site collections to swap between. |
| 129 CallSites sites1(caller_graph_); | |
| 130 CallSites sites2(caller_graph_); | |
| 131 CallSites* call_sites_temp = NULL; | |
| 132 collected_call_sites_ = &sites1; | |
| 133 inlining_call_sites_ = &sites2; | |
| 134 // Collect initial call sites. | |
| 135 collected_call_sites_->FindCallSites(caller_graph_); | |
| 136 while (collected_call_sites_->HasCalls()) { | |
| 137 TRACE_INLINING(OS::Print(" Depth %"Pd" ----------\n", inlining_depth_)); | |
| 138 // Swap collected and inlining arrays and clear the new collecting array. | |
| 139 call_sites_temp = collected_call_sites_; | |
| 140 collected_call_sites_ = inlining_call_sites_; | |
| 141 inlining_call_sites_ = call_sites_temp; | |
| 142 collected_call_sites_->Clear(); | |
| 143 // Inline call sites at the current depth. | |
| 144 InlineStaticCalls(); | |
| 145 InlineClosureCalls(); | |
| 146 InlineInstanceCalls(); | |
| 147 // Increment the inlining depth. Checked before recursive inlining. | |
| 148 ++inlining_depth_; | |
| 149 } | |
| 150 collected_call_sites_ = NULL; | |
| 151 inlining_call_sites_ = NULL; | |
| 80 } | 152 } |
| 81 | 153 |
| 82 bool inlined() const { return inlined_; } | 154 bool inlined() const { return inlined_; } |
| 83 | 155 |
| 84 double GrowthFactor() const { | 156 double GrowthFactor() const { |
| 85 return static_cast<double>(inlined_size_) / | 157 return static_cast<double>(inlined_size_) / |
| 86 static_cast<double>(initial_size_); | 158 static_cast<double>(initial_size_); |
| 87 } | 159 } |
| 88 | 160 |
| 89 private: | 161 private: |
| 90 bool TryInlining(const Function& function, | 162 bool TryInlining(const Function& function, |
| 91 GrowableArray<Value*>* arguments, | 163 GrowableArray<Value*>* arguments, |
| 92 Definition* call) { | 164 Definition* call) { |
| 93 TRACE_INLINING(OS::Print(" => %s\n", function.ToCString())); | 165 TRACE_INLINING(OS::Print(" => %s (deopt count %d)\n", |
| 166 function.ToCString(), | |
| 167 function.deoptimization_counter())); | |
| 94 | 168 |
| 95 // Abort if the inlinable bit on the function is low. | 169 // Abort if the inlinable bit on the function is low. |
| 96 if (!function.is_inlinable()) { | 170 if (!function.is_inlinable()) { |
| 97 TRACE_INLINING(OS::Print(" Bailout: not inlinable\n")); | 171 TRACE_INLINING(OS::Print(" Bailout: not inlinable\n")); |
| 98 return false; | 172 return false; |
| 99 } | 173 } |
| 100 | 174 |
| 101 // Abort if the callee has optional parameters. | 175 // Abort if the callee has optional parameters. |
| 102 if (function.HasOptionalParameters()) { | 176 if (function.HasOptionalParameters()) { |
| 103 TRACE_INLINING(OS::Print(" Bailout: optional parameters\n")); | 177 TRACE_INLINING(OS::Print(" Bailout: optional parameters\n")); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 153 isolate->set_ic_data_array(unoptimized_code.ExtractTypeFeedbackArray()); | 227 isolate->set_ic_data_array(unoptimized_code.ExtractTypeFeedbackArray()); |
| 154 } | 228 } |
| 155 | 229 |
| 156 // Build the callee graph. | 230 // Build the callee graph. |
| 157 FlowGraphBuilder builder(parsed_function); | 231 FlowGraphBuilder builder(parsed_function); |
| 158 builder.SetInitialBlockId(caller_graph_->max_block_id()); | 232 builder.SetInitialBlockId(caller_graph_->max_block_id()); |
| 159 FlowGraph* callee_graph = | 233 FlowGraph* callee_graph = |
| 160 builder.BuildGraph(FlowGraphBuilder::kValueContext); | 234 builder.BuildGraph(FlowGraphBuilder::kValueContext); |
| 161 | 235 |
| 162 // Abort if the callee graph contains control flow. | 236 // Abort if the callee graph contains control flow. |
| 163 if ((callee_graph->preorder().length() != 2) && | 237 if (!FLAG_inline_control_flow && |
| 164 !FLAG_inline_control_flow) { | 238 (callee_graph->preorder().length() != 2)) { |
| 165 function.set_is_inlinable(false); | 239 function.set_is_inlinable(false); |
| 166 isolate->set_long_jump_base(base); | 240 isolate->set_long_jump_base(base); |
| 167 isolate->set_ic_data_array(prev_ic_data.raw()); | 241 isolate->set_ic_data_array(prev_ic_data.raw()); |
| 168 TRACE_INLINING(OS::Print(" Bailout: control flow\n")); | 242 TRACE_INLINING(OS::Print(" Bailout: control flow\n")); |
| 169 return false; | 243 return false; |
| 170 } | 244 } |
| 171 | 245 |
| 172 // Compute SSA on the callee graph, catching bailouts. | 246 // Compute SSA on the callee graph, catching bailouts. |
| 173 callee_graph->ComputeSSA(next_ssa_temp_index_); | 247 callee_graph->ComputeSSA(next_ssa_temp_index_); |
| 174 callee_graph->ComputeUseLists(); | 248 callee_graph->ComputeUseLists(); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 190 intptr_t size = callee_graph->InstructionCount(); | 264 intptr_t size = callee_graph->InstructionCount(); |
| 191 if (size > FLAG_inlining_size_threshold) { | 265 if (size > FLAG_inlining_size_threshold) { |
| 192 function.set_is_inlinable(false); | 266 function.set_is_inlinable(false); |
| 193 isolate->set_long_jump_base(base); | 267 isolate->set_long_jump_base(base); |
| 194 isolate->set_deopt_id(prev_deopt_id); | 268 isolate->set_deopt_id(prev_deopt_id); |
| 195 isolate->set_ic_data_array(prev_ic_data.raw()); | 269 isolate->set_ic_data_array(prev_ic_data.raw()); |
| 196 TRACE_INLINING(OS::Print(" Bailout: graph size %"Pd"\n", size)); | 270 TRACE_INLINING(OS::Print(" Bailout: graph size %"Pd"\n", size)); |
| 197 return false; | 271 return false; |
| 198 } | 272 } |
| 199 | 273 |
| 200 // TODO(zerny): If effort is less than threshold then inline recursively. | 274 // If depth is less or equal to threshold recursively add call sites. |
| 275 if (inlining_depth_ < FLAG_inlining_depth_threshold) { | |
| 276 collected_call_sites_->FindCallSites(callee_graph); | |
| 277 } | |
| 201 | 278 |
| 202 // Plug result in the caller graph. | 279 // Plug result in the caller graph. |
| 203 caller_graph_->InlineCall(call, callee_graph); | 280 caller_graph_->InlineCall(call, callee_graph); |
| 204 next_ssa_temp_index_ = caller_graph_->max_virtual_register_number(); | 281 next_ssa_temp_index_ = caller_graph_->max_virtual_register_number(); |
| 205 | 282 |
| 206 // Remove push arguments of the call. | 283 // Remove push arguments of the call. |
| 207 for (intptr_t i = 0; i < call->ArgumentCount(); ++i) { | 284 for (intptr_t i = 0; i < call->ArgumentCount(); ++i) { |
| 208 PushArgumentInstr* push = call->ArgumentAt(i); | 285 PushArgumentInstr* push = call->ArgumentAt(i); |
| 209 push->ReplaceUsesWith(push->value()->definition()); | 286 push->ReplaceUsesWith(push->value()->definition()); |
| 210 push->RemoveFromGraph(); | 287 push->RemoveFromGraph(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 isolate->object_store()->clear_sticky_error(); | 321 isolate->object_store()->clear_sticky_error(); |
| 245 isolate->set_long_jump_base(base); | 322 isolate->set_long_jump_base(base); |
| 246 isolate->set_deopt_id(prev_deopt_id); | 323 isolate->set_deopt_id(prev_deopt_id); |
| 247 isolate->set_ic_data_array(prev_ic_data.raw()); | 324 isolate->set_ic_data_array(prev_ic_data.raw()); |
| 248 TRACE_INLINING(OS::Print(" Bailout: %s\n", error.ToErrorCString())); | 325 TRACE_INLINING(OS::Print(" Bailout: %s\n", error.ToErrorCString())); |
| 249 return false; | 326 return false; |
| 250 } | 327 } |
| 251 } | 328 } |
| 252 | 329 |
| 253 void InlineStaticCalls() { | 330 void InlineStaticCalls() { |
| 254 TRACE_INLINING(OS::Print(" Static Calls (%d)\n", | 331 const GrowableArray<StaticCallInstr*>& calls = |
| 255 static_calls_.length())); | 332 *inlining_call_sites_->static_calls(); |
| 256 for (intptr_t i = 0; i < static_calls_.length(); ++i) { | 333 TRACE_INLINING(OS::Print(" Static Calls (%d)\n", calls.length())); |
| 257 StaticCallInstr* call = static_calls_[i]; | 334 for (intptr_t i = 0; i < calls.length(); ++i) { |
| 335 StaticCallInstr* call = calls[i]; | |
| 258 GrowableArray<Value*> arguments(call->ArgumentCount()); | 336 GrowableArray<Value*> arguments(call->ArgumentCount()); |
| 259 for (int i = 0; i < call->ArgumentCount(); ++i) { | 337 for (int i = 0; i < call->ArgumentCount(); ++i) { |
| 260 arguments.Add(call->ArgumentAt(i)->value()); | 338 arguments.Add(call->ArgumentAt(i)->value()); |
| 261 } | 339 } |
| 262 TryInlining(call->function(), &arguments, call); | 340 TryInlining(call->function(), &arguments, call); |
| 263 } | 341 } |
| 264 } | 342 } |
| 265 | 343 |
| 266 void InlineClosureCalls() { | 344 void InlineClosureCalls() { |
| 267 TRACE_INLINING(OS::Print(" Closure Calls (%d)\n", | 345 const GrowableArray<ClosureCallInstr*>& calls = |
| 268 closure_calls_.length())); | 346 *inlining_call_sites_->closure_calls(); |
| 269 for (intptr_t i = 0; i < closure_calls_.length(); ++i) { | 347 TRACE_INLINING(OS::Print(" Closure Calls (%d)\n", calls.length())); |
| 270 ClosureCallInstr* call = closure_calls_[i]; | 348 for (intptr_t i = 0; i < calls.length(); ++i) { |
| 349 ClosureCallInstr* call = calls[i]; | |
| 271 // Find the closure of the callee. | 350 // Find the closure of the callee. |
| 272 ASSERT(call->ArgumentCount() > 0); | 351 ASSERT(call->ArgumentCount() > 0); |
| 273 const CreateClosureInstr* closure = | 352 const CreateClosureInstr* closure = |
| 274 call->ArgumentAt(0)->value()->definition()->AsCreateClosure(); | 353 call->ArgumentAt(0)->value()->definition()->AsCreateClosure(); |
| 275 if (closure == NULL) { | 354 if (closure == NULL) { |
| 276 TRACE_INLINING(OS::Print(" Bailout: non-closure operator\n")); | 355 TRACE_INLINING(OS::Print(" Bailout: non-closure operator\n")); |
| 277 continue; | 356 continue; |
| 278 } | 357 } |
| 279 GrowableArray<Value*> arguments(call->ArgumentCount() - 1); | 358 GrowableArray<Value*> arguments(call->ArgumentCount() - 1); |
| 280 for (int i = 1; i < call->ArgumentCount(); ++i) { | 359 for (int i = 1; i < call->ArgumentCount(); ++i) { |
| 281 arguments.Add(call->ArgumentAt(i)->value()); | 360 arguments.Add(call->ArgumentAt(i)->value()); |
| 282 } | 361 } |
| 283 TryInlining(closure->function(), &arguments, call); | 362 TryInlining(closure->function(), &arguments, call); |
| 284 } | 363 } |
| 285 } | 364 } |
| 286 | 365 |
| 287 void InlineInstanceCalls() { | 366 void InlineInstanceCalls() { |
| 367 const GrowableArray<PolymorphicInstanceCallInstr*>& calls = | |
| 368 *inlining_call_sites_->instance_calls(); | |
| 288 TRACE_INLINING(OS::Print(" Polymorphic Instance Calls (%d)\n", | 369 TRACE_INLINING(OS::Print(" Polymorphic Instance Calls (%d)\n", |
| 289 instance_calls_.length())); | 370 calls.length())); |
| 290 for (intptr_t i = 0; i < instance_calls_.length(); ++i) { | 371 for (intptr_t i = 0; i < calls.length(); ++i) { |
| 291 PolymorphicInstanceCallInstr* instr = instance_calls_[i]; | 372 PolymorphicInstanceCallInstr* instr = calls[i]; |
| 292 const ICData& ic_data = instr->ic_data(); | 373 const ICData& ic_data = instr->ic_data(); |
| 293 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0)); | 374 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0)); |
| 294 if (instr->with_checks()) { | 375 if (instr->with_checks()) { |
| 295 TRACE_INLINING(OS::Print(" Bailout: %"Pd" checks target '%s'\n", | 376 TRACE_INLINING(OS::Print(" Bailout: %"Pd" checks target '%s'\n", |
| 296 ic_data.NumberOfChecks(), | 377 ic_data.NumberOfChecks(), |
| 297 target.ToCString())); | 378 target.ToCString())); |
| 298 continue; | 379 continue; |
| 299 } | 380 } |
| 300 GrowableArray<Value*> arguments(instr->ArgumentCount()); | 381 GrowableArray<Value*> arguments(instr->ArgumentCount()); |
| 301 for (int i = 0; i < instr->ArgumentCount(); ++i) { | 382 for (int i = 0; i < instr->ArgumentCount(); ++i) { |
| 302 arguments.Add(instr->ArgumentAt(i)->value()); | 383 arguments.Add(instr->ArgumentAt(i)->value()); |
| 303 } | 384 } |
| 304 TryInlining(target, &arguments, instr); | 385 TryInlining(target, &arguments, instr); |
| 305 } | 386 } |
| 306 } | 387 } |
| 307 | 388 |
| 308 FlowGraph* caller_graph_; | 389 FlowGraph* caller_graph_; |
| 309 intptr_t next_ssa_temp_index_; | 390 intptr_t next_ssa_temp_index_; |
| 310 bool inlined_; | 391 bool inlined_; |
| 311 intptr_t initial_size_; | 392 intptr_t initial_size_; |
| 312 intptr_t inlined_size_; | 393 intptr_t inlined_size_; |
| 394 intptr_t inlining_depth_; | |
| 395 CallSites* collected_call_sites_; | |
| 396 CallSites* inlining_call_sites_; | |
| 313 | 397 |
| 314 GrowableArray<StaticCallInstr*> static_calls_; | 398 DISALLOW_COPY_AND_ASSIGN(CallSiteInliner); |
| 315 GrowableArray<ClosureCallInstr*> closure_calls_; | |
| 316 GrowableArray<PolymorphicInstanceCallInstr*> instance_calls_; | |
| 317 }; | 399 }; |
| 318 | 400 |
| 319 | 401 |
| 320 void FlowGraphInliner::Inline() { | 402 void FlowGraphInliner::Inline() { |
| 321 if ((FLAG_inlining_filter != NULL) && | 403 if ((FLAG_inlining_filter != NULL) && |
| 322 (strstr(flow_graph_-> | 404 (strstr(flow_graph_-> |
| 323 parsed_function().function().ToFullyQualifiedCString(), | 405 parsed_function().function().ToFullyQualifiedCString(), |
| 324 FLAG_inlining_filter) == NULL)) { | 406 FLAG_inlining_filter) == NULL)) { |
| 325 return; | 407 return; |
| 326 } | 408 } |
| 327 | 409 |
| 328 TRACE_INLINING(OS::Print( | 410 TRACE_INLINING(OS::Print( |
| 329 "Inlining calls in %s\n", | 411 "Inlining calls in %s\n", |
| 330 flow_graph_->parsed_function().function().ToCString())); | 412 flow_graph_->parsed_function().function().ToCString())); |
| 331 | 413 |
| 332 if (FLAG_trace_inlining && FLAG_print_flow_graph) { | 414 if (FLAG_trace_inlining && FLAG_print_flow_graph) { |
| 333 OS::Print("Before Inlining of %s\n", flow_graph_-> | 415 OS::Print("Before Inlining of %s\n", flow_graph_-> |
| 334 parsed_function().function().ToFullyQualifiedCString()); | 416 parsed_function().function().ToFullyQualifiedCString()); |
| 335 FlowGraphPrinter printer(*flow_graph_); | 417 FlowGraphPrinter printer(*flow_graph_); |
| 336 printer.PrintBlocks(); | 418 printer.PrintBlocks(); |
| 337 } | 419 } |
| 338 | 420 |
| 339 CallSiteInliner inliner(flow_graph_); | 421 CallSiteInliner inliner(flow_graph_); |
| 340 inliner.FindCallSites(); | |
| 341 inliner.InlineCalls(); | 422 inliner.InlineCalls(); |
| 342 | 423 |
| 343 if (inliner.inlined()) { | 424 if (inliner.inlined()) { |
| 344 if (FLAG_trace_inlining) { | 425 if (FLAG_trace_inlining) { |
| 345 OS::Print("Inlining growth factor: %f\n", inliner.GrowthFactor()); | 426 OS::Print("Inlining growth factor: %f\n", inliner.GrowthFactor()); |
| 346 if (FLAG_print_flow_graph) { | 427 if (FLAG_print_flow_graph) { |
| 347 OS::Print("After Inlining of %s\n", flow_graph_-> | 428 OS::Print("After Inlining of %s\n", flow_graph_-> |
| 348 parsed_function().function().ToFullyQualifiedCString()); | 429 parsed_function().function().ToFullyQualifiedCString()); |
| 349 FlowGraphPrinter printer(*flow_graph_); | 430 FlowGraphPrinter printer(*flow_graph_); |
| 350 printer.PrintBlocks(); | 431 printer.PrintBlocks(); |
| 351 } | 432 } |
| 352 } | 433 } |
| 353 } | 434 } |
| 354 } | 435 } |
| 355 | 436 |
| 356 } // namespace dart | 437 } // namespace dart |
| OLD | NEW |