Chromium Code Reviews| Index: src/hydrogen-instructions.cc |
| diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
| index edbffc2e241e5de193c6a8c960ed5d0978b33f13..f60be74db1a785d4b690505c9cd706fd4ab9e48e 100644 |
| --- a/src/hydrogen-instructions.cc |
| +++ b/src/hydrogen-instructions.cc |
| @@ -685,7 +685,7 @@ void HValue::Kill() { |
| HValue* operand = OperandAt(i); |
| if (operand == NULL) continue; |
| HUseListNode* first = operand->use_list_; |
| - if (first != NULL && first->value() == this && first->index() == i) { |
| + if (first != NULL && first->value()->CheckFlag(kIsDead)) { |
| operand->use_list_ = first->tail(); |
| } |
| } |
| @@ -1980,20 +1980,27 @@ void HPhi::AddIndirectUsesTo(int* dest) { |
| } |
| -void HSimulate::MergeInto(HSimulate* other) { |
| - for (int i = 0; i < values_.length(); ++i) { |
| - HValue* value = values_[i]; |
| - if (HasAssignedIndexAt(i)) { |
| - other->AddAssignedValue(GetAssignedIndexAt(i), value); |
| - } else { |
| - if (other->pop_count_ > 0) { |
| - other->pop_count_--; |
| +void HSimulate::MergeWith(ZoneList<HSimulate*>* list) { |
| + if (list->is_empty()) return; |
| + for (int j = list->length() - 1; j >= 0; --j) { |
| + HSimulate* from = list->at(j); |
| + ZoneList<HValue*>* from_values = &from->values_; |
| + for (int i = 0; i < from_values->length(); ++i) { |
| + if (from->HasAssignedIndexAt(i)) { |
| + AddAssignedValue(from->GetAssignedIndexAt(i), |
| + from_values->at(i)); |
| } else { |
| - other->AddPushedValue(value); |
| + if (pop_count_ > 0) { |
| + pop_count_--; |
| + } else { |
| + AddPushedValue(from_values->at(i)); |
| + } |
| } |
| } |
| + pop_count_ += from->pop_count_; |
| + list->at(j)->DeleteAndReplaceWith(NULL); |
|
Jakob Kummerow
2013/04/04 17:12:22
nit: s/list->at(j)/from/
|
| } |
| - other->pop_count_ += pop_count(); |
| + list->Clear(); |
| } |