Chromium Code Reviews| 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) || | |
|
Jarin
2017/04/03 07:58:19
Insert a comment explaining what is going on here,
Benedikt Meurer
2017/04/03 08:00:28
Done.
| |
| 1628 IsNodeRepresentationFloat64(rhs)) { | |
| 1629 VisitBinop(node, UseInfo::CheckedNumberAsFloat64(), | |
| 1630 MachineRepresentation::kBit); | |
| 1631 ChangeToPureOp(node, Float64Op(node)); | |
| 1622 } else { | 1632 } else { |
| 1623 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1633 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
| 1624 MachineRepresentation::kBit); | 1634 MachineRepresentation::kBit); |
| 1625 ChangeToPureOp(node, Int32Op(node)); | 1635 ChangeToPureOp(node, Int32Op(node)); |
| 1626 } | 1636 } |
| 1627 } | 1637 } |
| 1628 return; | 1638 return; |
| 1629 } | 1639 } |
| 1630 case NumberOperationHint::kNumberOrOddball: | 1640 case NumberOperationHint::kNumberOrOddball: |
| 1631 // Abstract and strict equality don't perform ToNumber conversions | 1641 // 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, | 3627 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
| 3618 Operator::kNoProperties); | 3628 Operator::kNoProperties); |
| 3619 to_number_operator_.set(common()->Call(desc)); | 3629 to_number_operator_.set(common()->Call(desc)); |
| 3620 } | 3630 } |
| 3621 return to_number_operator_.get(); | 3631 return to_number_operator_.get(); |
| 3622 } | 3632 } |
| 3623 | 3633 |
| 3624 } // namespace compiler | 3634 } // namespace compiler |
| 3625 } // namespace internal | 3635 } // namespace internal |
| 3626 } // namespace v8 | 3636 } // namespace v8 |
| OLD | NEW |