Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index 201ecb26ff5ee483e56ed53bafd6094a89ba1abe..35e6a53066b2ea4e0dacddf90381861e115f8017 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -2130,7 +2130,14 @@ void BinaryOpStub_GenerateSmiCode( |
void BinaryOpStub::GenerateSmiStub(MacroAssembler* masm) { |
- Label not_smis, call_runtime; |
+ Label right_arg_changed, call_runtime; |
+ |
+ if (op_ == Token::MOD && has_fixed_right_arg_) { |
+ // It is guaranteed that the value will fit into a Smi, because if it |
+ // didn't, we wouldn't be here, see BinaryOp_Patch. |
+ __ cmp(r0, Operand(Smi::FromInt(fixed_right_arg_value()))); |
+ __ b(ne, &right_arg_changed); |
+ } |
if (result_type_ == BinaryOpIC::UNINITIALIZED || |
result_type_ == BinaryOpIC::SMI) { |
@@ -2147,6 +2154,7 @@ void BinaryOpStub::GenerateSmiStub(MacroAssembler* masm) { |
// Code falls through if the result is not returned as either a smi or heap |
// number. |
+ __ bind(&right_arg_changed); |
GenerateTypeTransition(masm); |
__ bind(&call_runtime); |
@@ -2318,6 +2326,9 @@ void BinaryOpStub::GenerateInt32Stub(MacroAssembler* masm) { |
// to type transition. |
} else { |
+ // TODO(svenpanne) We should check the right argument here, see the |
+ // beginning of GenerateSmiStub, but I can't figure out how... :-/ |
+ |
// We preserved r0 and r1 to be able to call runtime. |
// Save the left value on the stack. |
__ Push(r5, r4); |