Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: src/compiler/effect-control-linearizer.cc

Issue 2722483003: [turbofan] Introduce dedicated ObjectIsNaN operator. (Closed)
Patch Set: Use GetUpperBound. Add test cases. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/js-builtin-reducer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/js-builtin-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698