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

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

Issue 1461963002: [turbofan] Simplify NumberTo(U)Int32 handling in representation inference. (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 | « src/compiler/representation-change.h ('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 3402607790e52ac593f8ca71f996fa13bd4681ff..cd434a470c36bc7618e2bcede456dde255d25a4d 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -840,32 +840,15 @@ class RepresentationSelector {
MachineTypeUnion use_rep = use & kRepMask;
Node* input = node->InputAt(0);
Type* in_upper = NodeProperties::GetType(input);
- MachineTypeUnion in = GetInfo(input)->output;
if (in_upper->Is(Type::Signed32())) {
// If the input has type int32, pass through representation.
VisitUnop(node, UseInfoFromRepresentation(use_rep),
kTypeInt32 | use_rep);
if (lower()) DeferReplacement(node, node->InputAt(0));
- } else if ((in & kTypeMask) == kTypeUint32 ||
- in_upper->Is(Type::Unsigned32())) {
- // Just change representation if necessary.
- VisitUnop(node, UseInfo::TruncatingWord32(), kTypeInt32 | kRepWord32);
- if (lower()) DeferReplacement(node, node->InputAt(0));
- } else if ((in & kTypeMask) == kTypeInt32 ||
- (in & kRepMask) == kRepWord32) {
+ } else {
// Just change representation if necessary.
- VisitUnop(node, UseInfo::TruncatingWord32(), kTypeInt32 | kRepWord32);
+ VisitUnop(node, UseInfo::TruncatingWord32(), kMachInt32);
if (lower()) DeferReplacement(node, node->InputAt(0));
- } else {
- // Require the input in float64 format and perform truncation.
- // TODO(turbofan): avoid a truncation with a smi check.
- VisitUnop(node, UseInfo::Float64TruncatingToWord32(),
- kTypeInt32 | kRepWord32);
- if (lower()) {
- NodeProperties::ChangeOp(
- node, lowering->machine()->TruncateFloat64ToInt32(
- TruncationMode::kJavaScript));
- }
}
break;
}
@@ -873,34 +856,15 @@ class RepresentationSelector {
MachineTypeUnion use_rep = use & kRepMask;
Node* input = node->InputAt(0);
Type* in_upper = NodeProperties::GetType(input);
- MachineTypeUnion in = GetInfo(input)->output;
if (in_upper->Is(Type::Unsigned32())) {
// If the input has type uint32, pass through representation.
VisitUnop(node, UseInfoFromRepresentation(use_rep),
kTypeUint32 | use_rep);
if (lower()) DeferReplacement(node, node->InputAt(0));
- } else if ((in & kTypeMask) == kTypeInt32 ||
- in_upper->Is(Type::Signed32())) {
- // Just change representation if necessary.
- VisitUnop(node, UseInfo::TruncatingWord32(),
- kTypeUint32 | kRepWord32);
- if (lower()) DeferReplacement(node, node->InputAt(0));
- } else if ((in & kTypeMask) == kTypeUint32 ||
- (in & kRepMask) == kRepWord32) {
+ } else {
// Just change representation if necessary.
- VisitUnop(node, UseInfo::TruncatingWord32(),
- kTypeUint32 | kRepWord32);
+ VisitUnop(node, UseInfo::TruncatingWord32(), kMachUint32);
if (lower()) DeferReplacement(node, node->InputAt(0));
- } else {
- // Require the input in float64 format and perform truncation.
- // TODO(turbofan): avoid a truncation with a smi check.
- VisitUnop(node, UseInfo::Float64TruncatingToWord32(),
- kTypeUint32 | kRepWord32);
- if (lower()) {
- NodeProperties::ChangeOp(
- node, lowering->machine()->TruncateFloat64ToInt32(
- TruncationMode::kJavaScript));
- }
}
break;
}
« no previous file with comments | « src/compiler/representation-change.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698