From 91e11c0c840193c6822e66846020b6647de243d5 Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Wed, 2 Sep 2015 17:03:22 +0100 Subject: Optimizing: Tag basic block allocations with their source. Replace GrowableArray with ArenaVector in HBasicBlock and, to track the source of allocations, assign one new and two Quick's arena allocation types to these vectors. Rename kArenaAllocSuccessor to kArenaAllocSuccessors. Bug: 23736311 Change-Id: I984aef6e615ae2380a532f5c6726af21015f43f5 --- compiler/optimizing/ssa_builder.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'compiler/optimizing/ssa_builder.cc') diff --git a/compiler/optimizing/ssa_builder.cc b/compiler/optimizing/ssa_builder.cc index 561c3b4964..e6209b9583 100644 --- a/compiler/optimizing/ssa_builder.cc +++ b/compiler/optimizing/ssa_builder.cc @@ -241,8 +241,8 @@ void SsaBuilder::BuildSsa() { HBasicBlock* block = loop_headers_.Get(i); for (HInstructionIterator it(block->GetPhis()); !it.Done(); it.Advance()) { HPhi* phi = it.Current()->AsPhi(); - for (size_t pred = 0; pred < block->GetPredecessors().Size(); pred++) { - HInstruction* input = ValueOfLocal(block->GetPredecessors().Get(pred), phi->GetRegNumber()); + for (HBasicBlock* predecessor : block->GetPredecessors()) { + HInstruction* input = ValueOfLocal(predecessor, phi->GetRegNumber()); phi->AddInput(input); } } @@ -369,16 +369,16 @@ void SsaBuilder::VisitBasicBlock(HBasicBlock* block) { // Save the loop header so that the last phase of the analysis knows which // blocks need to be updated. loop_headers_.Add(block); - } else if (block->GetPredecessors().Size() > 0) { + } else if (block->GetPredecessors().size() > 0) { // All predecessors have already been visited because we are visiting in reverse post order. // We merge the values of all locals, creating phis if those values differ. for (size_t local = 0; local < current_locals_->Size(); local++) { bool one_predecessor_has_no_value = false; bool is_different = false; - HInstruction* value = ValueOfLocal(block->GetPredecessors().Get(0), local); + HInstruction* value = ValueOfLocal(block->GetPredecessor(0), local); - for (size_t i = 0, e = block->GetPredecessors().Size(); i < e; ++i) { - HInstruction* current = ValueOfLocal(block->GetPredecessors().Get(i), local); + for (HBasicBlock* predecessor : block->GetPredecessors()) { + HInstruction* current = ValueOfLocal(predecessor, local); if (current == nullptr) { one_predecessor_has_no_value = true; break; @@ -395,9 +395,9 @@ void SsaBuilder::VisitBasicBlock(HBasicBlock* block) { if (is_different) { HPhi* phi = new (GetGraph()->GetArena()) HPhi( - GetGraph()->GetArena(), local, block->GetPredecessors().Size(), Primitive::kPrimVoid); - for (size_t i = 0; i < block->GetPredecessors().Size(); i++) { - HInstruction* pred_value = ValueOfLocal(block->GetPredecessors().Get(i), local); + GetGraph()->GetArena(), local, block->GetPredecessors().size(), Primitive::kPrimVoid); + for (size_t i = 0; i < block->GetPredecessors().size(); i++) { + HInstruction* pred_value = ValueOfLocal(block->GetPredecessor(i), local); phi->SetRawInputAt(i, pred_value); } block->AddPhi(phi); -- cgit v1.2.3-59-g8ed1b