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/block_scheduler.h" | 7 #include "vm/block_scheduler.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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 block_it.Advance()) { | 295 block_it.Advance()) { |
| 296 for (ForwardInstructionIterator it(block_it.Current()); | 296 for (ForwardInstructionIterator it(block_it.Current()); |
| 297 !it.Done(); | 297 !it.Done(); |
| 298 it.Advance()) { | 298 it.Advance()) { |
| 299 Instruction* current = it.Current(); | 299 Instruction* current = it.Current(); |
| 300 if (current->IsPolymorphicInstanceCall()) { | 300 if (current->IsPolymorphicInstanceCall()) { |
| 301 PolymorphicInstanceCallInstr* instance_call = | 301 PolymorphicInstanceCallInstr* instance_call = |
| 302 current->AsPolymorphicInstanceCall(); | 302 current->AsPolymorphicInstanceCall(); |
| 303 if (!inline_only_recognized_methods || | 303 if (!inline_only_recognized_methods || |
| 304 instance_call->HasSingleRecognizedTarget() || | 304 instance_call->HasSingleRecognizedTarget() || |
| 305 instance_call->HasSingleDispatcherTarget()) { | 305 instance_call->HasOnlyDispatcherTargets()) { |
|
Ivan Posva
2014/04/11 21:12:01
This is not correct. Only checking for dispatcher
Florian Schneider
2014/04/22 00:09:10
Permissive for what?
Ivan Posva
2014/04/24 07:28:47
There is not necessarily only a single recognized
Florian Schneider
2014/04/24 12:00:44
There is no correctness requirement that the call
| |
| 306 instance_calls_.Add(InstanceCallInfo(instance_call, graph)); | 306 instance_calls_.Add(InstanceCallInfo(instance_call, graph)); |
| 307 } else { | 307 } else { |
| 308 // Method not inlined because inlining too deep and method | 308 // Method not inlined because inlining too deep and method |
| 309 // not recognized. | 309 // not recognized. |
| 310 if (FLAG_print_inlining_tree) { | 310 if (FLAG_print_inlining_tree) { |
| 311 const Function* caller = &graph->parsed_function().function(); | 311 const Function* caller = &graph->parsed_function().function(); |
| 312 const Function* target = | 312 const Function* target = |
| 313 &Function::ZoneHandle( | 313 &Function::ZoneHandle( |
| 314 instance_call->ic_data().GetTargetAt(0)); | 314 instance_call->ic_data().GetTargetAt(0)); |
| 315 inlined_info->Add(InlinedInfo( | 315 inlined_info->Add(InlinedInfo( |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 954 const GrowableArray<CallSites::ClosureCallInfo>& call_info = | 954 const GrowableArray<CallSites::ClosureCallInfo>& call_info = |
| 955 inlining_call_sites_->closure_calls(); | 955 inlining_call_sites_->closure_calls(); |
| 956 TRACE_INLINING(OS::Print(" Closure Calls (%" Pd ")\n", | 956 TRACE_INLINING(OS::Print(" Closure Calls (%" Pd ")\n", |
| 957 call_info.length())); | 957 call_info.length())); |
| 958 for (intptr_t call_idx = 0; call_idx < call_info.length(); ++call_idx) { | 958 for (intptr_t call_idx = 0; call_idx < call_info.length(); ++call_idx) { |
| 959 ClosureCallInstr* call = call_info[call_idx].call; | 959 ClosureCallInstr* call = call_info[call_idx].call; |
| 960 // Find the closure of the callee. | 960 // Find the closure of the callee. |
| 961 ASSERT(call->ArgumentCount() > 0); | 961 ASSERT(call->ArgumentCount() > 0); |
| 962 Function& target = Function::ZoneHandle(); | 962 Function& target = Function::ZoneHandle(); |
| 963 AllocateObjectInstr* alloc = | 963 AllocateObjectInstr* alloc = |
| 964 call->ArgumentAt(0)->AsAllocateObject(); | 964 call->ArgumentAt(0)->OriginalDefinition()->AsAllocateObject(); |
| 965 if ((alloc != NULL) && !alloc->closure_function().IsNull()) { | 965 if ((alloc != NULL) && !alloc->closure_function().IsNull()) { |
| 966 target ^= alloc->closure_function().raw(); | 966 target ^= alloc->closure_function().raw(); |
| 967 ASSERT(target.signature_class() == alloc->cls().raw()); | 967 ASSERT(target.signature_class() == alloc->cls().raw()); |
| 968 } | 968 } |
| 969 if (target.IsNull()) { | 969 if (target.IsNull()) { |
| 970 TRACE_INLINING(OS::Print(" Bailout: non-closure operator\n")); | 970 TRACE_INLINING(OS::Print(" Bailout: non-closure operator\n")); |
| 971 continue; | 971 continue; |
| 972 } | 972 } |
| 973 GrowableArray<Value*> arguments(call->ArgumentCount()); | 973 GrowableArray<Value*> arguments(call->ArgumentCount()); |
| 974 for (int i = 0; i < call->ArgumentCount(); ++i) { | 974 for (int i = 0; i < call->ArgumentCount(); ++i) { |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1658 OS::Print("After Inlining of %s\n", flow_graph_-> | 1658 OS::Print("After Inlining of %s\n", flow_graph_-> |
| 1659 parsed_function().function().ToFullyQualifiedCString()); | 1659 parsed_function().function().ToFullyQualifiedCString()); |
| 1660 FlowGraphPrinter printer(*flow_graph_); | 1660 FlowGraphPrinter printer(*flow_graph_); |
| 1661 printer.PrintBlocks(); | 1661 printer.PrintBlocks(); |
| 1662 } | 1662 } |
| 1663 } | 1663 } |
| 1664 } | 1664 } |
| 1665 } | 1665 } |
| 1666 | 1666 |
| 1667 } // namespace dart | 1667 } // namespace dart |
| OLD | NEW |