Index: src/compiler/typed-optimization.cc |
diff --git a/src/compiler/typed-optimization.cc b/src/compiler/typed-optimization.cc |
index 8149a1bee4492903d33cacaffe62ad098e633db9..e130a10e4eb8e196e9b153d7c52f5f0792b534b6 100644 |
--- a/src/compiler/typed-optimization.cc |
+++ b/src/compiler/typed-optimization.cc |
@@ -92,6 +92,8 @@ Reduction TypedOptimization::Reduce(Node* node) { |
return ReduceNumberToUint8Clamped(node); |
case IrOpcode::kPhi: |
return ReducePhi(node); |
+ case IrOpcode::kReferenceEqual: |
+ return ReduceReferenceEqual(node); |
case IrOpcode::kSelect: |
return ReduceSelect(node); |
default: |
@@ -258,6 +260,18 @@ Reduction TypedOptimization::ReducePhi(Node* node) { |
return NoChange(); |
} |
+Reduction TypedOptimization::ReduceReferenceEqual(Node* node) { |
+ DCHECK_EQ(IrOpcode::kReferenceEqual, node->opcode()); |
+ Node* const lhs = NodeProperties::GetValueInput(node, 0); |
+ Node* const rhs = NodeProperties::GetValueInput(node, 1); |
+ Type* const lhs_type = NodeProperties::GetType(lhs); |
+ Type* const rhs_type = NodeProperties::GetType(rhs); |
+ if (!lhs_type->Maybe(rhs_type)) { |
+ return Replace(jsgraph()->FalseConstant()); |
+ } |
+ return NoChange(); |
+} |
+ |
Reduction TypedOptimization::ReduceSelect(Node* node) { |
DCHECK_EQ(IrOpcode::kSelect, node->opcode()); |
Node* const condition = NodeProperties::GetValueInput(node, 0); |