Index: src/arm64/lithium-codegen-arm64.cc |
diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc |
index 1e4754affc2d6e986c4b2845061618ff7ec6d017..ff741411be8c3dd9f482769f9148f0c118cd40a9 100644 |
--- a/src/arm64/lithium-codegen-arm64.cc |
+++ b/src/arm64/lithium-codegen-arm64.cc |
@@ -1276,6 +1276,21 @@ Handle<Object> LCodeGen::ToHandle(LConstantOperand* op) const { |
} |
+template<class LI> |
+Operand LCodeGen::ToShiftedRightOperand32(LOperand* right, LI* shift_info, |
+ IntegerSignedness signedness) { |
+ if (shift_info->shift() == NO_SHIFT) { |
+ return (signedness == SIGNED_INT32) ? ToOperand32I(right) |
+ : ToOperand32U(right); |
+ } else { |
+ return Operand( |
+ ToRegister32(right), |
+ shift_info->shift(), |
+ JSShiftAmountFromLConstant(shift_info->shift_amount())); |
+ } |
+} |
+ |
+ |
bool LCodeGen::IsSmi(LConstantOperand* op) const { |
return chunk_->LookupLiteralRepresentation(op).IsSmi(); |
} |
@@ -1472,7 +1487,8 @@ void LCodeGen::DoAddI(LAddI* instr) { |
bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); |
Register result = ToRegister32(instr->result()); |
Register left = ToRegister32(instr->left()); |
- Operand right = ToOperand32I(instr->right()); |
+ Operand right = ToShiftedRightOperand32I(instr->right(), instr); |
+ |
if (can_overflow) { |
__ Adds(result, left, right); |
DeoptimizeIf(vs, instr->environment()); |
@@ -1750,7 +1766,7 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) { |
void LCodeGen::DoBitI(LBitI* instr) { |
Register result = ToRegister32(instr->result()); |
Register left = ToRegister32(instr->left()); |
- Operand right = ToOperand32U(instr->right()); |
+ Operand right = ToShiftedRightOperand32U(instr->right(), instr); |
switch (instr->op()) { |
case Token::BIT_AND: __ And(result, left, right); break; |
@@ -4819,7 +4835,7 @@ void LCodeGen::DoShiftI(LShiftI* instr) { |
} |
} else { |
ASSERT(right_op->IsConstantOperand()); |
- int shift_count = ToInteger32(LConstantOperand::cast(right_op)) & 0x1f; |
+ int shift_count = JSShiftAmountFromLConstant(right_op); |
if (shift_count == 0) { |
if ((instr->op() == Token::SHR) && instr->can_deopt()) { |
DeoptimizeIfNegative(left, instr->environment()); |
@@ -4882,7 +4898,7 @@ void LCodeGen::DoShiftS(LShiftS* instr) { |
} |
} else { |
ASSERT(right_op->IsConstantOperand()); |
- int shift_count = ToInteger32(LConstantOperand::cast(right_op)) & 0x1f; |
+ int shift_count = JSShiftAmountFromLConstant(right_op); |
if (shift_count == 0) { |
if ((instr->op() == Token::SHR) && instr->can_deopt()) { |
DeoptimizeIfNegative(left, instr->environment()); |
@@ -5478,7 +5494,8 @@ void LCodeGen::DoSubI(LSubI* instr) { |
bool can_overflow = instr->hydrogen()->CheckFlag(HValue::kCanOverflow); |
Register result = ToRegister32(instr->result()); |
Register left = ToRegister32(instr->left()); |
- Operand right = ToOperand32I(instr->right()); |
+ Operand right = ToShiftedRightOperand32I(instr->right(), instr); |
+ |
if (can_overflow) { |
__ Subs(result, left, right); |
DeoptimizeIf(vs, instr->environment()); |