| 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_builder.h" | 5 #include "vm/flow_graph_builder.h" |
| 6 | 6 |
| 7 #include "vm/ast_printer.h" | 7 #include "vm/ast_printer.h" |
| 8 #include "vm/code_descriptors.h" | 8 #include "vm/code_descriptors.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Insert the callee graph into the caller graph. First sort the list of | 129 // Insert the callee graph into the caller graph. First sort the list of |
| 130 // exits by block id (recording block entries as a side effect). | 130 // exits by block id (recording block entries as a side effect). |
| 131 SortExits(); | 131 SortExits(); |
| 132 intptr_t num_exits = exits_.length(); | 132 intptr_t num_exits = exits_.length(); |
| 133 if (num_exits == 0) { | 133 if (num_exits == 0) { |
| 134 // TODO(zerny): Add support for non-local exits, such as throw. | 134 // TODO(zerny): Add support for non-local exits, such as throw. |
| 135 UNREACHABLE(); | 135 UNREACHABLE(); |
| 136 } else if (num_exits == 1) { | 136 } else if (num_exits == 1) { |
| 137 // For just one exit, replace the uses and remove the call from the graph. | 137 // For just one exit, replace the uses and remove the call from the graph. |
| 138 call->ReplaceUsesWith(ValueAt(0)->definition()); | 138 call->ReplaceUsesWith(ValueAt(0)->definition()); |
| 139 ValueAt(0)->RemoveFromUseList(); |
| 139 call->previous()->LinkTo(callee_entry->next()); | 140 call->previous()->LinkTo(callee_entry->next()); |
| 140 LastInstructionAt(0)->LinkTo(call->next()); | 141 LastInstructionAt(0)->LinkTo(call->next()); |
| 141 // In case of control flow, locally update the predecessors, phis and | 142 // In case of control flow, locally update the predecessors, phis and |
| 142 // dominator tree. | 143 // dominator tree. |
| 143 // TODO(zerny): should we leave the dominator tree since we recompute it | 144 // TODO(zerny): should we leave the dominator tree since we recompute it |
| 144 // after a full inlining pass? | 145 // after a full inlining pass? |
| 145 if (callee_graph->preorder().length() > 2) { | 146 if (callee_graph->preorder().length() > 2) { |
| 146 BlockEntryInstr* exit_block = ExitBlockAt(0); | 147 BlockEntryInstr* exit_block = ExitBlockAt(0); |
| 147 // Pictorially, the graph structure is: | 148 // Pictorially, the graph structure is: |
| 148 // | 149 // |
| (...skipping 3093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3242 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; | 3243 intptr_t len = OS::SNPrint(NULL, 0, kFormat, function_name, reason) + 1; |
| 3243 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3244 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3244 OS::SNPrint(chars, len, kFormat, function_name, reason); | 3245 OS::SNPrint(chars, len, kFormat, function_name, reason); |
| 3245 const Error& error = Error::Handle( | 3246 const Error& error = Error::Handle( |
| 3246 LanguageError::New(String::Handle(String::New(chars)))); | 3247 LanguageError::New(String::Handle(String::New(chars)))); |
| 3247 Isolate::Current()->long_jump_base()->Jump(1, error); | 3248 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 3248 } | 3249 } |
| 3249 | 3250 |
| 3250 | 3251 |
| 3251 } // namespace dart | 3252 } // namespace dart |
| OLD | NEW |