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