Chromium Code Reviews| Index: src/hydrogen-check-elimination.cc |
| diff --git a/src/hydrogen-check-elimination.cc b/src/hydrogen-check-elimination.cc |
| index bbd3042fb7af6659f4107fffb7127e1298000593..fb0583af533ed48b368f39c5c3302fb5ac9e3177 100644 |
| --- a/src/hydrogen-check-elimination.cc |
| +++ b/src/hydrogen-check-elimination.cc |
| @@ -101,6 +101,10 @@ class HCheckTable : public ZoneObject { |
| ReduceCheckHeapObject(HCheckHeapObject::cast(instr)); |
| break; |
| } |
| + case HValue::kCompareObjectEqAndBranch: { |
| + ReduceCompareObjectEqAndBranch(HCompareObjectEqAndBranch::cast(instr)); |
| + break; |
| + } |
| default: { |
| // If the instruction changes maps uncontrollably, drop everything. |
| if (instr->CheckGVNFlag(kChangesMaps) || |
| @@ -266,6 +270,30 @@ class HCheckTable : public ZoneObject { |
| } |
| } |
| + void ReduceCompareObjectEqAndBranch(HCompareObjectEqAndBranch* instr) { |
| + HValue* left = instr->left(); |
| + HValue* right = instr->right(); |
| + if (left->IsCheckMaps() && right->IsCheckMaps()) { |
| + // Check one operand is enough. After licm, remove the correct one. |
| + HCheckMaps* removed = NULL; |
| + if (left->block()->block_id() > right->block()->block_id()) { |
| + removed = HCheckMaps::cast(left); |
| + } else { |
| + removed = HCheckMaps::cast(right); |
| + } |
| + |
| + if (removed->previous()->IsCheckHeapObject()) { |
| + HCheckHeapObject* cho = HCheckHeapObject::cast(removed->previous()); |
| + if (cho->value() == removed->ActualValue()) { |
| + cho->DeleteAndReplaceWith(cho->value()); |
| + INC_STAT(removed_cho_); |
| + } |
| + } |
| + removed->DeleteAndReplaceWith(removed->ActualValue()); |
|
titzer
2013/12/04 16:32:00
This transformation is completely incorrect. First
|
| + INC_STAT(removed_); |
| + } |
| + } |
| + |
| void ReduceStoreNamedField(HStoreNamedField* instr) { |
| HValue* object = instr->object()->ActualValue(); |
| if (instr->has_transition()) { |