Index: src/compiler/effect-control-linearizer.cc |
diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc |
index ee8a69e6f1556f1f383336c61fb39defb81826ec..038a277eea075e1fb862f0b3a4796ed44cdbf6d3 100644 |
--- a/src/compiler/effect-control-linearizer.cc |
+++ b/src/compiler/effect-control-linearizer.cc |
@@ -720,6 +720,9 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node, |
case IrOpcode::kObjectIsDetectableCallable: |
result = LowerObjectIsDetectableCallable(node); |
break; |
+ case IrOpcode::kObjectIsNaN: |
+ result = LowerObjectIsNaN(node); |
+ break; |
case IrOpcode::kObjectIsNonCallable: |
result = LowerObjectIsNonCallable(node); |
break; |
@@ -1717,6 +1720,29 @@ Node* EffectControlLinearizer::LowerObjectIsDetectableCallable(Node* node) { |
return done.PhiAt(0); |
} |
+Node* EffectControlLinearizer::LowerObjectIsNaN(Node* node) { |
+ Node* value = node->InputAt(0); |
+ Node* zero = __ Int32Constant(0); |
+ |
+ auto done = __ MakeLabel<3>(MachineRepresentation::kBit); |
+ |
+ // Check if {value} is a Smi. |
+ __ GotoIf(ObjectIsSmi(value), &done, zero); |
+ |
+ // Check if {value} is a HeapNumber. |
+ Node* value_map = __ LoadField(AccessBuilder::ForMap(), value); |
+ __ GotoUnless(__ WordEqual(value_map, __ HeapNumberMapConstant()), &done, |
+ zero); |
+ |
+ // Check if {value} contains a NaN. |
+ Node* value_value = __ LoadField(AccessBuilder::ForHeapNumberValue(), value); |
+ __ Goto(&done, |
+ __ Word32Equal(__ Float64Equal(value_value, value_value), zero)); |
+ |
+ __ Bind(&done); |
+ return done.PhiAt(0); |
+} |
+ |
Node* EffectControlLinearizer::LowerObjectIsNonCallable(Node* node) { |
Node* value = node->InputAt(0); |