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

Unified Diff: src/arm/code-stubs-arm.cc

Issue 6625084: ARM: Improved double to integer truncation.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 9 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 | « src/arm/assembler-arm.cc ('k') | src/arm/constants-arm.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/code-stubs-arm.cc
===================================================================
--- src/arm/code-stubs-arm.cc (revision 7157)
+++ src/arm/code-stubs-arm.cc (working copy)
@@ -635,66 +635,15 @@
__ jmp(&done);
__ bind(&not_in_int32_range);
- __ ldr(scratch2, FieldMemOperand(object, HeapNumber::kExponentOffset));
- __ ldr(scratch1, FieldMemOperand(object, HeapNumber::kMantissaOffset));
+ __ ldr(scratch1, FieldMemOperand(object, HeapNumber::kExponentOffset));
+ __ ldr(scratch2, FieldMemOperand(object, HeapNumber::kMantissaOffset));
- // Register scratch1 contains mantissa word, scratch2 contains
- // sign, exponent and mantissa. Extract biased exponent into dst.
- __ Ubfx(dst,
- scratch2,
- HeapNumber::kExponentShift,
- HeapNumber::kExponentBits);
-
- // Express exponent as delta to 31.
- __ sub(dst, dst, Operand(HeapNumber::kExponentBias + 31));
-
- Label normal_exponent;
- // If the delta is larger than kMantissaBits plus one, all bits
- // would be shifted away, which means that we can return 0.
- __ cmp(dst, Operand(HeapNumber::kMantissaBits + 1));
- __ b(&normal_exponent, lt);
- __ mov(dst, Operand(0));
+ __ EmitOutOfInt32RangeTruncate(dst,
+ scratch1,
+ scratch2,
+ scratch3);
__ jmp(&done);
- __ bind(&normal_exponent);
- const int kShiftBase = HeapNumber::kNonMantissaBitsInTopWord - 1;
- // Calculate shift.
- __ add(scratch3, dst, Operand(kShiftBase));
-
- // Put implicit 1 before the mantissa part in scratch2.
- __ orr(scratch2,
- scratch2,
- Operand(1 << HeapNumber::kMantissaBitsInTopWord));
-
- // Save sign.
- Register sign = dst;
- __ and_(sign, scratch2, Operand(HeapNumber::kSignMask));
-
- // Shift mantisssa bits the correct position in high word.
- __ mov(scratch2, Operand(scratch2, LSL, scratch3));
-
- // Replace the shifted bits with bits from the lower mantissa word.
- Label pos_shift, shift_done;
- __ rsb(scratch3, scratch3, Operand(32), SetCC);
- __ b(&pos_shift, ge);
-
- // Negate scratch3.
- __ rsb(scratch3, scratch3, Operand(0));
- __ mov(scratch1, Operand(scratch1, LSL, scratch3));
- __ jmp(&shift_done);
-
- __ bind(&pos_shift);
- __ mov(scratch1, Operand(scratch1, LSR, scratch3));
-
- __ bind(&shift_done);
- __ orr(scratch2, scratch2, Operand(scratch1));
-
- // Restore sign if necessary.
- __ cmp(sign, Operand(0));
- __ rsb(dst, scratch2, Operand(0), LeaveCC, ne);
- __ mov(dst, scratch2, LeaveCC, eq);
- __ jmp(&done);
-
__ bind(&is_smi);
__ SmiUntag(dst, object);
__ bind(&done);
« no previous file with comments | « src/arm/assembler-arm.cc ('k') | src/arm/constants-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698