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

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

Issue 2410883003: [turbofan] Remove minus zero check for rhs of CheckedInt32Sub. (Closed)
Patch Set: Adding TODO. Created 4 years, 2 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') | test/cctest/compiler/test-representation-change.cc » ('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 491aed6b6bf0cda71d1fb16c09d135e900ad7fef..85186b0c7ae764bd5b11dc4e181835e3a9bf9652 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -87,12 +87,14 @@ MachineRepresentation MachineRepresentationFromArrayType(
return MachineRepresentation::kNone;
}
-UseInfo CheckedUseInfoAsWord32FromHint(NumberOperationHint hint) {
+UseInfo CheckedUseInfoAsWord32FromHint(
+ NumberOperationHint hint, CheckForMinusZeroMode minus_zero_mode =
+ CheckForMinusZeroMode::kCheckForMinusZero) {
switch (hint) {
case NumberOperationHint::kSignedSmall:
- return UseInfo::CheckedSignedSmallAsWord32();
+ return UseInfo::CheckedSignedSmallAsWord32(minus_zero_mode);
case NumberOperationHint::kSigned32:
- return UseInfo::CheckedSigned32AsWord32();
+ return UseInfo::CheckedSigned32AsWord32(minus_zero_mode);
case NumberOperationHint::kNumber:
return UseInfo::CheckedNumberAsWord32();
case NumberOperationHint::kNumberOrOddball:
@@ -1146,8 +1148,15 @@ class RepresentationSelector {
if (hint == NumberOperationHint::kSignedSmall ||
hint == NumberOperationHint::kSigned32) {
- VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint),
- MachineRepresentation::kWord32, Type::Signed32());
+ UseInfo left_use = CheckedUseInfoAsWord32FromHint(hint);
+ // For subtraction, the right hand side can be minus zero without
+ // resulting in minus zero, so we skip the check for it.
+ UseInfo right_use = CheckedUseInfoAsWord32FromHint(
+ hint, node->opcode() == IrOpcode::kSpeculativeNumberSubtract
+ ? CheckForMinusZeroMode::kDontCheckForMinusZero
+ : CheckForMinusZeroMode::kCheckForMinusZero);
+ VisitBinop(node, left_use, right_use, MachineRepresentation::kWord32,
+ Type::Signed32());
if (lower()) ChangeToInt32OverflowOp(node);
return;
}
« no previous file with comments | « src/compiler/representation-change.cc ('k') | test/cctest/compiler/test-representation-change.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698