From fa6b93c4b69e6d7ddfa2a4ed0aff01b0608c5a3a Mon Sep 17 00:00:00 2001 From: Vladimir Marko Date: Tue, 15 Sep 2015 10:15:55 +0100 Subject: Optimizing: Tag arena allocations in HGraph. Replace GrowableArray with ArenaVector in HGraph and related classes HEnvironment, HLoopInformation, HInvoke and HPhi, and tag allocations with new arena allocation types. Change-Id: I3d79897af405b9a1a5b98bfc372e70fe0b3bc40d --- compiler/optimizing/builder.cc | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'compiler/optimizing/builder.cc') diff --git a/compiler/optimizing/builder.cc b/compiler/optimizing/builder.cc index 0a3f083e10..97545edb01 100644 --- a/compiler/optimizing/builder.cc +++ b/compiler/optimizing/builder.cc @@ -339,11 +339,10 @@ void HGraphBuilder::InsertTryBoundaryBlocks(const DexFile::CodeItem& code_item) // Bit vector stores information on which blocks contain throwing instructions. // Must be expandable because catch blocks may be split into two. - ArenaBitVector can_block_throw(arena_, graph_->GetBlocks().Size(), /* expandable */ true); + ArenaBitVector can_block_throw(arena_, graph_->GetBlocks().size(), /* expandable */ true); // Scan blocks and mark those which contain throwing instructions. - for (size_t block_id = 0, e = graph_->GetBlocks().Size(); block_id < e; ++block_id) { - HBasicBlock* block = graph_->GetBlocks().Get(block_id); + for (HBasicBlock* block : graph_->GetBlocks()) { bool can_throw = false; for (HInstructionIterator insn(block->GetInstructions()); !insn.Done(); insn.Advance()) { if (insn.Current()->CanThrow()) { @@ -381,9 +380,7 @@ void HGraphBuilder::InsertTryBoundaryBlocks(const DexFile::CodeItem& code_item) // (c) link the new blocks to corresponding exception handlers. // We cannot iterate only over blocks in `branch_targets_` because switch-case // blocks share the same dex_pc. - for (size_t block_id = 0, e = graph_->GetBlocks().Size(); block_id < e; ++block_id) { - HBasicBlock* try_block = graph_->GetBlocks().Get(block_id); - + for (HBasicBlock* try_block : graph_->GetBlocks()) { // TryBoundary blocks are added at the end of the list and not iterated over. DCHECK(!try_block->IsSingleTryBoundary()); @@ -465,7 +462,7 @@ void HGraphBuilder::InsertTryBoundaryBlocks(const DexFile::CodeItem& code_item) } bool HGraphBuilder::BuildGraph(const DexFile::CodeItem& code_item) { - DCHECK(graph_->GetBlocks().IsEmpty()); + DCHECK(graph_->GetBlocks().empty()); const uint16_t* code_ptr = code_item.insns_; const uint16_t* code_end = code_item.insns_ + code_item.insns_size_in_code_units_; -- cgit v1.2.3-59-g8ed1b