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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 bool BothInputsAreUnsigned32(Node* node) { | 690 bool BothInputsAreUnsigned32(Node* node) { | 
| 691 return BothInputsAre(node, Type::Unsigned32()); | 691 return BothInputsAre(node, Type::Unsigned32()); | 
| 692 } | 692 } | 
| 693 | 693 | 
| 694 bool BothInputsAre(Node* node, Type* type) { | 694 bool BothInputsAre(Node* node, Type* type) { | 
| 695 DCHECK_EQ(2, node->op()->ValueInputCount()); | 695 DCHECK_EQ(2, node->op()->ValueInputCount()); | 
| 696 return GetUpperBound(node->InputAt(0))->Is(type) && | 696 return GetUpperBound(node->InputAt(0))->Is(type) && | 
| 697 GetUpperBound(node->InputAt(1))->Is(type); | 697 GetUpperBound(node->InputAt(1))->Is(type); | 
| 698 } | 698 } | 
| 699 | 699 | 
| 700 bool InputRepresentationIsTagged(Node* node) { | |
| 
 
Jarin
2017/01/10 15:14:16
It is not really input-specific, so maybe rename t
 
epertoso
2017/01/10 15:18:16
Done.
 
 | |
| 701 MachineRepresentation representation = GetInfo(node)->representation(); | |
| 702 return representation == MachineRepresentation::kTagged || | |
| 703 representation == MachineRepresentation::kTaggedSigned || | |
| 704 representation == MachineRepresentation::kTaggedPointer; | |
| 
 
Jarin
2017/01/10 15:14:16
return IsAnyTagged(GetInfo(node)->representation()
 
epertoso
2017/01/10 15:18:16
Done.
 
 | |
| 705 } | |
| 706 | |
| 700 bool OneInputCannotBe(Node* node, Type* type) { | 707 bool OneInputCannotBe(Node* node, Type* type) { | 
| 701 DCHECK_EQ(2, node->op()->ValueInputCount()); | 708 DCHECK_EQ(2, node->op()->ValueInputCount()); | 
| 702 return !GetUpperBound(node->InputAt(0))->Maybe(type) || | 709 return !GetUpperBound(node->InputAt(0))->Maybe(type) || | 
| 703 !GetUpperBound(node->InputAt(1))->Maybe(type); | 710 !GetUpperBound(node->InputAt(1))->Maybe(type); | 
| 704 } | 711 } | 
| 705 | 712 | 
| 706 void ConvertInput(Node* node, int index, UseInfo use) { | 713 void ConvertInput(Node* node, int index, UseInfo use) { | 
| 707 Node* input = node->InputAt(index); | 714 Node* input = node->InputAt(index); | 
| 708 // In the change phase, insert a change before the use if necessary. | 715 // In the change phase, insert a change before the use if necessary. | 
| 709 if (use.representation() == MachineRepresentation::kNone) | 716 if (use.representation() == MachineRepresentation::kNone) | 
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1576 // => signed Int32Cmp | 1583 // => signed Int32Cmp | 
| 1577 VisitBinop(node, UseInfo::TruncatingWord32(), | 1584 VisitBinop(node, UseInfo::TruncatingWord32(), | 
| 1578 MachineRepresentation::kBit); | 1585 MachineRepresentation::kBit); | 
| 1579 if (lower()) ChangeToPureOp(node, Int32Op(node)); | 1586 if (lower()) ChangeToPureOp(node, Int32Op(node)); | 
| 1580 return; | 1587 return; | 
| 1581 } | 1588 } | 
| 1582 // Try to use type feedback. | 1589 // Try to use type feedback. | 
| 1583 NumberOperationHint hint = NumberOperationHintOf(node->op()); | 1590 NumberOperationHint hint = NumberOperationHintOf(node->op()); | 
| 1584 switch (hint) { | 1591 switch (hint) { | 
| 1585 case NumberOperationHint::kSignedSmall: | 1592 case NumberOperationHint::kSignedSmall: | 
| 1586 case NumberOperationHint::kSigned32: | 1593 case NumberOperationHint::kSigned32: { | 
| 1587 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 1594 if (propagate()) { | 
| 1588 MachineRepresentation::kBit); | 1595 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | 
| 1589 if (lower()) ChangeToPureOp(node, Int32Op(node)); | 1596 MachineRepresentation::kBit); | 
| 1597 } else if (retype()) { | |
| 1598 SetOutput(node, MachineRepresentation::kBit, Type::Any()); | |
| 1599 } else { | |
| 1600 DCHECK(lower()); | |
| 1601 Node* lhs = node->InputAt(0); | |
| 1602 Node* rhs = node->InputAt(1); | |
| 1603 if (InputRepresentationIsTagged(lhs) && | |
| 1604 InputRepresentationIsTagged(rhs)) { | |
| 1605 VisitBinop(node, UseInfo::CheckedSignedSmallAsTaggedSigned(), | |
| 1606 MachineRepresentation::kBit); | |
| 1607 ChangeToPureOp( | |
| 1608 node, changer_->TaggedSignedOperatorFor(node->opcode())); | |
| 1609 | |
| 1610 } else { | |
| 1611 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), | |
| 1612 MachineRepresentation::kBit); | |
| 1613 ChangeToPureOp(node, Int32Op(node)); | |
| 1614 } | |
| 1615 } | |
| 1590 return; | 1616 return; | 
| 1617 } | |
| 1591 case NumberOperationHint::kNumberOrOddball: | 1618 case NumberOperationHint::kNumberOrOddball: | 
| 1592 // Abstract and strict equality don't perform ToNumber conversions | 1619 // Abstract and strict equality don't perform ToNumber conversions | 
| 1593 // on Oddballs, so make sure we don't accidentially sneak in a hint | 1620 // on Oddballs, so make sure we don't accidentially sneak in a | 
| 1594 // with Oddball feedback here. | 1621 // hint with Oddball feedback here. | 
| 1595 DCHECK_NE(IrOpcode::kSpeculativeNumberEqual, node->opcode()); | 1622 DCHECK_NE(IrOpcode::kSpeculativeNumberEqual, node->opcode()); | 
| 1596 // Fallthrough | 1623 // Fallthrough | 
| 1597 case NumberOperationHint::kNumber: | 1624 case NumberOperationHint::kNumber: | 
| 1598 VisitBinop(node, CheckedUseInfoAsFloat64FromHint(hint), | 1625 VisitBinop(node, CheckedUseInfoAsFloat64FromHint(hint), | 
| 1599 MachineRepresentation::kBit); | 1626 MachineRepresentation::kBit); | 
| 1600 if (lower()) ChangeToPureOp(node, Float64Op(node)); | 1627 if (lower()) ChangeToPureOp(node, Float64Op(node)); | 
| 1601 return; | 1628 return; | 
| 1602 } | 1629 } | 
| 1603 UNREACHABLE(); | 1630 UNREACHABLE(); | 
| 1604 return; | 1631 return; | 
| (...skipping 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3467 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3494 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 
| 3468 Operator::kNoProperties); | 3495 Operator::kNoProperties); | 
| 3469 to_number_operator_.set(common()->Call(desc)); | 3496 to_number_operator_.set(common()->Call(desc)); | 
| 3470 } | 3497 } | 
| 3471 return to_number_operator_.get(); | 3498 return to_number_operator_.get(); | 
| 3472 } | 3499 } | 
| 3473 | 3500 | 
| 3474 } // namespace compiler | 3501 } // namespace compiler | 
| 3475 } // namespace internal | 3502 } // namespace internal | 
| 3476 } // namespace v8 | 3503 } // namespace v8 | 
| OLD | NEW |