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

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

Issue 2709423002: [compiler] Speculate a little more in SpeculativeShiftRightLogical. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | test/mjsunit/compiler/shift-shr.js » ('j') | 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 74d157028d9cf147a3eb3e3c4091848c412e23e9..6c3ac4fd1b74e3f867be8d976af8dc3a7049eba1 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -1986,8 +1986,27 @@ class RepresentationSelector {
if (BothInputsAre(node, Type::PlainPrimitive())) {
if (truncation.IsUnused()) return VisitUnused(node);
}
+ NumberOperationHint hint = NumberOperationHintOf(node->op());
+ Type* rhs_type = GetUpperBound(node->InputAt(1));
+ STATIC_ASSERT(NumberOperationHint::kSignedSmall <=
+ NumberOperationHint::kSigned32);
+ if (rhs_type->Is(type_cache_.kZeroish) &&
+ hint <= NumberOperationHint::kSigned32 &&
Jarin 2017/02/24 10:56:05 In other places, we say "if (hint == NumberOperati
+ !truncation.IsUsedAsWord32()) {
+ // The SignedSmall or Signed32 feedback means that the results that we
+ // have seen so far were of type Unsigned31. We speculate that this
+ // will continue to hold. Moreover, since the RHS is 0, the result
+ // will just be the (converted) LHS.
+ VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
+ MachineRepresentation::kWord32, Type::Unsigned31());
+ if (lower()) {
+ node->RemoveInput(1);
+ NodeProperties::ChangeOp(node,
+ simplified()->CheckedUint32ToInt32());
+ }
+ return;
+ }
if (BothInputsAre(node, Type::NumberOrOddball())) {
- Type* rhs_type = GetUpperBound(node->InputAt(1));
VisitBinop(node, UseInfo::TruncatingWord32(),
UseInfo::TruncatingWord32(),
MachineRepresentation::kWord32);
@@ -1996,8 +2015,6 @@ class RepresentationSelector {
}
return;
}
- NumberOperationHint hint = NumberOperationHintOf(node->op());
- Type* rhs_type = GetUpperBound(node->InputAt(1));
VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
MachineRepresentation::kWord32, Type::Unsigned32());
if (lower()) {
« no previous file with comments | « no previous file | test/mjsunit/compiler/shift-shr.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698