OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 8146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8157 __ cmp(lhs, Operand(scratch, LSL, required_scratch_shift)); | 8157 __ cmp(lhs, Operand(scratch, LSL, required_scratch_shift)); |
8158 __ b(ne, &smi_is_unsuitable); // There was a remainder. | 8158 __ b(ne, &smi_is_unsuitable); // There was a remainder. |
8159 __ mov(result, Operand(scratch2, LSL, kSmiTagSize)); | 8159 __ mov(result, Operand(scratch2, LSL, kSmiTagSize)); |
8160 } else { | 8160 } else { |
8161 ASSERT(op_ == Token::MOD); | 8161 ASSERT(op_ == Token::MOD); |
8162 __ sub(result, lhs, Operand(scratch, LSL, required_scratch_shift)); | 8162 __ sub(result, lhs, Operand(scratch, LSL, required_scratch_shift)); |
8163 } | 8163 } |
8164 } | 8164 } |
8165 __ Ret(); | 8165 __ Ret(); |
8166 __ bind(&smi_is_unsuitable); | 8166 __ bind(&smi_is_unsuitable); |
| 8167 } else if (op_ == Token::MOD && |
| 8168 runtime_operands_type_ != BinaryOpIC::HEAP_NUMBERS && |
| 8169 runtime_operands_type_ != BinaryOpIC::STRINGS) { |
| 8170 // Do generate a bit of smi code for modulus even though the default for |
| 8171 // modulus is not to do it, but as the ARM processor has no coprocessor |
| 8172 // support for modulus checking for smis makes sense. |
| 8173 Label slow; |
| 8174 ASSERT(!ShouldGenerateSmiCode()); |
| 8175 ASSERT(kSmiTag == 0); // Adjust code below. |
| 8176 // Check for two positive smis. |
| 8177 __ orr(smi_test_reg, lhs, Operand(rhs)); |
| 8178 __ tst(smi_test_reg, Operand(0x80000000u | kSmiTagMask)); |
| 8179 __ b(ne, &slow); |
| 8180 // Check that rhs is a power of two and not zero. |
| 8181 __ sub(scratch, rhs, Operand(1), SetCC); |
| 8182 __ b(mi, &slow); |
| 8183 __ tst(rhs, scratch); |
| 8184 __ b(ne, &slow); |
| 8185 // Calculate power of two modulus. |
| 8186 __ and_(result, lhs, Operand(scratch)); |
| 8187 __ Ret(); |
| 8188 __ bind(&slow); |
8167 } | 8189 } |
8168 HandleBinaryOpSlowCases( | 8190 HandleBinaryOpSlowCases( |
8169 masm, | 8191 masm, |
8170 ¬_smi, | 8192 ¬_smi, |
8171 lhs, | 8193 lhs, |
8172 rhs, | 8194 rhs, |
8173 op_ == Token::MOD ? Builtins::MOD : Builtins::DIV); | 8195 op_ == Token::MOD ? Builtins::MOD : Builtins::DIV); |
8174 break; | 8196 break; |
8175 } | 8197 } |
8176 | 8198 |
(...skipping 2497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10674 __ bind(&string_add_runtime); | 10696 __ bind(&string_add_runtime); |
10675 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 10697 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
10676 } | 10698 } |
10677 | 10699 |
10678 | 10700 |
10679 #undef __ | 10701 #undef __ |
10680 | 10702 |
10681 } } // namespace v8::internal | 10703 } } // namespace v8::internal |
10682 | 10704 |
10683 #endif // V8_TARGET_ARCH_ARM | 10705 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |