Reviewers: Kasper Lund, Description: Optimizes check for Smi range in the code generator. The check whether a 32-bit signed integer is in the Smi range is now Sign bit( value + 0x40000000 ) == 0, done with a single cmp instruction.
Please review this at http://codereview.chromium.org/18710 SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M src/codegen-ia32.cc Index: src/codegen-ia32.cc =================================================================== --- src/codegen-ia32.cc (revision 1131) +++ src/codegen-ia32.cc (working copy) @@ -1127,9 +1127,8 @@ __ j(not_zero, deferred->enter(), not_taken); __ sar(ebx, kSmiTagSize); __ shl(ebx, shift_value); - __ lea(ecx, Operand(ebx, 0x40000000)); - __ test(ecx, Immediate(0x80000000)); - __ j(not_zero, deferred->enter(), not_taken); + __ cmp(ebx, 0xC0000000); + __ j(sign, deferred->enter(), not_taken); // tag result and store it in TOS (eax) ASSERT(kSmiTagSize == times_2); // adjust code if not the case __ lea(eax, Operand(ebx, ebx, times_1, kSmiTag)); @@ -4274,9 +4273,8 @@ case Token::SHL: __ shl(eax); // Check that the *signed* result fits in a smi. - __ lea(ecx, Operand(eax, 0x40000000)); - __ test(ecx, Immediate(0x80000000)); - __ j(not_zero, slow, not_taken); + __ cmp(eax, 0xC0000000); + __ j(sign, slow, not_taken); break; default: UNREACHABLE(); --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
