| 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 AllocateObjectInstr* alloc = | 678 Definition* context = new LoadFieldInstr(new Value(closure), |
| 679 closure_call->ArgumentAt(0)->AsAllocateObject(); | 679 Closure::context_offset(), |
| 680 Definition* context = NULL; | 680 Type::ZoneHandle()); |
| 681 if ((alloc != NULL) && !alloc->closure_function().IsNull()) { | |
| 682 ASSERT(!alloc->context_field().IsNull()); | |
| 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()); | |
| 690 } | |
| 691 | |
| 692 context->set_ssa_temp_index(caller_graph()->alloc_ssa_temp_index()); | 681 context->set_ssa_temp_index(caller_graph()->alloc_ssa_temp_index()); |
| 693 context->InsertAfter(callee_entry); | 682 context->InsertAfter(callee_entry); |
| 694 StoreContextInstr* set_context = | 683 StoreContextInstr* set_context = |
| 695 new StoreContextInstr(new Value(context)); | 684 new StoreContextInstr(new Value(context)); |
| 696 set_context->InsertAfter(context); | 685 set_context->InsertAfter(context); |
| 697 } | 686 } |
| 698 | 687 |
| 699 // Plug result in the caller graph. | 688 // Plug result in the caller graph. |
| 700 InlineExitCollector* exit_collector = call_data->exit_collector; | 689 InlineExitCollector* exit_collector = call_data->exit_collector; |
| 701 exit_collector->PrepareGraphs(callee_graph); | 690 exit_collector->PrepareGraphs(callee_graph); |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 OS::Print("After Inlining of %s\n", flow_graph_-> | 1483 OS::Print("After Inlining of %s\n", flow_graph_-> |
| 1495 parsed_function().function().ToFullyQualifiedCString()); | 1484 parsed_function().function().ToFullyQualifiedCString()); |
| 1496 FlowGraphPrinter printer(*flow_graph_); | 1485 FlowGraphPrinter printer(*flow_graph_); |
| 1497 printer.PrintBlocks(); | 1486 printer.PrintBlocks(); |
| 1498 } | 1487 } |
| 1499 } | 1488 } |
| 1500 } | 1489 } |
| 1501 } | 1490 } |
| 1502 | 1491 |
| 1503 } // namespace dart | 1492 } // namespace dart |
| OLD | NEW |