Index: src/compiler/simplified-lowering.cc |
diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc |
index 825de35aa5aa69deb8b085d31ac613b41e90c47b..68e7567a5c7ccd346d766fe29ab2b27ad2ee9f67 100644 |
--- a/src/compiler/simplified-lowering.cc |
+++ b/src/compiler/simplified-lowering.cc |
@@ -689,6 +689,21 @@ class RepresentationSelector { |
if (lower()) node->set_op(Float64Op(node)); |
break; |
} |
+ case IrOpcode::kNumberShiftLeft: { |
+ VisitBinop(node, kMachInt32, kMachUint32, kMachInt32); |
+ if (lower()) lowering->DoShift(node, lowering->machine()->Word32Shl()); |
+ break; |
+ } |
+ case IrOpcode::kNumberShiftRight: { |
+ VisitBinop(node, kMachInt32, kMachUint32, kMachInt32); |
+ if (lower()) lowering->DoShift(node, lowering->machine()->Word32Sar()); |
+ break; |
+ } |
+ case IrOpcode::kNumberShiftRightLogical: { |
+ VisitBinop(node, kMachUint32, kMachUint32, kMachUint32); |
+ if (lower()) lowering->DoShift(node, lowering->machine()->Word32Shr()); |
+ break; |
+ } |
case IrOpcode::kNumberToInt32: { |
MachineTypeUnion use_rep = use & kRepMask; |
Node* input = node->InputAt(0); |
@@ -1118,6 +1133,14 @@ Node* SimplifiedLowering::IsTagged(Node* node) { |
} |
+SimplifiedLowering::SimplifiedLowering(JSGraph* jsgraph, Zone* zone, |
+ SourcePositionTable* source_positions) |
+ : jsgraph_(jsgraph), |
+ zone_(zone), |
+ zero_thirtyone_range_(Type::Range(0, 31, zone)), |
+ source_positions_(source_positions) {} |
+ |
+ |
void SimplifiedLowering::LowerAllNodes() { |
SimplifiedOperatorBuilder simplified(graph()->zone()); |
RepresentationChanger changer(jsgraph(), &simplified, jsgraph()->isolate()); |
@@ -1576,6 +1599,17 @@ Node* SimplifiedLowering::Uint32Mod(Node* const node) { |
} |
+void SimplifiedLowering::DoShift(Node* node, Operator const* op) { |
+ node->set_op(op); |
+ Node* const rhs = NodeProperties::GetValueInput(node, 1); |
+ Type* const rhs_type = NodeProperties::GetBounds(rhs).upper; |
+ if (!rhs_type->Is(zero_thirtyone_range_)) { |
+ node->ReplaceInput(1, graph()->NewNode(machine()->Word32And(), rhs, |
+ jsgraph()->Int32Constant(0x1f))); |
+ } |
+} |
+ |
+ |
void SimplifiedLowering::DoStringEqual(Node* node) { |
node->set_op(machine()->WordEqual()); |
node->ReplaceInput(0, StringComparison(node, false)); |