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

Unified Diff: src/codegen-ia32.cc

Issue 18710: Optimizes check for Smi range in the code generator.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codegen-ia32.cc
===================================================================
--- src/codegen-ia32.cc (revision 1131)
+++ src/codegen-ia32.cc (working copy)
@@ -1127,9 +1127,11 @@
__ 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);
+ // This is the Smi check for the shifted result.
+ // After signed subtraction of 0xc0000000, the valid
+ // Smis are positive.
+ __ 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 +4276,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();
« 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