diff options
author | 2017-10-26 17:10:19 -0700 | |
---|---|---|
committer | 2017-11-01 15:36:21 -0700 | |
commit | 2b2bef245d5b2c6faa2d6f36da14866b2d8f5e4f (patch) | |
tree | 7948ee1d32e211198a595bb7ed35558d22838da8 /compiler/optimizing/instruction_builder.cc | |
parent | f199f1d3a9816edf9282766a8874d894d7bf87c3 (diff) |
Refactor DexInstructionIterator
Add a way to get the dex PC for the "for each" use case.
Bug: 67104794
Test: test-art-host
Change-Id: I144c459c9a2a03ec8d56842280338d1f7ce1caf0
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r-- | compiler/optimizing/instruction_builder.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index 902985e4ee..0f0be20961 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -382,16 +382,18 @@ ArenaBitVector* HInstructionBuilder::FindNativeDebugInfoLocations() { dex_file_->DecodeDebugPositionInfo(&code_item_, Callback::Position, locations); // Instruction-specific tweaks. IterationRange<DexInstructionIterator> instructions = code_item_.Instructions(); - for (const Instruction& inst : instructions) { - switch (inst.Opcode()) { + for (DexInstructionIterator it = instructions.begin(); it != instructions.end(); ++it) { + switch (it->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(inst.GetDexPc(code_item_.insns_)); - const Instruction* next = inst.Next(); - if (DexInstructionIterator(next) != instructions.end()) { - locations->SetBit(next->GetDexPc(code_item_.insns_)); + locations->ClearBit(it.DexPc()); + DexInstructionIterator next = it; + ++next; + DCHECK(next != it); + if (next != instructions.end()) { + locations->SetBit(next.DexPc()); } break; } |