| 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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 | 668 |
| 669 // For closure calls: Store context value. | 669 // For closure calls: Store context value. |
| 670 FlowGraph* callee_graph = call_data->callee_graph; | 670 FlowGraph* callee_graph = call_data->callee_graph; |
| 671 TargetEntryInstr* callee_entry = | 671 TargetEntryInstr* callee_entry = |
| 672 callee_graph->graph_entry()->normal_entry(); | 672 callee_graph->graph_entry()->normal_entry(); |
| 673 ClosureCallInstr* closure_call = call_data->call->AsClosureCall(); | 673 ClosureCallInstr* closure_call = call_data->call->AsClosureCall(); |
| 674 if (closure_call != NULL) { | 674 if (closure_call != NULL) { |
| 675 // TODO(fschneider): Avoid setting the context, if not needed. | 675 // TODO(fschneider): Avoid setting the context, if not needed. |
| 676 Definition* closure = | 676 Definition* closure = |
| 677 closure_call->PushArgumentAt(0)->value()->definition(); | 677 closure_call->PushArgumentAt(0)->value()->definition(); |
| 678 LoadFieldInstr* context = | |
| 679 new LoadFieldInstr(new Value(closure), | |
| 680 Closure::context_offset(), | |
| 681 Type::ZoneHandle()); | |
| 682 AllocateObjectInstr* alloc = | 678 AllocateObjectInstr* alloc = |
| 683 closure_call->ArgumentAt(0)->AsAllocateObject(); | 679 closure_call->ArgumentAt(0)->AsAllocateObject(); |
| 680 Definition* context = NULL; |
| 684 if ((alloc != NULL) && !alloc->closure_function().IsNull()) { | 681 if ((alloc != NULL) && !alloc->closure_function().IsNull()) { |
| 685 ASSERT(!alloc->context_field().IsNull()); | 682 ASSERT(!alloc->context_field().IsNull()); |
| 686 context->set_field(&alloc->context_field()); | 683 context = new LoadFieldInstr(new Value(closure), |
| 684 &alloc->context_field(), |
| 685 Type::ZoneHandle()); |
| 686 } else { |
| 687 context = new LoadFieldInstr(new Value(closure), |
| 688 Closure::context_offset(), |
| 689 Type::ZoneHandle()); |
| 687 } | 690 } |
| 688 | 691 |
| 689 context->set_ssa_temp_index(caller_graph()->alloc_ssa_temp_index()); | 692 context->set_ssa_temp_index(caller_graph()->alloc_ssa_temp_index()); |
| 690 context->InsertAfter(callee_entry); | 693 context->InsertAfter(callee_entry); |
| 691 StoreContextInstr* set_context = | 694 StoreContextInstr* set_context = |
| 692 new StoreContextInstr(new Value(context)); | 695 new StoreContextInstr(new Value(context)); |
| 693 set_context->InsertAfter(context); | 696 set_context->InsertAfter(context); |
| 694 } | 697 } |
| 695 | 698 |
| 696 // Plug result in the caller graph. | 699 // Plug result in the caller graph. |
| (...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1496 OS::Print("After Inlining of %s\n", flow_graph_-> | 1499 OS::Print("After Inlining of %s\n", flow_graph_-> |
| 1497 parsed_function().function().ToFullyQualifiedCString()); | 1500 parsed_function().function().ToFullyQualifiedCString()); |
| 1498 FlowGraphPrinter printer(*flow_graph_); | 1501 FlowGraphPrinter printer(*flow_graph_); |
| 1499 printer.PrintBlocks(); | 1502 printer.PrintBlocks(); |
| 1500 } | 1503 } |
| 1501 } | 1504 } |
| 1502 } | 1505 } |
| 1503 } | 1506 } |
| 1504 | 1507 |
| 1505 } // namespace dart | 1508 } // namespace dart |
| OLD | NEW |