| 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.h" | 5 #include "vm/flow_graph.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 } else if (FLAG_trace_optimization) { | 77 } else if (FLAG_trace_optimization) { |
| 78 if (current_defn == NULL) { | 78 if (current_defn == NULL) { |
| 79 THR_Print("Removing %s\n", current->DebugName()); | 79 THR_Print("Removing %s\n", current->DebugName()); |
| 80 } else { | 80 } else { |
| 81 ASSERT(!current_defn->HasUses()); | 81 ASSERT(!current_defn->HasUses()); |
| 82 THR_Print("Removing v%" Pd ".\n", current_defn->ssa_temp_index()); | 82 THR_Print("Removing v%" Pd ".\n", current_defn->ssa_temp_index()); |
| 83 } | 83 } |
| 84 } | 84 } |
| 85 if (current->ArgumentCount() != 0) { | 85 if (current->ArgumentCount() != 0) { |
| 86 // This is a call instruction. Must remove original push arguments. | 86 // Replacing a call instruction with something else. Must remove |
| 87 // superfluous push arguments. |
| 87 for (intptr_t i = 0; i < current->ArgumentCount(); ++i) { | 88 for (intptr_t i = 0; i < current->ArgumentCount(); ++i) { |
| 88 PushArgumentInstr* push = current->PushArgumentAt(i); | 89 PushArgumentInstr* push = current->PushArgumentAt(i); |
| 89 push->ReplaceUsesWith(push->value()->definition()); | 90 if (replacement == NULL || i >= replacement->ArgumentCount() || |
| 90 push->RemoveFromGraph(); | 91 replacement->PushArgumentAt(i) != push) { |
| 92 push->ReplaceUsesWith(push->value()->definition()); |
| 93 push->RemoveFromGraph(); |
| 94 } |
| 91 } | 95 } |
| 92 } | 96 } |
| 93 iterator->RemoveCurrentFromGraph(); | 97 iterator->RemoveCurrentFromGraph(); |
| 94 } | 98 } |
| 95 | 99 |
| 96 | 100 |
| 97 void FlowGraph::AddToDeferredPrefixes( | 101 void FlowGraph::AddToDeferredPrefixes( |
| 98 ZoneGrowableArray<const LibraryPrefix*>* from) { | 102 ZoneGrowableArray<const LibraryPrefix*>* from) { |
| 99 ZoneGrowableArray<const LibraryPrefix*>* to = deferred_prefixes(); | 103 ZoneGrowableArray<const LibraryPrefix*>* to = deferred_prefixes(); |
| 100 for (intptr_t i = 0; i < from->length(); i++) { | 104 for (intptr_t i = 0; i < from->length(); i++) { |
| (...skipping 2128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2229 Representation rep, | 2233 Representation rep, |
| 2230 intptr_t cid) { | 2234 intptr_t cid) { |
| 2231 ExtractNthOutputInstr* extract = | 2235 ExtractNthOutputInstr* extract = |
| 2232 new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid); | 2236 new (Z) ExtractNthOutputInstr(new (Z) Value(instr), index, rep, cid); |
| 2233 instr->ReplaceUsesWith(extract); | 2237 instr->ReplaceUsesWith(extract); |
| 2234 InsertAfter(instr, extract, NULL, FlowGraph::kValue); | 2238 InsertAfter(instr, extract, NULL, FlowGraph::kValue); |
| 2235 } | 2239 } |
| 2236 | 2240 |
| 2237 | 2241 |
| 2238 } // namespace dart | 2242 } // namespace dart |
| OLD | NEW |