Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/compiler.h" | 7 #include "vm/compiler.h" |
| 8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
| 9 #include "vm/flow_graph.h" | 9 #include "vm/flow_graph.h" |
| 10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
| (...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 637 return parsed_function; | 637 return parsed_function; |
| 638 } | 638 } |
| 639 } | 639 } |
| 640 *in_cache = false; | 640 *in_cache = false; |
| 641 ParsedFunction* parsed_function = new ParsedFunction(function); | 641 ParsedFunction* parsed_function = new ParsedFunction(function); |
| 642 Parser::ParseFunction(parsed_function); | 642 Parser::ParseFunction(parsed_function); |
| 643 parsed_function->AllocateVariables(); | 643 parsed_function->AllocateVariables(); |
| 644 return parsed_function; | 644 return parsed_function; |
| 645 } | 645 } |
| 646 | 646 |
| 647 // Include special handling for List. factory: inlining it is not helpful | |
| 648 // if the incoming argument is a non-constant value. | |
| 649 // TODO(srdjan): Fix inlining of List. factory. | |
|
Ivan Posva
2013/02/28 23:22:31
Two spaces between of and List.
srdjan
2013/02/28 23:31:01
Done.
| |
| 647 void InlineStaticCalls() { | 650 void InlineStaticCalls() { |
| 648 const GrowableArray<StaticCallInstr*>& calls = | 651 const GrowableArray<StaticCallInstr*>& calls = |
| 649 inlining_call_sites_->static_calls(); | 652 inlining_call_sites_->static_calls(); |
| 650 TRACE_INLINING(OS::Print(" Static Calls (%d)\n", calls.length())); | 653 TRACE_INLINING(OS::Print(" Static Calls (%d)\n", calls.length())); |
| 651 for (intptr_t i = 0; i < calls.length(); ++i) { | 654 for (intptr_t i = 0; i < calls.length(); ++i) { |
| 652 StaticCallInstr* call = calls[i]; | 655 StaticCallInstr* call = calls[i]; |
| 656 if (call->function().name() == Symbols::ListFactory().raw()) { | |
| 657 // Inline only if no arguments or a constant was passed. | |
| 658 ASSERT(call->function().NumImplicitParameters() == 1); | |
| 659 ASSERT(call->ArgumentCount() <= 2); | |
| 660 // Arg 0: Instantiator type arguments. | |
| 661 // Arg 1: Length (optional). | |
| 662 if ((call->ArgumentCount() == 2) && | |
| 663 (!call->PushArgumentAt(1)->value()->BindsToConstant())) { | |
| 664 // Do not inline since a non-constant argument was passed. | |
| 665 continue; | |
| 666 } | |
| 667 } | |
| 653 GrowableArray<Value*> arguments(call->ArgumentCount()); | 668 GrowableArray<Value*> arguments(call->ArgumentCount()); |
| 654 for (int i = 0; i < call->ArgumentCount(); ++i) { | 669 for (int i = 0; i < call->ArgumentCount(); ++i) { |
| 655 arguments.Add(call->PushArgumentAt(i)->value()); | 670 arguments.Add(call->PushArgumentAt(i)->value()); |
| 656 } | 671 } |
| 657 TryInlining(call->function(), call->argument_names(), &arguments, call); | 672 TryInlining(call->function(), call->argument_names(), &arguments, call); |
| 658 } | 673 } |
| 659 } | 674 } |
| 660 | 675 |
| 661 void InlineClosureCalls() { | 676 void InlineClosureCalls() { |
| 662 const GrowableArray<ClosureCallInstr*>& calls = | 677 const GrowableArray<ClosureCallInstr*>& calls = |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 868 OS::Print("After Inlining of %s\n", flow_graph_-> | 883 OS::Print("After Inlining of %s\n", flow_graph_-> |
| 869 parsed_function().function().ToFullyQualifiedCString()); | 884 parsed_function().function().ToFullyQualifiedCString()); |
| 870 FlowGraphPrinter printer(*flow_graph_); | 885 FlowGraphPrinter printer(*flow_graph_); |
| 871 printer.PrintBlocks(); | 886 printer.PrintBlocks(); |
| 872 } | 887 } |
| 873 } | 888 } |
| 874 } | 889 } |
| 875 } | 890 } |
| 876 | 891 |
| 877 } // namespace dart | 892 } // namespace dart |
| OLD | NEW |