Chromium Code Reviews| Index: src/hydrogen-gvn.cc |
| diff --git a/src/hydrogen-gvn.cc b/src/hydrogen-gvn.cc |
| index fd7430ccec2da774b8e97a5968840e94fcacf905..d368508bca893c998fbff11e420f22f270552e6f 100644 |
| --- a/src/hydrogen-gvn.cc |
| +++ b/src/hydrogen-gvn.cc |
| @@ -776,9 +776,29 @@ void HGlobalValueNumberingPhase::AnalyzeGraph() { |
| } |
| // Go through all instructions of the current block. |
| - HInstruction* instr = block->first(); |
| - while (instr != NULL) { |
| - HInstruction* next = instr->next(); |
| + for (HInstructionIterator it(block); !it.Done(); it.Advance()) { |
| + HInstruction* instr = it.Current(); |
| + if (instr->CheckFlag(HValue::kTrackSideEffectDominators)) { |
| + for (int i = 0; i < kNumberOfTrackedSideEffects; i++) { |
| + HValue* other = dominators->at(i); |
| + GVNFlag changes_flag = HValue::ChangesFlagFromInt(i); |
| + GVNFlag depends_on_flag = HValue::DependsOnFlagFromInt(i); |
| + if (instr->DependsOnFlags().Contains(depends_on_flag) && |
| + (other != NULL)) { |
| + TRACE_GVN_5("Side-effect #%d in %d (%s) is dominated by %d (%s)\n", |
| + i, |
| + instr->id(), |
| + instr->Mnemonic(), |
| + other->id(), |
| + other->Mnemonic()); |
| + instr->HandleSideEffectDominator(changes_flag, other); |
| + } |
| + } |
| + } |
| + // Instruction was unlinked during graph traversal. |
| + if (!instr->IsLinked()) { |
| + continue; |
|
Michael Starzinger
2013/07/08 14:02:43
nit: The whole condition should fit into one line.
Hannes Payer (out of office)
2013/07/09 08:26:15
Done.
|
| + } |
| GVNFlagSet flags = instr->ChangesFlags(); |
| if (!flags.IsEmpty()) { |
| // Clear all instructions in the map that are affected by side effects. |
| @@ -804,25 +824,6 @@ void HGlobalValueNumberingPhase::AnalyzeGraph() { |
| map->Add(instr, zone()); |
| } |
| } |
| - if (instr->IsLinked() && |
| - instr->CheckFlag(HValue::kTrackSideEffectDominators)) { |
| - for (int i = 0; i < kNumberOfTrackedSideEffects; i++) { |
| - HValue* other = dominators->at(i); |
| - GVNFlag changes_flag = HValue::ChangesFlagFromInt(i); |
| - GVNFlag depends_on_flag = HValue::DependsOnFlagFromInt(i); |
| - if (instr->DependsOnFlags().Contains(depends_on_flag) && |
| - (other != NULL)) { |
| - TRACE_GVN_5("Side-effect #%d in %d (%s) is dominated by %d (%s)\n", |
| - i, |
| - instr->id(), |
| - instr->Mnemonic(), |
| - other->id(), |
| - other->Mnemonic()); |
| - instr->SetSideEffectDominator(changes_flag, other); |
| - } |
| - } |
| - } |
| - instr = next; |
| } |
| HBasicBlock* dominator_block; |