Chromium Code Reviews| Index: src/compiler/simplified-lowering.cc |
| diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc |
| index 4acc77f22f3668fcee5dc4e7d911a2b853709bba..82d2e1d29590f0aa9510a2ea817d7f2b5f9cf8e4 100644 |
| --- a/src/compiler/simplified-lowering.cc |
| +++ b/src/compiler/simplified-lowering.cc |
| @@ -2545,6 +2545,36 @@ class RepresentationSelector { |
| VisitObjectIs(node, Type::DetectableCallable(), lowering); |
| return; |
| } |
| + case IrOpcode::kObjectIsNaN: { |
| + Type* const input_type = TypeOf(node->InputAt(0)); |
| + if (input_type->Is(Type::NaN())) { |
| + VisitUnop(node, UseInfo::None(), MachineRepresentation::kBit); |
|
Jarin
2017/02/27 15:15:49
Are you sure it is ok to change the use infos base
Benedikt Meurer
2017/03/03 08:42:15
Changed to GetUpperBound now, and added tests.
|
| + 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; |