Index: src/compiler/simplified-lowering.cc |
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc |
index 282a87a57ce59b7c8fdcb00c6631e23f7751151a..6a6c26d4081e70d99cb08dcffb6cd5def960a121 100644 |
--- a/src/compiler/simplified-lowering.cc |
+++ b/src/compiler/simplified-lowering.cc |
@@ -2545,6 +2545,35 @@ class RepresentationSelector { |
VisitObjectIs(node, Type::DetectableCallable(), lowering); |
return; |
} |
+ case IrOpcode::kObjectIsNaN: { |
+ Type* const input_type = GetUpperBound(node->InputAt(0)); |
+ if (input_type->Is(Type::NaN())) { |
+ VisitUnop(node, UseInfo::None(), MachineRepresentation::kBit); |
+ if (lower()) { |
+ DeferReplacement(node, lowering->jsgraph()->Int32Constant(1)); |
+ } |
+ } else if (!input_type->Maybe(Type::NaN())) { |
+ VisitUnop(node, UseInfo::Any(), MachineRepresentation::kBit); |
+ if (lower()) { |
+ DeferReplacement(node, lowering->jsgraph()->Int32Constant(0)); |
+ } |
+ } else if (input_type->Is(Type::Number())) { |
+ VisitUnop(node, UseInfo::TruncatingFloat64(), |
+ MachineRepresentation::kBit); |
+ if (lower()) { |
+ // ObjectIsNaN(x:kRepFloat64) => Word32Equal(Float64Equal(x,x),#0) |
+ Node* const input = node->InputAt(0); |
+ node->ReplaceInput( |
+ 0, jsgraph_->graph()->NewNode( |
+ lowering->machine()->Float64Equal(), input, input)); |
+ node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0)); |
+ NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal()); |
+ } |
+ } else { |
+ VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit); |
+ } |
+ return; |
+ } |
case IrOpcode::kObjectIsNonCallable: { |
VisitObjectIs(node, Type::NonCallable(), lowering); |
return; |