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

Side by Side Diff: src/arm/stub-cache-arm.cc

Issue 6368053: Implements DoubleToI on ARM. Refactor some VFP code at the same time and... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 10 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
OLDNEW
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 2037 matching lines...) Expand 10 before | Expand all | Expand 10 after
2048 2048
2049 // Backup FPSCR. 2049 // Backup FPSCR.
2050 __ vmrs(r3); 2050 __ vmrs(r3);
2051 // Set custom FPCSR: 2051 // Set custom FPCSR:
2052 // - Set rounding mode to "Round towards Minus Infinity" 2052 // - Set rounding mode to "Round towards Minus Infinity"
2053 // (ie bits [23:22] = 0b10). 2053 // (ie bits [23:22] = 0b10).
2054 // - Clear vfp cumulative exception flags (bits [3:0]). 2054 // - Clear vfp cumulative exception flags (bits [3:0]).
2055 // - Make sure Flush-to-zero mode control bit is unset (bit 22). 2055 // - Make sure Flush-to-zero mode control bit is unset (bit 22).
2056 __ bic(r9, r3, 2056 __ bic(r9, r3,
2057 Operand(kVFPExceptionMask | kVFPRoundingModeMask | kVFPFlushToZeroMask)); 2057 Operand(kVFPExceptionMask | kVFPRoundingModeMask | kVFPFlushToZeroMask));
2058 __ orr(r9, r9, Operand(kVFPRoundToMinusInfinityBits)); 2058 __ orr(r9, r9, Operand(kRoundToMinusInf));
2059 __ vmsr(r9); 2059 __ vmsr(r9);
2060 2060
2061 // Convert the argument to an integer. 2061 // Convert the argument to an integer.
2062 __ vcvt_s32_f64(s0, d1, Assembler::FPSCRRounding, al); 2062 __ vcvt_s32_f64(s0, d1, kFPSCRRounding);
2063 2063
2064 // Use vcvt latency to start checking for special cases. 2064 // Use vcvt latency to start checking for special cases.
2065 // Get the argument exponent and clear the sign bit. 2065 // Get the argument exponent and clear the sign bit.
2066 __ bic(r6, r5, Operand(HeapNumber::kSignMask)); 2066 __ bic(r6, r5, Operand(HeapNumber::kSignMask));
2067 __ mov(r6, Operand(r6, LSR, HeapNumber::kMantissaBitsInTopWord)); 2067 __ mov(r6, Operand(r6, LSR, HeapNumber::kMantissaBitsInTopWord));
2068 2068
2069 // Retrieve FPSCR and check for vfp exceptions. 2069 // Retrieve FPSCR and check for vfp exceptions.
2070 __ vmrs(r9); 2070 __ vmrs(r9);
2071 __ tst(r9, Operand(kVFPExceptionMask)); 2071 __ tst(r9, Operand(kVFPExceptionMask));
2072 __ b(&no_vfp_exception, eq); 2072 __ b(&no_vfp_exception, eq);
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
3757 __ sub(r5, value, Operand(kHeapObjectTag)); 3757 __ sub(r5, value, Operand(kHeapObjectTag));
3758 __ vldr(d0, r5, HeapNumber::kValueOffset); 3758 __ vldr(d0, r5, HeapNumber::kValueOffset);
3759 3759
3760 __ Sbfx(r6, r6, HeapNumber::kExponentShift, HeapNumber::kExponentBits); 3760 __ Sbfx(r6, r6, HeapNumber::kExponentShift, HeapNumber::kExponentBits);
3761 // NaNs and Infinities have all-one exponents so they sign extend to -1. 3761 // NaNs and Infinities have all-one exponents so they sign extend to -1.
3762 __ cmp(r6, Operand(-1)); 3762 __ cmp(r6, Operand(-1));
3763 __ mov(r5, Operand(0), LeaveCC, eq); 3763 __ mov(r5, Operand(0), LeaveCC, eq);
3764 3764
3765 // Not infinity or NaN simply convert to int. 3765 // Not infinity or NaN simply convert to int.
3766 if (IsElementTypeSigned(array_type)) { 3766 if (IsElementTypeSigned(array_type)) {
3767 __ vcvt_s32_f64(s0, d0, Assembler::RoundToZero, ne); 3767 __ vcvt_s32_f64(s0, d0, kDefaultRoundToZero, ne);
3768 } else { 3768 } else {
3769 __ vcvt_u32_f64(s0, d0, Assembler::RoundToZero, ne); 3769 __ vcvt_u32_f64(s0, d0, kDefaultRoundToZero, ne);
3770 } 3770 }
3771 __ vmov(r5, s0, ne); 3771 __ vmov(r5, s0, ne);
3772 3772
3773 switch (array_type) { 3773 switch (array_type) {
3774 case kExternalByteArray: 3774 case kExternalByteArray:
3775 case kExternalUnsignedByteArray: 3775 case kExternalUnsignedByteArray:
3776 __ strb(r5, MemOperand(r3, r4, LSL, 0)); 3776 __ strb(r5, MemOperand(r3, r4, LSL, 0));
3777 break; 3777 break;
3778 case kExternalShortArray: 3778 case kExternalShortArray:
3779 case kExternalUnsignedShortArray: 3779 case kExternalUnsignedShortArray:
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
3934 3934
3935 return GetCode(flags); 3935 return GetCode(flags);
3936 } 3936 }
3937 3937
3938 3938
3939 #undef __ 3939 #undef __
3940 3940
3941 } } // namespace v8::internal 3941 } } // namespace v8::internal
3942 3942
3943 #endif // V8_TARGET_ARCH_ARM 3943 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698