Changeset 94452 in webkit for trunk/Source/JavaScriptCore/wtf
- Timestamp:
- Sep 2, 2011, 3:09:34 PM (14 years ago)
- Location:
- trunk/Source/JavaScriptCore/wtf
- Files:
-
- 22 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/wtf/CMakeLists.txt
r92974 r94452 100 100 dtoa.h 101 101 102 dtoa/bignum-dtoa.h 103 dtoa/bignum.h 104 dtoa/cached-powers.h 105 dtoa/diy-fp.h 106 dtoa/double-conversion.h 107 dtoa/double.h 108 dtoa/fast-dtoa.h 109 dtoa/fixed-dtoa.h 110 dtoa/strtod.h 111 dtoa/utils.h 112 113 dtoa/bignum-dtoa.h 114 dtoa/bignum.h 115 dtoa/cached-powers.h 116 dtoa/diy-fp.h 117 dtoa/double-conversion.h 118 dtoa/double.h 119 dtoa/fast-dtoa.h 120 dtoa/fixed-dtoa.h 121 dtoa/strtod.h 122 dtoa/utils.h 123 102 124 text/AtomicString.h 103 125 text/AtomicStringImpl.h … … 141 163 dtoa.cpp 142 164 165 dtoa/bignum-dtoa.cc 166 dtoa/bignum.cc 167 dtoa/cached-powers.cc 168 dtoa/diy-fp.cc 169 dtoa/double-conversion.cc 170 dtoa/fast-dtoa.cc 171 dtoa/fixed-dtoa.cc 172 dtoa/strtod.cc 173 174 dtoa/bignum-dtoa.cc 175 dtoa/bignum.cc 176 dtoa/cached-powers.cc 177 dtoa/diy-fp.cc 178 dtoa/double-conversion.cc 179 dtoa/fast-dtoa.cc 180 dtoa/fixed-dtoa.cc 181 dtoa/strtod.cc 182 143 183 text/AtomicString.cpp 144 184 text/CString.cpp … … 155 195 "${JAVASCRIPTCORE_DIR}/wtf" 156 196 "${JAVASCRIPTCORE_DIR}/wtf/unicode" 197 "${JAVASCRIPTCORE_DIR}/wtf/dtoa" 157 198 "${JavaScriptCore_INCLUDE_DIRECTORIES}" 158 199 ) -
trunk/Source/JavaScriptCore/wtf/ThreadingPthreads.cpp
r94191 r94452 36 36 #include "DateMath.h" 37 37 #include "dtoa.h" 38 #include "dtoa/cached-powers.h" 38 39 #include "HashMap.h" 39 40 #include "RandomNumberSeed.h" … … 74 75 return; 75 76 77 WTF::double_conversion::initialize(); 76 78 // StringImpl::empty() does not construct its static string in a threadsafe fashion, 77 79 // so ensure it has been initialized from here. -
trunk/Source/JavaScriptCore/wtf/ThreadingWin.cpp
r91906 r94452 88 88 #include "DateMath.h" 89 89 #include "dtoa.h" 90 #include "dtoa/cached-powers.h" 90 91 91 92 #include "MainThread.h" … … 164 165 return; 165 166 167 WTF::double_conversion::initialize(); 166 168 // StringImpl::empty() does not construct its static string in a threadsafe fashion, 167 169 // so ensure it has been initialized from here. -
trunk/Source/JavaScriptCore/wtf/dtoa.cpp
r93017 r94452 76 76 #include <wtf/AlwaysInline.h> 77 77 #include <wtf/Assertions.h> 78 #include <wtf/DecimalNumber.h>79 78 #include <wtf/FastMalloc.h> 80 79 #include <wtf/MathExtras.h> … … 82 81 #include <wtf/UnusedParam.h> 83 82 #include <wtf/Vector.h> 83 #include <wtf/dtoa/double-conversion.h> 84 84 85 85 #if COMPILER(MSVC) … … 1803 1803 } 1804 1804 1805 static ALWAYS_INLINE void copyAsciiToUTF16(UChar* next, const char* src, unsigned size) 1806 { 1807 for (unsigned i = 0; i < size; ++i) 1808 *next++ = *src++; 1809 } 1810 1811 unsigned numberToString(double d, NumberToStringBuffer buffer) 1812 { 1813 // Handle NaN and Infinity. 1814 if (!isfinite(d)) { 1815 if (isnan(d)) { 1816 copyAsciiToUTF16(buffer, "NaN", 3); 1817 return 3; 1818 } 1819 if (d > 0) { 1820 copyAsciiToUTF16(buffer, "Infinity", 8); 1821 return 8; 1822 } 1823 copyAsciiToUTF16(buffer, "-Infinity", 9); 1824 return 9; 1825 } 1826 1827 // Convert to decimal with rounding. 1828 DecimalNumber number(d); 1829 return number.exponent() >= -6 && number.exponent() < 21 1830 ? number.toStringDecimal(buffer, NumberToStringBufferLength) 1831 : number.toStringExponential(buffer, NumberToStringBufferLength); 1805 1806 const char *numberToString(double d, NumberToStringBuffer buffer) 1807 { 1808 double_conversion::StringBuilder builder(buffer, NumberToStringBufferLength); 1809 const double_conversion::DoubleToStringConverter& converter = double_conversion::DoubleToStringConverter::EcmaScriptConverter(); 1810 converter.ToShortest(d, &builder); 1811 return builder.Finalize(); 1832 1812 } 1833 1813 -
trunk/Source/JavaScriptCore/wtf/dtoa.h
r70198 r94452 22 22 #define WTF_dtoa_h 23 23 24 #include <wtf/dtoa/double-conversion.h> 24 25 #include <wtf/unicode/Unicode.h> 25 26 … … 29 30 extern WTF::Mutex* s_dtoaP5Mutex; 30 31 31 // s00: input string. Must not be 0 and must be terminated by 0.32 // se: *se will have the last consumed character position + 1.33 double strtod(const char* s00, char** se);34 35 32 typedef char DtoaBuffer[80]; 36 33 … … 39 36 void dtoaRoundDP(DtoaBuffer result, double dd, int ndigits, bool& sign, int& exponent, unsigned& precision); 40 37 38 // s00: input string. Must not be 0 and must be terminated by 0. 39 // se: *se will have the last consumed character position + 1. 40 double strtod(const char* s00, char** se); 41 41 42 // Size = 80 for sizeof(DtoaBuffer) + some sign bits, decimal point, 'e', exponent digits. 42 43 const unsigned NumberToStringBufferLength = 96; 43 typedef UChar NumberToStringBuffer[NumberToStringBufferLength]; 44 unsigned numberToString(double, NumberToStringBuffer); 44 typedef char NumberToStringBuffer[NumberToStringBufferLength]; 45 typedef UChar NumberToUStringBuffer[NumberToStringBufferLength]; 46 const char *numberToString(double, NumberToStringBuffer); 45 47 46 48 } // namespace WTF 47 49 48 50 using WTF::NumberToStringBuffer; 51 using WTF::NumberToUStringBuffer; 49 52 using WTF::numberToString; 50 53 -
trunk/Source/JavaScriptCore/wtf/wtf.pri
r94075 r94452 7 7 wtf/CurrentTime.cpp \ 8 8 wtf/DateMath.cpp \ 9 wtf/DecimalNumber.cpp \ 9 10 wtf/dtoa.cpp \ 10 wtf/DecimalNumber.cpp \ 11 wtf/dtoa/bignum-dtoa.cc \ 12 wtf/dtoa/bignum.cc \ 13 wtf/dtoa/cached-powers.cc \ 14 wtf/dtoa/diy-fp.cc \ 15 wtf/dtoa/double-conversion.cc \ 16 wtf/dtoa/fast-dtoa.cc \ 17 wtf/dtoa/fixed-dtoa.cc \ 18 wtf/dtoa/strtod.cc \ 11 19 wtf/FastMalloc.cpp \ 12 20 wtf/gobject/GOwnPtr.cpp \
Note:
See TracChangeset
for help on using the changeset viewer.