Chromium Code Reviews| Index: src/compiler/js-typed-lowering.cc |
| diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc |
| index b3fab5246577a0c1a4bad04ef283728cc019be0c..e84e6d09d721f203bc9495273da8d89fb8fe2b0e 100644 |
| --- a/src/compiler/js-typed-lowering.cc |
| +++ b/src/compiler/js-typed-lowering.cc |
| @@ -590,38 +590,43 @@ Reduction JSTypedLowering::ReduceInt32Binop(Node* node, const Operator* intOp) { |
| return r.ChangeToPureOperator(intOp, Type::Integral32()); |
| } |
| -Reduction JSTypedLowering::ReduceShiftLeft(Node* node) { |
| - if (flags() & kDisableIntegerBinaryOpReduction) return NoChange(); |
| +static const Operator* SpeculativeVersionOf( |
|
Benedikt Meurer
2016/07/28 16:43:02
Please make this a member function or even inline
epertoso
2016/07/29 09:35:13
Done.
|
| + SimplifiedOperatorBuilder* simplified, const Operator* shift_op, |
| + BinaryOperationHints::Hint feedback) { |
| + if (shift_op->opcode() == IrOpcode::kNumberShiftLeft) { |
| + return simplified->SpeculativeNumberShiftLeft(feedback); |
| + } else if (shift_op->opcode() == IrOpcode::kNumberShiftRightLogical) { |
| + return simplified->SpeculativeNumberShiftRightLogical(feedback); |
| + } else { |
| + DCHECK(shift_op->opcode() == IrOpcode::kNumberShiftRight); |
| + return simplified->SpeculativeNumberShiftRight(feedback); |
| + } |
| +} |
| +Reduction JSTypedLowering::ReduceUI32Shift(Node* node, |
| + Signedness left_signedness, |
| + const Operator* shift_op) { |
| + if (flags() & kDisableIntegerBinaryOpReduction) return NoChange(); |
| JSBinopReduction r(this, node); |
| BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); |
| if (feedback != BinaryOperationHints::kAny) { |
| return r.ChangeToSpeculativeOperator( |
| - simplified()->SpeculativeNumberShiftLeft(feedback), Type::Signed32()); |
| + SpeculativeVersionOf(simplified(), shift_op, feedback), |
| + shift_op->opcode() == IrOpcode::kNumberShiftRightLogical |
| + ? Type::Unsigned32() |
| + : Type::Signed32()); |
| } |
| // If deoptimization is enabled we rely on type feedback. |
| if (r.BothInputsAre(Type::PlainPrimitive()) || |
| !(flags() & kDeoptimizationEnabled)) { |
| r.ConvertInputsToNumber(); |
| - r.ConvertInputsToUI32(kSigned, kUnsigned); |
| - return r.ChangeToPureOperator(simplified()->NumberShiftLeft(), |
| - Type::Number()); |
| + r.ConvertInputsToUI32(left_signedness, kUnsigned); |
| + return r.ChangeToPureOperator(shift_op); |
| } |
| return NoChange(); |
| } |
| -Reduction JSTypedLowering::ReduceUI32Shift(Node* node, |
| - Signedness left_signedness, |
| - const Operator* shift_op) { |
| - if (flags() & kDisableIntegerBinaryOpReduction) return NoChange(); |
| - |
| - JSBinopReduction r(this, node); |
| - r.ConvertInputsToNumber(); |
| - r.ConvertInputsToUI32(left_signedness, kUnsigned); |
| - return r.ChangeToPureOperator(shift_op); |
| -} |
| - |
| Reduction JSTypedLowering::ReduceJSComparison(Node* node) { |
| JSBinopReduction r(this, node); |
| @@ -1970,7 +1975,7 @@ Reduction JSTypedLowering::Reduce(Node* node) { |
| case IrOpcode::kJSBitwiseAnd: |
| return ReduceInt32Binop(node, simplified()->NumberBitwiseAnd()); |
| case IrOpcode::kJSShiftLeft: |
| - return ReduceShiftLeft(node); |
| + return ReduceUI32Shift(node, kSigned, simplified()->NumberShiftLeft()); |
| case IrOpcode::kJSShiftRight: |
| return ReduceUI32Shift(node, kSigned, simplified()->NumberShiftRight()); |
| case IrOpcode::kJSShiftRightLogical: |