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 | |
709 bool IsNodeRepresentationTagged(Node* node) { | 704 bool IsNodeRepresentationTagged(Node* node) { |
710 MachineRepresentation representation = GetInfo(node)->representation(); | 705 MachineRepresentation representation = GetInfo(node)->representation(); |
711 return IsAnyTagged(representation); | 706 return IsAnyTagged(representation); |
712 } | 707 } |
713 | 708 |
714 bool OneInputCannotBe(Node* node, Type* type) { | 709 bool OneInputCannotBe(Node* node, Type* type) { |
715 DCHECK_EQ(2, node->op()->ValueInputCount()); | 710 DCHECK_EQ(2, node->op()->ValueInputCount()); |
716 return !GetUpperBound(node->InputAt(0))->Maybe(type) || | 711 return !GetUpperBound(node->InputAt(0))->Maybe(type) || |
717 !GetUpperBound(node->InputAt(1))->Maybe(type); | 712 !GetUpperBound(node->InputAt(1))->Maybe(type); |
718 } | 713 } |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1617 DCHECK(lower()); | 1612 DCHECK(lower()); |
1618 Node* lhs = node->InputAt(0); | 1613 Node* lhs = node->InputAt(0); |
1619 Node* rhs = node->InputAt(1); | 1614 Node* rhs = node->InputAt(1); |
1620 if (IsNodeRepresentationTagged(lhs) && | 1615 if (IsNodeRepresentationTagged(lhs) && |
1621 IsNodeRepresentationTagged(rhs)) { | 1616 IsNodeRepresentationTagged(rhs)) { |
1622 VisitBinop(node, UseInfo::CheckedSignedSmallAsTaggedSigned(), | 1617 VisitBinop(node, UseInfo::CheckedSignedSmallAsTaggedSigned(), |
1623 MachineRepresentation::kBit); | 1618 MachineRepresentation::kBit); |
1624 ChangeToPureOp( | 1619 ChangeToPureOp( |
1625 node, changer_->TaggedSignedOperatorFor(node->opcode())); | 1620 node, changer_->TaggedSignedOperatorFor(node->opcode())); |
1626 | 1621 |
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)); | |
1636 } else { | 1622 } else { |
1637 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1623 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
1638 MachineRepresentation::kBit); | 1624 MachineRepresentation::kBit); |
1639 ChangeToPureOp(node, Int32Op(node)); | 1625 ChangeToPureOp(node, Int32Op(node)); |
1640 } | 1626 } |
1641 } | 1627 } |
1642 return; | 1628 return; |
1643 } | 1629 } |
1644 case NumberOperationHint::kNumberOrOddball: | 1630 case NumberOperationHint::kNumberOrOddball: |
1645 // Abstract and strict equality don't perform ToNumber conversions | 1631 // Abstract and strict equality don't perform ToNumber conversions |
(...skipping 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3631 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3617 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3632 Operator::kNoProperties); | 3618 Operator::kNoProperties); |
3633 to_number_operator_.set(common()->Call(desc)); | 3619 to_number_operator_.set(common()->Call(desc)); |
3634 } | 3620 } |
3635 return to_number_operator_.get(); | 3621 return to_number_operator_.get(); |
3636 } | 3622 } |
3637 | 3623 |
3638 } // namespace compiler | 3624 } // namespace compiler |
3639 } // namespace internal | 3625 } // namespace internal |
3640 } // namespace v8 | 3626 } // namespace v8 |
OLD | NEW |