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

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

Issue 2626603002: [turbofan] Do Smi comparison without untagging when lowering SpeculativeNumber(Compare). (Closed)
Patch Set: Addressed comments. Created 3 years, 11 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/representation-change.cc ('k') | no next file » | 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 IsNodeRepresentationTagged(Node* node) {
701 MachineRepresentation representation = GetInfo(node)->representation();
702 return IsAnyTagged(representation);
703 }
704
700 bool OneInputCannotBe(Node* node, Type* type) { 705 bool OneInputCannotBe(Node* node, Type* type) {
701 DCHECK_EQ(2, node->op()->ValueInputCount()); 706 DCHECK_EQ(2, node->op()->ValueInputCount());
702 return !GetUpperBound(node->InputAt(0))->Maybe(type) || 707 return !GetUpperBound(node->InputAt(0))->Maybe(type) ||
703 !GetUpperBound(node->InputAt(1))->Maybe(type); 708 !GetUpperBound(node->InputAt(1))->Maybe(type);
704 } 709 }
705 710
706 void ConvertInput(Node* node, int index, UseInfo use) { 711 void ConvertInput(Node* node, int index, UseInfo use) {
707 Node* input = node->InputAt(index); 712 Node* input = node->InputAt(index);
708 // In the change phase, insert a change before the use if necessary. 713 // In the change phase, insert a change before the use if necessary.
709 if (use.representation() == MachineRepresentation::kNone) 714 if (use.representation() == MachineRepresentation::kNone)
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
1576 // => signed Int32Cmp 1581 // => signed Int32Cmp
1577 VisitBinop(node, UseInfo::TruncatingWord32(), 1582 VisitBinop(node, UseInfo::TruncatingWord32(),
1578 MachineRepresentation::kBit); 1583 MachineRepresentation::kBit);
1579 if (lower()) ChangeToPureOp(node, Int32Op(node)); 1584 if (lower()) ChangeToPureOp(node, Int32Op(node));
1580 return; 1585 return;
1581 } 1586 }
1582 // Try to use type feedback. 1587 // Try to use type feedback.
1583 NumberOperationHint hint = NumberOperationHintOf(node->op()); 1588 NumberOperationHint hint = NumberOperationHintOf(node->op());
1584 switch (hint) { 1589 switch (hint) {
1585 case NumberOperationHint::kSignedSmall: 1590 case NumberOperationHint::kSignedSmall:
1586 case NumberOperationHint::kSigned32: 1591 case NumberOperationHint::kSigned32: {
1587 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), 1592 if (propagate()) {
1588 MachineRepresentation::kBit); 1593 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
1589 if (lower()) ChangeToPureOp(node, Int32Op(node)); 1594 MachineRepresentation::kBit);
1595 } else if (retype()) {
1596 SetOutput(node, MachineRepresentation::kBit, Type::Any());
1597 } else {
1598 DCHECK(lower());
1599 Node* lhs = node->InputAt(0);
1600 Node* rhs = node->InputAt(1);
1601 if (IsNodeRepresentationTagged(lhs) &&
1602 IsNodeRepresentationTagged(rhs)) {
1603 VisitBinop(node, UseInfo::CheckedSignedSmallAsTaggedSigned(),
1604 MachineRepresentation::kBit);
1605 ChangeToPureOp(
1606 node, changer_->TaggedSignedOperatorFor(node->opcode()));
1607
1608 } else {
1609 VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
1610 MachineRepresentation::kBit);
1611 ChangeToPureOp(node, Int32Op(node));
1612 }
1613 }
1590 return; 1614 return;
1615 }
1591 case NumberOperationHint::kNumberOrOddball: 1616 case NumberOperationHint::kNumberOrOddball:
1592 // Abstract and strict equality don't perform ToNumber conversions 1617 // Abstract and strict equality don't perform ToNumber conversions
1593 // on Oddballs, so make sure we don't accidentially sneak in a hint 1618 // on Oddballs, so make sure we don't accidentially sneak in a
1594 // with Oddball feedback here. 1619 // hint with Oddball feedback here.
1595 DCHECK_NE(IrOpcode::kSpeculativeNumberEqual, node->opcode()); 1620 DCHECK_NE(IrOpcode::kSpeculativeNumberEqual, node->opcode());
1596 // Fallthrough 1621 // Fallthrough
1597 case NumberOperationHint::kNumber: 1622 case NumberOperationHint::kNumber:
1598 VisitBinop(node, CheckedUseInfoAsFloat64FromHint(hint), 1623 VisitBinop(node, CheckedUseInfoAsFloat64FromHint(hint),
1599 MachineRepresentation::kBit); 1624 MachineRepresentation::kBit);
1600 if (lower()) ChangeToPureOp(node, Float64Op(node)); 1625 if (lower()) ChangeToPureOp(node, Float64Op(node));
1601 return; 1626 return;
1602 } 1627 }
1603 UNREACHABLE(); 1628 UNREACHABLE();
1604 return; 1629 return;
(...skipping 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after
3467 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3492 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3468 Operator::kNoProperties); 3493 Operator::kNoProperties);
3469 to_number_operator_.set(common()->Call(desc)); 3494 to_number_operator_.set(common()->Call(desc));
3470 } 3495 }
3471 return to_number_operator_.get(); 3496 return to_number_operator_.get();
3472 } 3497 }
3473 3498
3474 } // namespace compiler 3499 } // namespace compiler
3475 } // namespace internal 3500 } // namespace internal
3476 } // namespace v8 3501 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/representation-change.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698