| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/flags.h" | 7 #include "vm/flags.h" |
| 8 #include "vm/flow_graph.h" | 8 #include "vm/flow_graph.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/il_printer.h" | 10 #include "vm/il_printer.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // TODO(zerny): If result is more than size threshold then abort. | 96 // TODO(zerny): If result is more than size threshold then abort. |
| 97 | 97 |
| 98 // TODO(zerny): If effort is less than threshold then inline recursively. | 98 // TODO(zerny): If effort is less than threshold then inline recursively. |
| 99 | 99 |
| 100 // Plug result in the caller graph. | 100 // Plug result in the caller graph. |
| 101 caller_graph_->InlineCall(call, callee_graph); | 101 caller_graph_->InlineCall(call, callee_graph); |
| 102 next_ssa_temp_index_ = caller_graph_->max_virtual_register_number(); | 102 next_ssa_temp_index_ = caller_graph_->max_virtual_register_number(); |
| 103 | 103 |
| 104 // Replace all the formal parameters with the actuals. | 104 // Replace all the formal parameters with the actuals. |
| 105 for (intptr_t i = 0; i < arguments->length(); ++i) { | 105 for (intptr_t i = 0; i < arguments->length(); ++i) { |
| 106 Value* val = callee_graph->graph_entry()->start_env()->values()[i]; | 106 Value* val = callee_graph->graph_entry()->start_env()->ValueAt(i); |
| 107 ParameterInstr* param = val->definition()->AsParameter(); | 107 ParameterInstr* param = val->definition()->AsParameter(); |
| 108 ASSERT(param != NULL); | 108 ASSERT(param != NULL); |
| 109 param->ReplaceUsesWith((*arguments)[i]->definition()); | 109 param->ReplaceUsesWith((*arguments)[i]->definition()); |
| 110 } | 110 } |
| 111 | 111 |
| 112 if (FLAG_trace_inlining) { | 112 if (FLAG_trace_inlining) { |
| 113 OS::Print("Inlined %s\n", function.ToFullyQualifiedCString()); | 113 OS::Print("Inlined %s\n", function.ToFullyQualifiedCString()); |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Build succeeded so we restore the bailout jump. | 116 // Build succeeded so we restore the bailout jump. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 if (FLAG_trace_inlining && FLAG_print_flow_graph) { | 171 if (FLAG_trace_inlining && FLAG_print_flow_graph) { |
| 172 OS::Print("After Inlining of %s\n", flow_graph_-> | 172 OS::Print("After Inlining of %s\n", flow_graph_-> |
| 173 parsed_function().function().ToFullyQualifiedCString()); | 173 parsed_function().function().ToFullyQualifiedCString()); |
| 174 FlowGraphPrinter printer(*flow_graph_); | 174 FlowGraphPrinter printer(*flow_graph_); |
| 175 printer.PrintBlocks(); | 175 printer.PrintBlocks(); |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace dart | 180 } // namespace dart |
| OLD | NEW |