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

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

Issue 1213803008: [turbofan] Right hand side of shifts needs ToUint32. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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') | src/compiler/simplified-operator.h » ('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 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));
« no previous file with comments | « src/compiler/simplified-lowering.h ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698