Chromium Code Reviews| 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/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 275 use->set_use_index(pred_index); | 275 use->set_use_index(pred_index); |
| 276 use->AddToInputUseList(); | 276 use->AddToInputUseList(); |
| 277 } | 277 } |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 } | 280 } |
| 281 | 281 |
| 282 | 282 |
| 283 void FlowGraph::ComputeUseLists() { | 283 void FlowGraph::ComputeUseLists() { |
| 284 DEBUG_ASSERT(ResetUseLists()); | 284 DEBUG_ASSERT(ResetUseLists()); |
| 285 // Clear global constants. | |
| 286 ClearUseLists(graph_entry_->constant_null()); | |
| 287 // Clear definitions in the start environment. | |
| 288 for (intptr_t i = 0; i < graph_entry_->start_env()->values().length(); ++i) { | |
|
srdjan
2012/08/30 18:32:02
You could cache graph_entry_->start_env()->values
| |
| 289 ClearUseLists(graph_entry_->start_env()->values()[i]->definition()); | |
| 290 } | |
| 285 ComputeUseListsRecursive(graph_entry_); | 291 ComputeUseListsRecursive(graph_entry_); |
| 286 DEBUG_ASSERT(ValidateUseLists()); | 292 DEBUG_ASSERT(ValidateUseLists()); |
| 287 } | 293 } |
| 288 | 294 |
| 289 | 295 |
| 290 void FlowGraph::ComputeSSA(intptr_t next_virtual_register_number) { | 296 void FlowGraph::ComputeSSA(intptr_t next_virtual_register_number) { |
| 291 current_ssa_temp_index_ = next_virtual_register_number; | 297 current_ssa_temp_index_ = next_virtual_register_number; |
| 292 GrowableArray<BitVector*> dominance_frontier; | 298 GrowableArray<BitVector*> dominance_frontier; |
| 293 ComputeDominators(&preorder_, &parent_, &dominance_frontier); | 299 ComputeDominators(&preorder_, &parent_, &dominance_frontier); |
| 294 InsertPhis(preorder_, assigned_vars_, dominance_frontier); | 300 InsertPhis(preorder_, assigned_vars_, dominance_frontier); |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 733 // Remove original arguments to the call. | 739 // Remove original arguments to the call. |
| 734 for (intptr_t i = 0; i < caller_comp->ArgumentCount(); ++i) { | 740 for (intptr_t i = 0; i < caller_comp->ArgumentCount(); ++i) { |
| 735 PushArgumentInstr* push = caller_comp->ArgumentAt(i); | 741 PushArgumentInstr* push = caller_comp->ArgumentAt(i); |
| 736 push->ReplaceUsesWith(push->value()->definition()); | 742 push->ReplaceUsesWith(push->value()->definition()); |
| 737 push->RemoveFromGraph(); | 743 push->RemoveFromGraph(); |
| 738 } | 744 } |
| 739 } | 745 } |
| 740 | 746 |
| 741 | 747 |
| 742 } // namespace dart | 748 } // namespace dart |
| OLD | NEW |