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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 replacement_defn->ssa_temp_index()); | 77 replacement_defn->ssa_temp_index()); |
78 } | 78 } |
79 } else if (FLAG_trace_optimization) { | 79 } else if (FLAG_trace_optimization) { |
80 if (current_defn == NULL) { | 80 if (current_defn == NULL) { |
81 THR_Print("Removing %s\n", current->DebugName()); | 81 THR_Print("Removing %s\n", current->DebugName()); |
82 } else { | 82 } else { |
83 ASSERT(!current_defn->HasUses()); | 83 ASSERT(!current_defn->HasUses()); |
84 THR_Print("Removing v%" Pd ".\n", current_defn->ssa_temp_index()); | 84 THR_Print("Removing v%" Pd ".\n", current_defn->ssa_temp_index()); |
85 } | 85 } |
86 } | 86 } |
87 if (current->ArgumentCount() != 0) { | |
88 // This is a call instruction. Must remove original push arguments. | |
89 for (intptr_t i = 0; i < current->ArgumentCount(); ++i) { | |
90 PushArgumentInstr* push = current->PushArgumentAt(i); | |
91 push->ReplaceUsesWith(push->value()->definition()); | |
92 push->RemoveFromGraph(); | |
93 } | |
94 } | |
95 iterator->RemoveCurrentFromGraph(); | 87 iterator->RemoveCurrentFromGraph(); |
96 } | 88 } |
97 | 89 |
98 | 90 |
99 void FlowGraph::AddToDeferredPrefixes( | 91 void FlowGraph::AddToDeferredPrefixes( |
100 ZoneGrowableArray<const LibraryPrefix*>* from) { | 92 ZoneGrowableArray<const LibraryPrefix*>* from) { |
101 ZoneGrowableArray<const LibraryPrefix*>* to = deferred_prefixes(); | 93 ZoneGrowableArray<const LibraryPrefix*>* to = deferred_prefixes(); |
102 for (intptr_t i = 0; i < from->length(); i++) { | 94 for (intptr_t i = 0; i < from->length(); i++) { |
103 const LibraryPrefix* prefix = (*from)[i]; | 95 const LibraryPrefix* prefix = (*from)[i]; |
104 for (intptr_t j = 0; j < to->length(); j++) { | 96 for (intptr_t j = 0; j < to->length(); j++) { |
(...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2318 ExtractNthOutputInstr* extract = | 2310 ExtractNthOutputInstr* extract = |
2319 new(Z) ExtractNthOutputInstr(new(Z) Value(instr), index, rep, cid); | 2311 new(Z) ExtractNthOutputInstr(new(Z) Value(instr), index, rep, cid); |
2320 instr->ReplaceUsesWith(extract); | 2312 instr->ReplaceUsesWith(extract); |
2321 InsertAfter(instr, extract, NULL, FlowGraph::kValue); | 2313 InsertAfter(instr, extract, NULL, FlowGraph::kValue); |
2322 } | 2314 } |
2323 | 2315 |
2324 | 2316 |
2325 | 2317 |
2326 | 2318 |
2327 } // namespace dart | 2319 } // namespace dart |
OLD | NEW |