Index: src/compiler/simplified-operator-reducer.cc |
diff --git a/src/compiler/simplified-operator-reducer.cc b/src/compiler/simplified-operator-reducer.cc |
index acd0f66ef65bf69b463853d398a7621bedf30227..120d7926d541bbc5feab7f5627d5aa8c1dbc7540 100644 |
--- a/src/compiler/simplified-operator-reducer.cc |
+++ b/src/compiler/simplified-operator-reducer.cc |
@@ -89,6 +89,8 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) { |
if (m.HasValue()) return ReplaceNumber(FastUI2D(m.Value())); |
break; |
} |
+ case IrOpcode::kReferenceEqual: |
+ return ReduceReferenceEqual(node); |
default: |
break; |
} |
@@ -96,6 +98,23 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) { |
} |
+Reduction SimplifiedOperatorReducer::ReduceReferenceEqual(Node* node) { |
+ DCHECK_EQ(IrOpcode::kReferenceEqual, node->opcode()); |
+ Node* const left = NodeProperties::GetValueInput(node, 0); |
+ Node* const right = NodeProperties::GetValueInput(node, 1); |
+ HeapObjectMatcher match_left(left); |
+ HeapObjectMatcher match_right(right); |
+ if (match_left.HasValue() && match_right.HasValue()) { |
+ if (match_left.Value().is_identical_to(match_right.Value())) { |
+ return Replace(jsgraph()->TrueConstant()); |
+ } else { |
+ return Replace(jsgraph()->FalseConstant()); |
+ } |
+ } |
+ return NoChange(); |
+} |
+ |
+ |
Reduction SimplifiedOperatorReducer::Change(Node* node, const Operator* op, |
Node* a) { |
DCHECK_EQ(node->InputCount(), OperatorProperties::GetTotalInputCount(op)); |