diff options
author | 2017-11-07 00:08:52 -0800 | |
---|---|---|
committer | 2017-11-07 13:15:41 -0800 | |
commit | 0021feb36ca7021e2c255e6eaf16b967180290c6 (patch) | |
tree | 43f1ce8f6d91630a831d03b51a465d57c2a47119 /compiler/optimizing/instruction_builder.cc | |
parent | 550c0aee52bf8981dfe1d22d3b661d61e80cc7ee (diff) |
Delete CodeItemIterator
Replace uses with DexInstructionIterator.
Bug: 63756964
Test: test-art-host-gtest
Change-Id: I28c839c372edcb60583867355d46b14f8752d41b
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r-- | compiler/optimizing/instruction_builder.cc | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index 0f0be20961..8e9b818722 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -321,19 +321,19 @@ bool HInstructionBuilder::Build() { quicken_index = block_builder_->GetQuickenIndex(block_dex_pc); } - for (CodeItemIterator it(code_item_, block_dex_pc); !it.Done(); it.Advance()) { + for (const DexInstructionPcPair& pair : code_item_.Instructions(block_dex_pc)) { if (current_block_ == nullptr) { // The previous instruction ended this block. break; } - uint32_t dex_pc = it.CurrentDexPc(); + const uint32_t dex_pc = pair.DexPc(); if (dex_pc != block_dex_pc && FindBlockStartingAt(dex_pc) != nullptr) { // This dex_pc starts a new basic block. break; } - if (current_block_->IsTryBlock() && IsThrowingDexInstruction(it.CurrentInstruction())) { + if (current_block_->IsTryBlock() && IsThrowingDexInstruction(pair.Inst())) { PropagateLocalsToCatchBlocks(); } @@ -341,11 +341,11 @@ bool HInstructionBuilder::Build() { AppendInstruction(new (allocator_) HNativeDebugInfo(dex_pc)); } - if (!ProcessDexInstruction(it.CurrentInstruction(), dex_pc, quicken_index)) { + if (!ProcessDexInstruction(pair.Inst(), dex_pc, quicken_index)) { return false; } - if (QuickenInfoTable::NeedsIndexForInstruction(&it.CurrentInstruction())) { + if (QuickenInfoTable::NeedsIndexForInstruction(&pair.Inst())) { ++quicken_index; } } @@ -382,16 +382,15 @@ ArenaBitVector* HInstructionBuilder::FindNativeDebugInfoLocations() { dex_file_->DecodeDebugPositionInfo(&code_item_, Callback::Position, locations); // Instruction-specific tweaks. IterationRange<DexInstructionIterator> instructions = code_item_.Instructions(); - for (DexInstructionIterator it = instructions.begin(); it != instructions.end(); ++it) { - switch (it->Opcode()) { + for (const DexInstructionPcPair& inst : instructions) { + switch (inst->Opcode()) { case Instruction::MOVE_EXCEPTION: { // Stop in native debugger after the exception has been moved. // The compiler also expects the move at the start of basic block so // we do not want to interfere by inserting native-debug-info before it. - locations->ClearBit(it.DexPc()); - DexInstructionIterator next = it; - ++next; - DCHECK(next != it); + locations->ClearBit(inst.DexPc()); + DexInstructionIterator next = std::next(DexInstructionIterator(inst)); + DCHECK(next.DexPc() != inst.DexPc()); if (next != instructions.end()) { locations->SetBit(next.DexPc()); } |