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

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

Issue 1417023005: [turbofan] Simplify representation inference for add/subtract. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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 | 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 4bba861313aeb7195ff01deb4469a576e6341bd3..3eb10c21988d5e68c70d7f702c78549b799621f6 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -474,32 +474,23 @@ class RepresentationSelector {
bool CanLowerToInt32Binop(Node* node, MachineTypeUnion use) {
return BothInputsAre(node, Type::Signed32()) &&
- (!CanObserveNonInt32(use) ||
+ (!CanObserveNonWord32(use) ||
NodeProperties::GetType(node)->Is(Type::Signed32()));
}
- bool CanLowerToInt32AdditiveBinop(Node* node, MachineTypeUnion use) {
+ bool CanLowerToWord32AdditiveBinop(Node* node, MachineTypeUnion use) {
return BothInputsAre(node, safe_int_additive_range_) &&
- !CanObserveNonInt32(use);
+ !CanObserveNonWord32(use);
}
bool CanLowerToUint32Binop(Node* node, MachineTypeUnion use) {
return BothInputsAre(node, Type::Unsigned32()) &&
- (!CanObserveNonUint32(use) ||
+ (!CanObserveNonWord32(use) ||
NodeProperties::GetType(node)->Is(Type::Unsigned32()));
}
- bool CanLowerToUint32AdditiveBinop(Node* node, MachineTypeUnion use) {
- return BothInputsAre(node, safe_int_additive_range_) &&
- !CanObserveNonUint32(use);
- }
-
bool CanObserveNonWord32(MachineTypeUnion use) {
- return (use & ~(kTypeUint32 | kTypeInt32)) != 0;
- }
-
- bool CanObserveNonInt32(MachineTypeUnion use) {
- return (use & (kTypeUint32 | kTypeNumber | kTypeAny)) != 0;
+ return (use & kTypeMask & ~(kTypeInt32 | kTypeUint32)) != 0;
}
bool CanObserveMinusZero(MachineTypeUnion use) {
@@ -511,10 +502,6 @@ class RepresentationSelector {
return (use & (kTypeNumber | kTypeAny)) != 0;
}
- bool CanObserveNonUint32(MachineTypeUnion use) {
- return (use & (kTypeInt32 | kTypeNumber | kTypeAny)) != 0;
- }
-
// Dispatching routine for visiting the node {node} with the usage {use}.
// Depending on the operator, propagate new usage info to the inputs.
void VisitNode(Node* node, MachineTypeUnion use,
@@ -644,22 +631,16 @@ class RepresentationSelector {
// => signed Int32Add/Sub
VisitInt32Binop(node);
if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
- } else if (CanLowerToInt32AdditiveBinop(node, use)) {
- // => signed Int32Add/Sub, truncating inputs
- ProcessTruncateWord32Input(node, 0, kTypeInt32);
- ProcessTruncateWord32Input(node, 1, kTypeInt32);
- SetOutput(node, kMachInt32);
- if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
} else if (CanLowerToUint32Binop(node, use)) {
// => unsigned Int32Add/Sub
VisitUint32Binop(node);
if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node));
- } else if (CanLowerToUint32AdditiveBinop(node, use)) {
+ } else if (CanLowerToWord32AdditiveBinop(node, use)) {
// => signed Int32Add/Sub, truncating inputs
- ProcessTruncateWord32Input(node, 0, kTypeUint32);
- ProcessTruncateWord32Input(node, 1, kTypeUint32);
- SetOutput(node, kMachUint32);
- if (lower()) NodeProperties::ChangeOp(node, Uint32Op(node));
+ ProcessTruncateWord32Input(node, 0, kTypeInt32);
+ ProcessTruncateWord32Input(node, 1, kTypeInt32);
+ SetOutput(node, kMachInt32);
+ if (lower()) NodeProperties::ChangeOp(node, Int32Op(node));
} else {
// => Float64Add/Sub
VisitFloat64Binop(node);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698