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

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

Issue 1588563002: [turbofan] Representation inference of shift should depends on the propagated type. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/simplified-lowering.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 c2c7457f3e5fd82438aedfd36fa62e516169dfdd..c75ea3d3069f0ed51317f2fa2bc0801ffef32a65 100644
--- a/src/compiler/simplified-lowering.cc
+++ b/src/compiler/simplified-lowering.cc
@@ -1046,21 +1046,30 @@ class RepresentationSelector {
break;
}
case IrOpcode::kNumberShiftLeft: {
+ Type* rhs_type = GetInfo(node->InputAt(1))->output_type();
VisitBinop(node, UseInfo::TruncatingWord32(),
UseInfo::TruncatingWord32(), NodeOutputInfo::Int32());
- if (lower()) lowering->DoShift(node, lowering->machine()->Word32Shl());
+ if (lower()) {
+ lowering->DoShift(node, lowering->machine()->Word32Shl(), rhs_type);
+ }
break;
}
case IrOpcode::kNumberShiftRight: {
+ Type* rhs_type = GetInfo(node->InputAt(1))->output_type();
VisitBinop(node, UseInfo::TruncatingWord32(),
UseInfo::TruncatingWord32(), NodeOutputInfo::Int32());
- if (lower()) lowering->DoShift(node, lowering->machine()->Word32Sar());
+ if (lower()) {
+ lowering->DoShift(node, lowering->machine()->Word32Sar(), rhs_type);
+ }
break;
}
case IrOpcode::kNumberShiftRightLogical: {
+ Type* rhs_type = GetInfo(node->InputAt(1))->output_type();
VisitBinop(node, UseInfo::TruncatingWord32(),
UseInfo::TruncatingWord32(), NodeOutputInfo::Uint32());
- if (lower()) lowering->DoShift(node, lowering->machine()->Word32Shr());
+ if (lower()) {
+ lowering->DoShift(node, lowering->machine()->Word32Shr(), rhs_type);
+ }
break;
}
case IrOpcode::kNumberToInt32: {
@@ -1406,7 +1415,7 @@ class RepresentationSelector {
replacement->op()->mnemonic());
if (replacement->id() < count_ &&
- GetInfo(replacement)->output_type() == GetInfo(node)->output_type()) {
+ GetInfo(node)->output_type()->Is(GetInfo(replacement)->output_type())) {
// Replace with a previously existing node eagerly only if the type is the
// same.
node->ReplaceUses(replacement);
@@ -1868,9 +1877,9 @@ Node* SimplifiedLowering::Uint32Mod(Node* const node) {
}
-void SimplifiedLowering::DoShift(Node* node, Operator const* op) {
+void SimplifiedLowering::DoShift(Node* node, Operator const* op,
+ Type* rhs_type) {
Node* const rhs = NodeProperties::GetValueInput(node, 1);
- Type* const rhs_type = NodeProperties::GetType(rhs);
if (!rhs_type->Is(type_cache_.kZeroToThirtyOne)) {
node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs,
jsgraph()->Int32Constant(0x1f)));
« no previous file with comments | « src/compiler/simplified-lowering.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698