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

Unified Diff: src/compiler/simplified-lowering.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/opcodes.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698