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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 2722483003: [turbofan] Introduce dedicated ObjectIsNaN operator. (Closed)
Patch Set: Use GetUpperBound. Add test cases. Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « src/compiler/opcodes.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/address-map.h" 9 #include "src/address-map.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 2527 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 } 2538 }
2539 } else { 2539 } else {
2540 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); 2540 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged);
2541 } 2541 }
2542 return; 2542 return;
2543 } 2543 }
2544 case IrOpcode::kObjectIsDetectableCallable: { 2544 case IrOpcode::kObjectIsDetectableCallable: {
2545 VisitObjectIs(node, Type::DetectableCallable(), lowering); 2545 VisitObjectIs(node, Type::DetectableCallable(), lowering);
2546 return; 2546 return;
2547 } 2547 }
2548 case IrOpcode::kObjectIsNaN: {
2549 Type* const input_type = GetUpperBound(node->InputAt(0));
2550 if (input_type->Is(Type::NaN())) {
2551 VisitUnop(node, UseInfo::None(), MachineRepresentation::kBit);
2552 if (lower()) {
2553 DeferReplacement(node, lowering->jsgraph()->Int32Constant(1));
2554 }
2555 } else if (!input_type->Maybe(Type::NaN())) {
2556 VisitUnop(node, UseInfo::Any(), MachineRepresentation::kBit);
2557 if (lower()) {
2558 DeferReplacement(node, lowering->jsgraph()->Int32Constant(0));
2559 }
2560 } else if (input_type->Is(Type::Number())) {
2561 VisitUnop(node, UseInfo::TruncatingFloat64(),
2562 MachineRepresentation::kBit);
2563 if (lower()) {
2564 // ObjectIsNaN(x:kRepFloat64) => Word32Equal(Float64Equal(x,x),#0)
2565 Node* const input = node->InputAt(0);
2566 node->ReplaceInput(
2567 0, jsgraph_->graph()->NewNode(
2568 lowering->machine()->Float64Equal(), input, input));
2569 node->AppendInput(jsgraph_->zone(), jsgraph_->Int32Constant(0));
2570 NodeProperties::ChangeOp(node, lowering->machine()->Word32Equal());
2571 }
2572 } else {
2573 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit);
2574 }
2575 return;
2576 }
2548 case IrOpcode::kObjectIsNonCallable: { 2577 case IrOpcode::kObjectIsNonCallable: {
2549 VisitObjectIs(node, Type::NonCallable(), lowering); 2578 VisitObjectIs(node, Type::NonCallable(), lowering);
2550 return; 2579 return;
2551 } 2580 }
2552 case IrOpcode::kObjectIsNumber: { 2581 case IrOpcode::kObjectIsNumber: {
2553 VisitObjectIs(node, Type::Number(), lowering); 2582 VisitObjectIs(node, Type::Number(), lowering);
2554 return; 2583 return;
2555 } 2584 }
2556 case IrOpcode::kObjectIsReceiver: { 2585 case IrOpcode::kObjectIsReceiver: {
2557 VisitObjectIs(node, Type::Receiver(), lowering); 2586 VisitObjectIs(node, Type::Receiver(), lowering);
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
3540 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3569 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3541 Operator::kNoProperties); 3570 Operator::kNoProperties);
3542 to_number_operator_.set(common()->Call(desc)); 3571 to_number_operator_.set(common()->Call(desc));
3543 } 3572 }
3544 return to_number_operator_.get(); 3573 return to_number_operator_.get();
3545 } 3574 }
3546 3575
3547 } // namespace compiler 3576 } // namespace compiler
3548 } // namespace internal 3577 } // namespace internal
3549 } // namespace v8 3578 } // namespace v8
OLDNEW
« 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