OLD | NEW |
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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 bool BothInputsAreUnsigned32(Node* node) { | 694 bool BothInputsAreUnsigned32(Node* node) { |
695 return BothInputsAre(node, Type::Unsigned32()); | 695 return BothInputsAre(node, Type::Unsigned32()); |
696 } | 696 } |
697 | 697 |
698 bool BothInputsAre(Node* node, Type* type) { | 698 bool BothInputsAre(Node* node, Type* type) { |
699 DCHECK_EQ(2, node->op()->ValueInputCount()); | 699 DCHECK_EQ(2, node->op()->ValueInputCount()); |
700 return GetUpperBound(node->InputAt(0))->Is(type) && | 700 return GetUpperBound(node->InputAt(0))->Is(type) && |
701 GetUpperBound(node->InputAt(1))->Is(type); | 701 GetUpperBound(node->InputAt(1))->Is(type); |
702 } | 702 } |
703 | 703 |
| 704 bool IsNodeRepresentationFloat64(Node* node) { |
| 705 MachineRepresentation representation = GetInfo(node)->representation(); |
| 706 return representation == MachineRepresentation::kFloat64; |
| 707 } |
| 708 |
704 bool IsNodeRepresentationTagged(Node* node) { | 709 bool IsNodeRepresentationTagged(Node* node) { |
705 MachineRepresentation representation = GetInfo(node)->representation(); | 710 MachineRepresentation representation = GetInfo(node)->representation(); |
706 return IsAnyTagged(representation); | 711 return IsAnyTagged(representation); |
707 } | 712 } |
708 | 713 |
709 bool OneInputCannotBe(Node* node, Type* type) { | 714 bool OneInputCannotBe(Node* node, Type* type) { |
710 DCHECK_EQ(2, node->op()->ValueInputCount()); | 715 DCHECK_EQ(2, node->op()->ValueInputCount()); |
711 return !GetUpperBound(node->InputAt(0))->Maybe(type) || | 716 return !GetUpperBound(node->InputAt(0))->Maybe(type) || |
712 !GetUpperBound(node->InputAt(1))->Maybe(type); | 717 !GetUpperBound(node->InputAt(1))->Maybe(type); |
713 } | 718 } |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 DCHECK(lower()); | 1617 DCHECK(lower()); |
1613 Node* lhs = node->InputAt(0); | 1618 Node* lhs = node->InputAt(0); |
1614 Node* rhs = node->InputAt(1); | 1619 Node* rhs = node->InputAt(1); |
1615 if (IsNodeRepresentationTagged(lhs) && | 1620 if (IsNodeRepresentationTagged(lhs) && |
1616 IsNodeRepresentationTagged(rhs)) { | 1621 IsNodeRepresentationTagged(rhs)) { |
1617 VisitBinop(node, UseInfo::CheckedSignedSmallAsTaggedSigned(), | 1622 VisitBinop(node, UseInfo::CheckedSignedSmallAsTaggedSigned(), |
1618 MachineRepresentation::kBit); | 1623 MachineRepresentation::kBit); |
1619 ChangeToPureOp( | 1624 ChangeToPureOp( |
1620 node, changer_->TaggedSignedOperatorFor(node->opcode())); | 1625 node, changer_->TaggedSignedOperatorFor(node->opcode())); |
1621 | 1626 |
| 1627 } else if (IsNodeRepresentationFloat64(lhs) || |
| 1628 IsNodeRepresentationFloat64(rhs)) { |
| 1629 // If one side is already a Float64, it's pretty expensive to |
| 1630 // do the comparison in Word32, since that means we need a |
| 1631 // checked conversion from Float64 to Word32. It's cheaper to |
| 1632 // just go to Float64 for the comparison. |
| 1633 VisitBinop(node, UseInfo::CheckedNumberAsFloat64(), |
| 1634 MachineRepresentation::kBit); |
| 1635 ChangeToPureOp(node, Float64Op(node)); |
1622 } else { | 1636 } else { |
1623 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1637 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
1624 MachineRepresentation::kBit); | 1638 MachineRepresentation::kBit); |
1625 ChangeToPureOp(node, Int32Op(node)); | 1639 ChangeToPureOp(node, Int32Op(node)); |
1626 } | 1640 } |
1627 } | 1641 } |
1628 return; | 1642 return; |
1629 } | 1643 } |
1630 case NumberOperationHint::kNumberOrOddball: | 1644 case NumberOperationHint::kNumberOrOddball: |
1631 // Abstract and strict equality don't perform ToNumber conversions | 1645 // Abstract and strict equality don't perform ToNumber conversions |
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3617 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3631 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3618 Operator::kNoProperties); | 3632 Operator::kNoProperties); |
3619 to_number_operator_.set(common()->Call(desc)); | 3633 to_number_operator_.set(common()->Call(desc)); |
3620 } | 3634 } |
3621 return to_number_operator_.get(); | 3635 return to_number_operator_.get(); |
3622 } | 3636 } |
3623 | 3637 |
3624 } // namespace compiler | 3638 } // namespace compiler |
3625 } // namespace internal | 3639 } // namespace internal |
3626 } // namespace v8 | 3640 } // namespace v8 |
OLD | NEW |