Optimizing: Tag more arena allocations.
Replace GrowableArray with ArenaVector and tag arena
allocations with new allocation types.
As part of this, make the register allocator a bit more
efficient, doing bulk insert/erase. Some loops are now
O(n) instead of O(n^2).
Change-Id: Ifac0871ffb34b121cc0447801a2d07eefd308c14
diff --git a/compiler/optimizing/ssa_phi_elimination.cc b/compiler/optimizing/ssa_phi_elimination.cc
index a9f04cd..72f9ddd 100644
--- a/compiler/optimizing/ssa_phi_elimination.cc
+++ b/compiler/optimizing/ssa_phi_elimination.cc
@@ -35,7 +35,7 @@
HUseListNode<HInstruction*>* current = use_it.Current();
HInstruction* user = current->GetUser();
if (!user->IsPhi()) {
- worklist_.Add(phi);
+ worklist_.push_back(phi);
phi->SetLive();
break;
}
@@ -44,12 +44,13 @@
}
// Process the worklist by propagating liveness to phi inputs.
- while (!worklist_.IsEmpty()) {
- HPhi* phi = worklist_.Pop();
+ while (!worklist_.empty()) {
+ HPhi* phi = worklist_.back();
+ worklist_.pop_back();
for (HInputIterator it(phi); !it.Done(); it.Advance()) {
HInstruction* input = it.Current();
if (input->IsPhi() && input->AsPhi()->IsDead()) {
- worklist_.Add(input->AsPhi());
+ worklist_.push_back(input->AsPhi());
input->AsPhi()->SetLive();
}
}
@@ -103,12 +104,13 @@
for (HReversePostOrderIterator it(*graph_); !it.Done(); it.Advance()) {
HBasicBlock* block = it.Current();
for (HInstructionIterator inst_it(block->GetPhis()); !inst_it.Done(); inst_it.Advance()) {
- worklist_.Add(inst_it.Current()->AsPhi());
+ worklist_.push_back(inst_it.Current()->AsPhi());
}
}
- while (!worklist_.IsEmpty()) {
- HPhi* phi = worklist_.Pop();
+ while (!worklist_.empty()) {
+ HPhi* phi = worklist_.back();
+ worklist_.pop_back();
// If the phi has already been processed, continue.
if (!phi->IsInBlock()) {
@@ -155,7 +157,7 @@
HUseListNode<HInstruction*>* current = it.Current();
HInstruction* user = current->GetUser();
if (user->IsPhi()) {
- worklist_.Add(user->AsPhi());
+ worklist_.push_back(user->AsPhi());
}
}