Chromium Code Reviews| Index: runtime/vm/intrinsifier_ia32.cc |
| diff --git a/runtime/vm/intrinsifier_ia32.cc b/runtime/vm/intrinsifier_ia32.cc |
| index 251ba782474e3e31120821250e107478322d08db..5f59d6facb17c15d5ad2330429dd65b6f8d91732 100644 |
| --- a/runtime/vm/intrinsifier_ia32.cc |
| +++ b/runtime/vm/intrinsifier_ia32.cc |
| @@ -1087,6 +1087,22 @@ void Intrinsifier::Smi_bitNegate(Assembler* assembler) { |
| } |
| +void Intrinsifier::Smi_bitLength(Assembler* assembler) { |
|
srdjan
2013/09/06 15:35:34
How does optimized code compare, is intrinsified m
sra1
2013/09/06 22:11:57
It appears to be worthwhile.
The release build is
|
| + ASSERT(kSmiTagShift == 1); |
| + __ movl(EAX, Address(ESP, + 1 * kWordSize)); // Index. |
| + // XOR with sign bit to complement bits if value is negative. |
| + __ movl(ECX, EAX); |
| + __ sarl(ECX, Immediate(31)); // All 0 or all 1. |
| + __ xorl(EAX, ECX); |
| + // BSR does not write the destination register if source is zero. Put a 1 in |
| + // the Smi tag bit to ensure BSR writes to destination register. |
| + __ orl(EAX, Immediate(kSmiTagMask)); |
| + __ bsrl(EAX, EAX); |
| + __ SmiTag(EAX); |
| + __ ret(); |
| +} |
| + |
| + |
| // Check if the last argument is a double, jump to label 'is_smi' if smi |
| // (easy to convert to double), otherwise jump to label 'not_double_smi', |
| // Returns the last argument in EAX. |