Title: [127991] trunk
Revision
127991
Author
par...@webkit.org
Date
2012-09-09 13:48:23 -0700 (Sun, 09 Sep 2012)

Log Message

Make the String initialization on the function side of String::number()
https://bugs.webkit.org/show_bug.cgi?id=95940

Reviewed by Benjamin Poulain.

Source/_javascript_Core:

* _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:

Source/WebKit2:

* win/WebKit2.def:
* win/WebKit2CFLite.def:

Source/WTF:

Un-Inline String::number() to make the String initialization done on the function side
instead of being on the caller side.

* GNUmakefile.list.am:
* WTF.gypi:
* WTF.pro:
* WTF.vcproj/WTF.vcproj:
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/text/IntegerToStringConversion.cpp: Removed.
* wtf/text/IntegerToStringConversion.h:
(WTF::numberToStringImpl):
(WTF::numberToStringSigned):
(WTF::numberToStringUnsigned):
* wtf/text/WTFString.cpp:
(WTF::String::number):
* wtf/text/WTFString.h:

Tools:

* TestWebKitAPI/Tests/WTF/IntegerToStringConversion.cpp:
(testBoundaries):
(testNumbers):

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (127990 => 127991)


--- trunk/Source/_javascript_Core/ChangeLog	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-09-09 20:48:23 UTC (rev 127991)
@@ -1,3 +1,12 @@
+2012-09-09  Patrick Gansterer  <par...@webkit.org>
+
+        Make the String initialization on the function side of String::number()
+        https://bugs.webkit.org/show_bug.cgi?id=95940
+
+        Reviewed by Benjamin Poulain.
+
+        * _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
+
 2012-09-09  Geoffrey Garen  <gga...@apple.com>
 
         Rolled out <http://trac.webkit.org/changeset/127939> because it broke

Modified: trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def (127990 => 127991)


--- trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/_javascript_Core/_javascript_Core.vcproj/_javascript_Core/_javascript_Core.def	2012-09-09 20:48:23 UTC (rev 127991)
@@ -253,16 +253,9 @@
     ?notifyWriteSlow@SymbolTableEntry@JSC@@AAEXXZ
     ?notifyWriteSlow@WatchpointSet@JSC@@QAEXXZ
     ?nullptr@@3Vnullptr_t@std@@A
-    ?number@String@WTF@@SA?AV12@NII@Z
     ?numberToFixedPrecisionString@WTF@@YAPBDNIQAD_N@Z
     ?numberToFixedWidthString@WTF@@YAPBDNIQAD@Z
     ?numberToString@WTF@@YAPBDNQAD@Z
-    ?numberToStringImpl@WTF@@YA?AV?$PassRefPtr@VStringImpl@WTF@@@1@_J@Z
-    ?numberToStringImpl@WTF@@YA?AV?$PassRefPtr@VStringImpl@WTF@@@1@_K@Z
-    ?numberToStringImpl@WTF@@YA?AV?$PassRefPtr@VStringImpl@WTF@@@1@H@Z
-    ?numberToStringImpl@WTF@@YA?AV?$PassRefPtr@VStringImpl@WTF@@@1@I@Z
-    ?numberToStringImpl@WTF@@YA?AV?$PassRefPtr@VStringImpl@WTF@@@1@J@Z
-    ?numberToStringImpl@WTF@@YA?AV?$PassRefPtr@VStringImpl@WTF@@@1@K@Z
     ?objectAtScope@JSScope@JSC@@SAPAVJSObject@2@PAV12@@Z
     ?objectCount@Heap@JSC@@QAEIXZ
     ?objectProtoFuncToString@JSC@@YI_JPAVExecState@1@@Z

Modified: trunk/Source/WTF/ChangeLog (127990 => 127991)


--- trunk/Source/WTF/ChangeLog	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WTF/ChangeLog	2012-09-09 20:48:23 UTC (rev 127991)
@@ -1,3 +1,28 @@
+2012-09-09  Patrick Gansterer  <par...@webkit.org>
+
+        Make the String initialization on the function side of String::number()
+        https://bugs.webkit.org/show_bug.cgi?id=95940
+
+        Reviewed by Benjamin Poulain.
+
+        Un-Inline String::number() to make the String initialization done on the function side
+        instead of being on the caller side.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/text/IntegerToStringConversion.cpp: Removed.
+        * wtf/text/IntegerToStringConversion.h:
+        (WTF::numberToStringImpl):
+        (WTF::numberToStringSigned):
+        (WTF::numberToStringUnsigned):
+        * wtf/text/WTFString.cpp:
+        (WTF::String::number):
+        * wtf/text/WTFString.h:
+
 2012-09-08  Andreas Kling  <kl...@webkit.org>
 
         Give AtomicString SimpleClassVectorTraits.

Modified: trunk/Source/WTF/GNUmakefile.list.am (127990 => 127991)


--- trunk/Source/WTF/GNUmakefile.list.am	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WTF/GNUmakefile.list.am	2012-09-09 20:48:23 UTC (rev 127991)
@@ -208,7 +208,6 @@
     Source/WTF/wtf/text/Base64.h \
     Source/WTF/wtf/text/CString.cpp \
     Source/WTF/wtf/text/CString.h \
-    Source/WTF/wtf/text/IntegerToStringConversion.cpp \
     Source/WTF/wtf/text/IntegerToStringConversion.h \
     Source/WTF/wtf/text/StringBuffer.h \
     Source/WTF/wtf/text/StringBuilder.cpp \

Modified: trunk/Source/WTF/WTF.gypi (127990 => 127991)


--- trunk/Source/WTF/WTF.gypi	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WTF/WTF.gypi	2012-09-09 20:48:23 UTC (rev 127991)
@@ -224,7 +224,6 @@
             'wtf/text/AtomicString.cpp',
             'wtf/text/Base64.cpp',
             'wtf/text/CString.cpp',
-            'wtf/text/IntegerToStringConversion.cpp',
             'wtf/text/StringBuilder.cpp',
             'wtf/text/StringImpl.cpp',
             'wtf/text/StringStatics.cpp',

Modified: trunk/Source/WTF/WTF.pro (127990 => 127991)


--- trunk/Source/WTF/WTF.pro	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WTF/WTF.pro	2012-09-09 20:48:23 UTC (rev 127991)
@@ -219,7 +219,6 @@
     text/AtomicString.cpp \
     text/Base64.cpp \
     text/CString.cpp \
-    text/IntegerToStringConversion.cpp \
     text/StringBuilder.cpp \
     text/StringImpl.cpp \
     text/StringStatics.cpp \

Modified: trunk/Source/WTF/WTF.vcproj/WTF.vcproj (127990 => 127991)


--- trunk/Source/WTF/WTF.vcproj/WTF.vcproj	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WTF/WTF.vcproj/WTF.vcproj	2012-09-09 20:48:23 UTC (rev 127991)
@@ -424,10 +424,6 @@
 				>
 			</File>
 			<File
-				RelativePath="..\wtf\text\IntegerToStringConversion.cpp"
-				>
-			</File>
-			<File
 				RelativePath="..\wtf\text\IntegerToStringConversion.h"
 				>
 			</File>

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (127990 => 127991)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2012-09-09 20:48:23 UTC (rev 127991)
@@ -11,7 +11,6 @@
 		143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 143F611D1565F0F900DB514A /* RAMSize.cpp */; };
 		143F61201565F0F900DB514A /* RAMSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 143F611E1565F0F900DB514A /* RAMSize.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		14F3B0F715E45E4600210069 /* SaturatedArithmetic.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		26147B0915DDCCDC00DDB907 /* IntegerToStringConversion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26147B0715DDCCDC00DDB907 /* IntegerToStringConversion.cpp */; };
 		26147B0A15DDCCDC00DDB907 /* IntegerToStringConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */; };
 		2C05385415BC819000F21B96 /* GregorianDateTime.h in Headers */ = {isa = PBXBuildFile; fileRef = 2C05385315BC819000F21B96 /* GregorianDateTime.h */; };
 		2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CCD892915C0390200285083 /* GregorianDateTime.cpp */; };
@@ -258,7 +257,6 @@
 		143F611D1565F0F900DB514A /* RAMSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RAMSize.cpp; sourceTree = "<group>"; };
 		143F611E1565F0F900DB514A /* RAMSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAMSize.h; sourceTree = "<group>"; };
 		14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SaturatedArithmetic.h; sourceTree = "<group>"; };
-		26147B0715DDCCDC00DDB907 /* IntegerToStringConversion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntegerToStringConversion.cpp; sourceTree = "<group>"; };
 		26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IntegerToStringConversion.h; sourceTree = "<group>"; };
 		2C05385315BC819000F21B96 /* GregorianDateTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GregorianDateTime.h; sourceTree = "<group>"; };
 		2CCD892915C0390200285083 /* GregorianDateTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GregorianDateTime.cpp; sourceTree = "<group>"; };
@@ -795,7 +793,6 @@
 				8134013715B092FD001FF0B8 /* Base64.h */,
 				A8A47321151A825B004123FF /* CString.cpp */,
 				A8A47322151A825B004123FF /* CString.h */,
-				26147B0715DDCCDC00DDB907 /* IntegerToStringConversion.cpp */,
 				26147B0815DDCCDC00DDB907 /* IntegerToStringConversion.h */,
 				A8A47323151A825B004123FF /* StringBuffer.h */,
 				A8A47324151A825B004123FF /* StringBuilder.cpp */,
@@ -1188,7 +1185,6 @@
 				A8A473B5151A825B004123FF /* fixed-dtoa.cc in Sources */,
 				2CCD892A15C0390200285083 /* GregorianDateTime.cpp in Sources */,
 				A8A473D8151A825B004123FF /* HashTable.cpp in Sources */,
-				26147B0915DDCCDC00DDB907 /* IntegerToStringConversion.cpp in Sources */,
 				A8A473E5151A825B004123FF /* MainThread.cpp in Sources */,
 				A8A473E4151A825B004123FF /* MainThreadMac.mm in Sources */,
 				CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */,

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (127990 => 127991)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2012-09-09 20:48:23 UTC (rev 127991)
@@ -183,7 +183,6 @@
     text/AtomicString.cpp
     text/Base64.cpp
     text/CString.cpp
-    text/IntegerToStringConversion.cpp
     text/StringBuilder.cpp
     text/StringImpl.cpp
     text/StringStatics.cpp

Deleted: trunk/Source/WTF/wtf/text/IntegerToStringConversion.cpp (127990 => 127991)


--- trunk/Source/WTF/wtf/text/IntegerToStringConversion.cpp	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WTF/wtf/text/IntegerToStringConversion.cpp	2012-09-09 20:48:23 UTC (rev 127991)
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All Rights Reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "IntegerToStringConversion.h"
-
-#include <wtf/text/StringImpl.h>
-
-namespace WTF {
-
-template<typename T> struct UnsignedIntegerTrait;
-
-template<> struct UnsignedIntegerTrait<short> {
-    typedef unsigned short Type;
-};
-template<> struct UnsignedIntegerTrait<int> {
-    typedef unsigned int Type;
-};
-template<> struct UnsignedIntegerTrait<long> {
-    typedef unsigned long Type;
-};
-template<> struct UnsignedIntegerTrait<long long> {
-    typedef unsigned long long Type;
-};
-
-template<typename SignedIntegerType>
-static PassRefPtr<StringImpl> numberToStringImplSigned(SignedIntegerType integer)
-{
-    LChar buf[1 + sizeof(SignedIntegerType) * 3];
-    LChar* end = buf + WTF_ARRAY_LENGTH(buf);
-    LChar* p = end;
-
-    bool negative = false;
-    typename UnsignedIntegerTrait<SignedIntegerType>::Type unsignedInteger;
-    if (integer < 0) {
-        negative = true;
-        unsignedInteger = -integer;
-    } else
-        unsignedInteger = integer;
-
-    do {
-        *--p = static_cast<LChar>((unsignedInteger % 10) + '0');
-        unsignedInteger /= 10;
-    } while (unsignedInteger);
-
-    if (negative)
-        *--p = '-';
-
-    return StringImpl::create(p, static_cast<unsigned>(end - p));
-}
-
-PassRefPtr<StringImpl> numberToStringImpl(int i)
-{
-    return numberToStringImplSigned(i);
-}
-
-PassRefPtr<StringImpl> numberToStringImpl(long i)
-{
-    return numberToStringImplSigned(i);
-}
-
-PassRefPtr<StringImpl> numberToStringImpl(long long i)
-{
-    return numberToStringImplSigned(i);
-}
-
-
-template<typename UnsignedIntegerType>
-PassRefPtr<StringImpl> numberToStringImplUnsigned(UnsignedIntegerType integer)
-{
-    LChar buf[sizeof(UnsignedIntegerType) * 3];
-    LChar* end = buf + WTF_ARRAY_LENGTH(buf);
-    LChar* p = end;
-
-    do {
-        *--p = static_cast<LChar>((integer % 10) + '0');
-        integer /= 10;
-    } while (integer);
-    return StringImpl::create(p, static_cast<unsigned>(end - p));
-}
-
-PassRefPtr<StringImpl> numberToStringImpl(unsigned u)
-{
-    return numberToStringImplUnsigned(u);
-}
-
-PassRefPtr<StringImpl> numberToStringImpl(unsigned long u)
-{
-    return numberToStringImplUnsigned(u);
-}
-
-PassRefPtr<StringImpl> numberToStringImpl(unsigned long long u)
-{
-    return numberToStringImplUnsigned(u);
-}
-
-} // namespace WTF

Modified: trunk/Source/WTF/wtf/text/IntegerToStringConversion.h (127990 => 127991)


--- trunk/Source/WTF/wtf/text/IntegerToStringConversion.h	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WTF/wtf/text/IntegerToStringConversion.h	2012-09-09 20:48:23 UTC (rev 127991)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2012 Apple Inc. All Rights Reserved.
+ * Copyright (C) 2012 Patrick Gansterer <par...@paroga.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -21,18 +22,73 @@
 #ifndef IntegerToStringConversion_h
 #define IntegerToStringConversion_h
 
-#include "StringImpl.h"
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/StringImpl.h>
 
 namespace WTF {
 
-WTF_EXPORT_PRIVATE PassRefPtr<StringImpl> numberToStringImpl(int);
-WTF_EXPORT_PRIVATE PassRefPtr<StringImpl> numberToStringImpl(long);
-WTF_EXPORT_PRIVATE PassRefPtr<StringImpl> numberToStringImpl(long long);
+enum PositiveOrNegativeNumber {
+    PositiveNumber,
+    NegativeNumber
+};
 
-WTF_EXPORT_PRIVATE PassRefPtr<StringImpl> numberToStringImpl(unsigned);
-WTF_EXPORT_PRIVATE PassRefPtr<StringImpl> numberToStringImpl(unsigned long);
-WTF_EXPORT_PRIVATE PassRefPtr<StringImpl> numberToStringImpl(unsigned long long);
+template<typename T> struct ConversionTrait;
 
+template<> struct ConversionTrait<String> {
+    typedef PassRefPtr<StringImpl> ReturnType;
+    typedef void AdditionalArgumentType;
+    static inline ReturnType flush(LChar* characters, unsigned length, void*) { return StringImpl::create(characters, length); }
+};
+template<> struct ConversionTrait<StringBuilder> {
+    typedef void ReturnType;
+    typedef StringBuilder AdditionalArgumentType;
+    static inline ReturnType flush(LChar* characters, unsigned length, StringBuilder* stringBuilder) { stringBuilder->append(characters, length); }
+};
+
+template<typename T> struct UnsignedIntegerTrait;
+
+template<> struct UnsignedIntegerTrait<int> {
+    typedef unsigned int Type;
+};
+template<> struct UnsignedIntegerTrait<long> {
+    typedef unsigned long Type;
+};
+template<> struct UnsignedIntegerTrait<long long> {
+    typedef unsigned long long Type;
+};
+
+template<typename T, typename UnsignedIntegerType, PositiveOrNegativeNumber NumberType>
+static typename ConversionTrait<T>::ReturnType numberToStringImpl(UnsignedIntegerType number, typename ConversionTrait<T>::AdditionalArgumentType* additionalArgument)
+{
+    LChar buf[sizeof(UnsignedIntegerType) * 3 + 1];
+    LChar* end = buf + WTF_ARRAY_LENGTH(buf);
+    LChar* p = end;
+
+    do {
+        *--p = static_cast<LChar>((number % 10) + '0');
+        number /= 10;
+    } while (number);
+
+    if (NumberType == NegativeNumber)
+        *--p = '-';
+
+    return ConversionTrait<T>::flush(p, static_cast<unsigned>(end - p), additionalArgument);
+}
+
+template<typename T, typename SignedIntegerType>
+inline typename ConversionTrait<T>::ReturnType numberToStringSigned(SignedIntegerType number, typename ConversionTrait<T>::AdditionalArgumentType* additionalArgument = 0)
+{
+    if (number < 0)
+        return numberToStringImpl<T, typename UnsignedIntegerTrait<SignedIntegerType>::Type, NegativeNumber>(-number, additionalArgument);
+    return numberToStringImpl<T, typename UnsignedIntegerTrait<SignedIntegerType>::Type, PositiveNumber>(number, additionalArgument);
+}
+
+template<typename T, typename UnsignedIntegerType>
+inline typename ConversionTrait<T>::ReturnType numberToStringUnsigned(UnsignedIntegerType number, typename ConversionTrait<T>::AdditionalArgumentType* additionalArgument = 0)
+{
+    return numberToStringImpl<T, UnsignedIntegerType, PositiveNumber>(number, additionalArgument);
+}
+
 } // namespace WTF
 
 #endif // IntegerToStringConversion_h

Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (127990 => 127991)


--- trunk/Source/WTF/wtf/text/WTFString.cpp	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp	2012-09-09 20:48:23 UTC (rev 127991)
@@ -417,7 +417,37 @@
     return StringImpl::create(reinterpret_cast<const LChar*>(buffer.data()), len);
 #endif
 }
-    
+
+String String::number(int number)
+{
+    return numberToStringSigned<String>(number);
+}
+
+String String::number(unsigned int number)
+{
+    return numberToStringUnsigned<String>(number);
+}
+
+String String::number(long number)
+{
+    return numberToStringSigned<String>(number);
+}
+
+String String::number(unsigned long number)
+{
+    return numberToStringUnsigned<String>(number);
+}
+
+String String::number(long long number)
+{
+    return numberToStringSigned<String>(number);
+}
+
+String String::number(unsigned long long number)
+{
+    return numberToStringUnsigned<String>(number);
+}
+
 String String::number(double number, unsigned flags, unsigned precision)
 {
     NumberToStringBuffer buffer;

Modified: trunk/Source/WTF/wtf/text/WTFString.h (127990 => 127991)


--- trunk/Source/WTF/wtf/text/WTFString.h	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WTF/wtf/text/WTFString.h	2012-09-09 20:48:23 UTC (rev 127991)
@@ -26,7 +26,6 @@
 // on systems without case-sensitive file systems.
 
 #include <wtf/text/ASCIIFastPath.h>
-#include <wtf/text/IntegerToStringConversion.h>
 #include <wtf/text/StringImpl.h>
 
 #ifdef __OBJC__
@@ -226,13 +225,12 @@
         return (*m_impl)[index];
     }
 
-    static String number(unsigned short number) { return numberToStringImpl(number); }
-    static String number(int number) { return numberToStringImpl(number); }
-    static String number(unsigned number) { return numberToStringImpl(number); }
-    static String number(long number) { return numberToStringImpl(number); }
-    static String number(unsigned long number) { return numberToStringImpl(number); }
-    static String number(long long number) { return numberToStringImpl(number); }
-    static String number(unsigned long long number) { return numberToStringImpl(number); }
+    WTF_EXPORT_STRING_API static String number(int);
+    WTF_EXPORT_STRING_API static String number(unsigned int);
+    WTF_EXPORT_STRING_API static String number(long);
+    WTF_EXPORT_STRING_API static String number(unsigned long);
+    WTF_EXPORT_STRING_API static String number(long long);
+    WTF_EXPORT_STRING_API static String number(unsigned long long);
 
     WTF_EXPORT_STRING_API static String number(double, unsigned = ShouldRoundSignificantFigures | ShouldTruncateTrailingZeros, unsigned precision = 6);
 

Modified: trunk/Source/WebKit2/ChangeLog (127990 => 127991)


--- trunk/Source/WebKit2/ChangeLog	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WebKit2/ChangeLog	2012-09-09 20:48:23 UTC (rev 127991)
@@ -1,3 +1,13 @@
+2012-09-09  Patrick Gansterer  <par...@webkit.org>
+
+        Make the String initialization on the function side of String::number()
+        https://bugs.webkit.org/show_bug.cgi?id=95940
+
+        Reviewed by Benjamin Poulain.
+
+        * win/WebKit2.def:
+        * win/WebKit2CFLite.def:
+
 2012-09-09  Pierre Rossi  <pierre.ro...@gmail.com>
 
         [WK2] expose element rect for color input type

Modified: trunk/Source/WebKit2/win/WebKit2.def (127990 => 127991)


--- trunk/Source/WebKit2/win/WebKit2.def	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WebKit2/win/WebKit2.def	2012-09-09 20:48:23 UTC (rev 127991)
@@ -195,8 +195,10 @@
         ?lastChild@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?next@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?previous@ComposedShadowTreeWalker@WebCore@@QAEXXZ
-        ?numberToStringImpl@WTF@@YA?AV?$PassRefPtr@VStringImpl@WTF@@@1@H@Z
-        ?numberToStringImpl@WTF@@YA?AV?$PassRefPtr@VStringImpl@WTF@@@1@I@Z
+        ?number@String@WTF@@SA?AV12@_K@Z
+        ?number@String@WTF@@SA?AV12@H@Z
+        ?number@String@WTF@@SA?AV12@I@Z
+        ?number@String@WTF@@SA?AV12@NII@Z
         ?overrideUserPreferredLanguages@WebCore@@YAXABV?$Vector@VString@WTF@@$0A@@WTF@@@Z
         ?numberOfScopedHTMLStyleChildren@Node@WebCore@@QBEIXZ
         ?page@Document@WebCore@@QBEPAVPage@2@XZ

Modified: trunk/Source/WebKit2/win/WebKit2CFLite.def (127990 => 127991)


--- trunk/Source/WebKit2/win/WebKit2CFLite.def	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Source/WebKit2/win/WebKit2CFLite.def	2012-09-09 20:48:23 UTC (rev 127991)
@@ -192,8 +192,10 @@
         ?lastChild@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?next@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?previous@ComposedShadowTreeWalker@WebCore@@QAEXXZ
+        ?number@String@WTF@@SA?AV12@_K@Z
+        ?number@String@WTF@@SA?AV12@H@Z
         ?number@String@WTF@@SA?AV12@I@Z
-        ?number@String@WTF@@SA?AV12@H@Z
+        ?number@String@WTF@@SA?AV12@NII@Z
         ?overrideUserPreferredLanguages@WebCore@@YAXABV?$Vector@VString@WTF@@$0A@@WTF@@@Z
         ?numberOfScopedHTMLStyleChildren@Node@WebCore@@QBEIXZ
         ?page@Document@WebCore@@QBEPAVPage@2@XZ

Modified: trunk/Tools/ChangeLog (127990 => 127991)


--- trunk/Tools/ChangeLog	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Tools/ChangeLog	2012-09-09 20:48:23 UTC (rev 127991)
@@ -1,3 +1,14 @@
+2012-09-09  Patrick Gansterer  <par...@webkit.org>
+
+        Make the String initialization on the function side of String::number()
+        https://bugs.webkit.org/show_bug.cgi?id=95940
+
+        Reviewed by Benjamin Poulain.
+
+        * TestWebKitAPI/Tests/WTF/IntegerToStringConversion.cpp:
+        (testBoundaries):
+        (testNumbers):
+
 2012-09-09  Pierre Rossi  <pierre.ro...@gmail.com>
 
         [WK2] expose element rect for color input type

Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/IntegerToStringConversion.cpp (127990 => 127991)


--- trunk/Tools/TestWebKitAPI/Tests/WTF/IntegerToStringConversion.cpp	2012-09-09 17:40:12 UTC (rev 127990)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/IntegerToStringConversion.cpp	2012-09-09 20:48:23 UTC (rev 127991)
@@ -28,7 +28,6 @@
 #include <limits>
 #include <wtf/StringExtras.h>
 #include <wtf/text/CString.h>
-#include <wtf/text/IntegerToStringConversion.h>
 #include <wtf/text/WTFString.h>
 
 template<typename IntegerType> struct PrintfFormatTrait { static const char format[]; };
@@ -75,12 +74,12 @@
     buffer.resize(bufferSize);
 
     const IntegerType min = std::numeric_limits<IntegerType>::min();
-    CString minStringData = String(WTF::numberToStringImpl(min)).latin1();
+    CString minStringData = String::number(min).latin1();
     snprintf(buffer.data(), bufferSize, PrintfFormatTrait<IntegerType>::format, min);
     ASSERT_STREQ(buffer.data(), minStringData.data());
 
     const IntegerType max = std::numeric_limits<IntegerType>::max();
-    CString maxStringData = String(WTF::numberToStringImpl(max)).latin1();
+    CString maxStringData = String::number(max).latin1();
     snprintf(buffer.data(), bufferSize, PrintfFormatTrait<IntegerType>::format, max);
     ASSERT_STREQ(buffer.data(), maxStringData.data());
 }
@@ -94,7 +93,7 @@
 
     for (int i = -100; i < 100; ++i) {
         const IntegerType number = static_cast<IntegerType>(i);
-        CString numberStringData = String(WTF::numberToStringImpl(number)).latin1();
+        CString numberStringData = String::number(number).latin1();
         snprintf(buffer.data(), bufferSize, PrintfFormatTrait<IntegerType>::format, number);
         ASSERT_STREQ(buffer.data(), numberStringData.data());
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to