Chromium Code Reviews| Index: src/hydrogen-gvn.cc |
| diff --git a/src/hydrogen-gvn.cc b/src/hydrogen-gvn.cc |
| index fd7430ccec2da774b8e97a5968840e94fcacf905..c07f286210876541bacc0cc3f440c35f367e241a 100644 |
| --- a/src/hydrogen-gvn.cc |
| +++ b/src/hydrogen-gvn.cc |
| @@ -776,11 +776,27 @@ 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()) { |
|
Michael Starzinger
2013/07/08 12:44:06
Switching to the HInstructionIterator will break f
Hannes Payer (out of office)
2013/07/08 13:43:48
Done.
|
| + 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); |
| + } |
| + } |
| + } |
| GVNFlagSet flags = instr->ChangesFlags(); |
| - if (!flags.IsEmpty()) { |
| + if (instr->IsLinked() && !flags.IsEmpty()) { |
|
Michael Starzinger
2013/07/08 12:44:06
Instead of doing the IsLinked() checks here, could
Hannes Payer (out of office)
2013/07/08 13:43:48
Done.
|
| // Clear all instructions in the map that are affected by side effects. |
| // Store instruction as the dominating one for tracked side effects. |
| map->Kill(flags); |
| @@ -788,7 +804,7 @@ void HGlobalValueNumberingPhase::AnalyzeGraph() { |
| TRACE_GVN_2("Instruction %d %s\n", instr->id(), |
| *GetGVNFlagsString(flags)); |
| } |
| - if (instr->CheckFlag(HValue::kUseGVN)) { |
| + if (instr->IsLinked() && instr->CheckFlag(HValue::kUseGVN)) { |
|
Michael Starzinger
2013/07/08 12:44:06
Likewise.
Hannes Payer (out of office)
2013/07/08 13:43:48
Done.
|
| ASSERT(!instr->HasObservableSideEffects()); |
| HValue* other = map->Lookup(instr); |
| if (other != NULL) { |
| @@ -804,25 +820,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; |