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 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 | 800 |
801 void InlineClosureCalls() { | 801 void InlineClosureCalls() { |
802 const GrowableArray<ClosureCallInstr*>& calls = | 802 const GrowableArray<ClosureCallInstr*>& calls = |
803 inlining_call_sites_->closure_calls(); | 803 inlining_call_sites_->closure_calls(); |
804 TRACE_INLINING(OS::Print(" Closure Calls (%" Pd ")\n", calls.length())); | 804 TRACE_INLINING(OS::Print(" Closure Calls (%" Pd ")\n", calls.length())); |
805 for (intptr_t i = 0; i < calls.length(); ++i) { | 805 for (intptr_t i = 0; i < calls.length(); ++i) { |
806 ClosureCallInstr* call = calls[i]; | 806 ClosureCallInstr* call = calls[i]; |
807 // Find the closure of the callee. | 807 // Find the closure of the callee. |
808 ASSERT(call->ArgumentCount() > 0); | 808 ASSERT(call->ArgumentCount() > 0); |
809 Function& target = Function::ZoneHandle(); | 809 Function& target = Function::ZoneHandle(); |
810 CreateClosureInstr* closure = | |
811 call->ArgumentAt(0)->AsCreateClosure(); | |
812 if (closure != NULL) { | |
813 target ^= closure->function().raw(); | |
814 } | |
815 AllocateObjectInstr* alloc = | 810 AllocateObjectInstr* alloc = |
816 call->ArgumentAt(0)->AsAllocateObject(); | 811 call->ArgumentAt(0)->AsAllocateObject(); |
817 if ((alloc != NULL) && !alloc->closure_function().IsNull()) { | 812 if ((alloc != NULL) && !alloc->closure_function().IsNull()) { |
818 target ^= alloc->closure_function().raw(); | 813 target ^= alloc->closure_function().raw(); |
819 ASSERT(target.signature_class() == alloc->cls().raw()); | 814 ASSERT(target.signature_class() == alloc->cls().raw()); |
820 } | 815 } |
821 if (target.IsNull()) { | 816 if (target.IsNull()) { |
822 TRACE_INLINING(OS::Print(" Bailout: non-closure operator\n")); | 817 TRACE_INLINING(OS::Print(" Bailout: non-closure operator\n")); |
823 continue; | 818 continue; |
824 } | 819 } |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1496 OS::Print("After Inlining of %s\n", flow_graph_-> | 1491 OS::Print("After Inlining of %s\n", flow_graph_-> |
1497 parsed_function().function().ToFullyQualifiedCString()); | 1492 parsed_function().function().ToFullyQualifiedCString()); |
1498 FlowGraphPrinter printer(*flow_graph_); | 1493 FlowGraphPrinter printer(*flow_graph_); |
1499 printer.PrintBlocks(); | 1494 printer.PrintBlocks(); |
1500 } | 1495 } |
1501 } | 1496 } |
1502 } | 1497 } |
1503 } | 1498 } |
1504 | 1499 |
1505 } // namespace dart | 1500 } // namespace dart |
OLD | NEW |