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

Unified Diff: src/compiler/js-typed-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/js-typed-lowering.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-typed-lowering.cc
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc
index 2d1c89f98281867c969453436310c8d44f005aa9..051009dd6ea4b533f3b8a0b67b07467fb0a87d55 100644
--- a/src/compiler/js-typed-lowering.cc
+++ b/src/compiler/js-typed-lowering.cc
@@ -23,9 +23,6 @@ namespace compiler {
JSTypedLowering::JSTypedLowering(Editor* editor, JSGraph* jsgraph, Zone* zone)
: AdvancedReducer(editor), jsgraph_(jsgraph), simplified_(graph()->zone()) {
- zero_range_ = Type::Range(0.0, 0.0, graph()->zone());
- one_range_ = Type::Range(1.0, 1.0, graph()->zone());
- zero_thirtyone_range_ = Type::Range(0.0, 31.0, graph()->zone());
for (size_t k = 0; k < arraysize(shifted_int32_ranges_); ++k) {
double min = kMinInt / (1 << k);
double max = kMaxInt / (1 << k);
@@ -142,20 +139,6 @@ class JSBinopReduction final {
node_->ReplaceInput(1, ConvertToString(right()));
}
- // Convert inputs for bitwise shift operation (ES5 spec 11.7).
- void ConvertInputsForShift(Signedness left_signedness) {
- node_->ReplaceInput(0, ConvertToUI32(ConvertPlainPrimitiveToNumber(left()),
- left_signedness));
- Node* rnum =
- ConvertToUI32(ConvertPlainPrimitiveToNumber(right()), kUnsigned);
- Type* rnum_type = NodeProperties::GetBounds(rnum).upper;
- if (!rnum_type->Is(lowering_->zero_thirtyone_range_)) {
- rnum = graph()->NewNode(machine()->Word32And(), rnum,
- jsgraph()->Int32Constant(0x1F));
- }
- node_->ReplaceInput(1, rnum);
- }
-
void SwapInputs() {
Node* l = left();
Node* r = right();
@@ -488,14 +471,14 @@ Reduction JSTypedLowering::ReduceUI32Shift(Node* node,
JSBinopReduction r(this, node);
if (r.IsStrong()) {
if (r.BothInputsAre(Type::Number())) {
- r.ConvertInputsForShift(left_signedness);
+ r.ConvertInputsToUI32(left_signedness, kUnsigned);
return r.ChangeToPureOperator(shift_op);
}
return NoChange();
}
Node* frame_state = NodeProperties::GetFrameStateInput(node, 1);
r.ConvertInputsToNumber(frame_state);
- r.ConvertInputsForShift(left_signedness);
+ r.ConvertInputsToUI32(left_signedness, kUnsigned);
return r.ChangeToPureOperator(shift_op);
}
@@ -1612,11 +1595,12 @@ Reduction JSTypedLowering::Reduce(Node* node) {
case IrOpcode::kJSBitwiseAnd:
return ReduceInt32Binop(node, machine()->Word32And());
case IrOpcode::kJSShiftLeft:
- return ReduceUI32Shift(node, kSigned, machine()->Word32Shl());
+ return ReduceUI32Shift(node, kSigned, simplified()->NumberShiftLeft());
case IrOpcode::kJSShiftRight:
- return ReduceUI32Shift(node, kSigned, machine()->Word32Sar());
+ return ReduceUI32Shift(node, kSigned, simplified()->NumberShiftRight());
case IrOpcode::kJSShiftRightLogical:
- return ReduceUI32Shift(node, kUnsigned, machine()->Word32Shr());
+ return ReduceUI32Shift(node, kUnsigned,
+ simplified()->NumberShiftRightLogical());
case IrOpcode::kJSAdd:
return ReduceJSAdd(node);
case IrOpcode::kJSSubtract:
« no previous file with comments | « src/compiler/js-typed-lowering.h ('k') | src/compiler/opcodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698