Index: src/hydrogen-check-elimination.cc |
diff --git a/src/hydrogen-check-elimination.cc b/src/hydrogen-check-elimination.cc |
index a7c45ac31cdd03a0aacc61a19419fd34cb8c9636..52a549299a24e7913a59aeb656e7e55c87c013fc 100644 |
--- a/src/hydrogen-check-elimination.cc |
+++ b/src/hydrogen-check-elimination.cc |
@@ -88,6 +88,10 @@ class HCheckTable : public ZoneObject { |
ReduceCompareMap(HCompareMap::cast(instr)); |
break; |
} |
+ case HValue::kCompareObjectEqAndBranch: { |
+ ReduceCompareObjectEqAndBranch(HCompareObjectEqAndBranch::cast(instr)); |
+ break; |
+ } |
case HValue::kTransitionElementsKind: { |
ReduceTransitionElementsKind( |
HTransitionElementsKind::cast(instr)); |
@@ -479,6 +483,23 @@ class HCheckTable : public ZoneObject { |
instr->block()->MarkSuccEdgeUnreachable(unreachable_succ); |
} |
+ void ReduceCompareObjectEqAndBranch(HCompareObjectEqAndBranch* instr) { |
+ MapSet maps_left = FindMaps(instr->left()->ActualValue()); |
+ if (maps_left == NULL) return; |
+ MapSet maps_right = FindMaps(instr->right()->ActualValue()); |
+ if (maps_right == NULL) return; |
+ MapSet intersection = maps_left->Intersect(maps_right, phase_->zone()); |
+ if (intersection->size() > 0) return; |
+ |
+ TRACE(("Marking redundant CompareObjectEqAndBranch #%d at B%d as false\n", |
+ instr->id(), instr->block()->block_id())); |
+ int succ = 1; |
+ instr->set_known_successor_index(succ); |
+ |
+ int unreachable_succ = 1 - succ; |
+ instr->block()->MarkSuccEdgeUnreachable(unreachable_succ); |
+ } |
+ |
void ReduceTransitionElementsKind(HTransitionElementsKind* instr) { |
MapSet maps = FindMaps(instr->object()->ActualValue()); |
// Can only learn more about an object that already has a known set of maps. |