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

Unified Diff: src/compiler/simplified-lowering.cc

Issue 2626603002: [turbofan] Do Smi comparison without untagging when lowering SpeculativeNumber(Compare). (Closed)
Patch Set: Update. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/representation-change.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/simplified-lowering.cc
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
index 0e254a52b2cb2899887784a52aaae49a417b93e6..dd4324b289614fbbfb75e57c00fbf4b947236ace 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -697,6 +697,13 @@ class RepresentationSelector {
GetUpperBound(node->InputAt(1))->Is(type);
}
+ 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.
+ MachineRepresentation representation = GetInfo(node)->representation();
+ return representation == MachineRepresentation::kTagged ||
+ representation == MachineRepresentation::kTaggedSigned ||
+ representation == MachineRepresentation::kTaggedPointer;
Jarin 2017/01/10 15:14:16 return IsAnyTagged(GetInfo(node)->representation()
epertoso 2017/01/10 15:18:16 Done.
+ }
+
bool OneInputCannotBe(Node* node, Type* type) {
DCHECK_EQ(2, node->op()->ValueInputCount());
return !GetUpperBound(node->InputAt(0))->Maybe(type) ||
@@ -1583,15 +1590,35 @@ class RepresentationSelector {
NumberOperationHint hint = NumberOperationHintOf(node->op());
switch (hint) {
case NumberOperationHint::kSignedSmall:
- case NumberOperationHint::kSigned32:
- VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
- MachineRepresentation::kBit);
- if (lower()) ChangeToPureOp(node, Int32Op(node));
+ case NumberOperationHint::kSigned32: {
+ if (propagate()) {
+ VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
+ MachineRepresentation::kBit);
+ } else if (retype()) {
+ SetOutput(node, MachineRepresentation::kBit, Type::Any());
+ } else {
+ DCHECK(lower());
+ Node* lhs = node->InputAt(0);
+ Node* rhs = node->InputAt(1);
+ if (InputRepresentationIsTagged(lhs) &&
+ InputRepresentationIsTagged(rhs)) {
+ VisitBinop(node, UseInfo::CheckedSignedSmallAsTaggedSigned(),
+ MachineRepresentation::kBit);
+ ChangeToPureOp(
+ node, changer_->TaggedSignedOperatorFor(node->opcode()));
+
+ } else {
+ VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
+ MachineRepresentation::kBit);
+ ChangeToPureOp(node, Int32Op(node));
+ }
+ }
return;
+ }
case NumberOperationHint::kNumberOrOddball:
// Abstract and strict equality don't perform ToNumber conversions
- // on Oddballs, so make sure we don't accidentially sneak in a hint
- // with Oddball feedback here.
+ // on Oddballs, so make sure we don't accidentially sneak in a
+ // hint with Oddball feedback here.
DCHECK_NE(IrOpcode::kSpeculativeNumberEqual, node->opcode());
// Fallthrough
case NumberOperationHint::kNumber:
« 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