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

Side by Side Diff: src/arm/codegen-arm.cc

Issue 2873001: ARM: Special case for modulus of two smis in the generic binary opration stub... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 &not_smi, 8192 &not_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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698