Unify Number to StringImpl conversion
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Aug 2012 00:13:19 +0000 (00:13 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Aug 2012 00:13:19 +0000 (00:13 +0000)
commitd80a4260b466f4b356ee7ce1bfb6ac6654bd329b
tree9181890bdeed1d2dcfc358ade5f6878f3aa09af5
parent67cef13fa5587e9d1970012a70c756001218d4b1
Unify Number to StringImpl conversion
https://bugs.webkit.org/show_bug.cgi?id=94879

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-08-24
Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
* runtime/UString.cpp:
* runtime/UString.h:
(JSC::UString::number):
Update UString to directly use the common NumberToString implementation.

Source/WebKit2:

* win/WebKit2.def: Update the exported symbols.

Source/WTF:

Previously, UString::number() and String::number() used different implementations.

WTF::String::number() was simply forwarding to String::format().
UString::number() had an optimized version of the conversion.

This patch replace both implementation by a new version, faster than the two previous versions.

The new functions numberToStringImpl improvements are:
-about 3 times faster than String::number().
-14% faster than UString::number() on signed numbers.
-9% faster than UString::number() on unsigned numbers.

* GNUmakefile.list.am:
* WTF.gypi:
* WTF.pro:
* WTF.vcproj/WTF.vcproj:
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/text/IntegerToStringConversion.cpp: Added.
(WTF::numberToStringImplSigned):
(WTF::numberToStringImpl):
(WTF::numberToStringImplUnsigned):
* wtf/text/IntegerToStringConversion.h: Added.
* wtf/text/WTFString.cpp:
(WTF::String::format):
* wtf/text/WTFString.h:
(WTF::String::number):

Tools:

Add testing for the new IntegerToStringConversion.

* TestWebKitAPI/CMakeLists.txt:
* TestWebKitAPI/GNUmakefile.am:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WTF/IntegerToStringConversion.cpp: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@126658 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/JavaScriptCore/runtime/UString.cpp
Source/JavaScriptCore/runtime/UString.h
Source/WTF/ChangeLog
Source/WTF/GNUmakefile.list.am
Source/WTF/WTF.gypi
Source/WTF/WTF.pro
Source/WTF/WTF.vcproj/WTF.vcproj
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/text/IntegerToStringConversion.cpp [new file with mode: 0644]
Source/WTF/wtf/text/IntegerToStringConversion.h [new file with mode: 0644]
Source/WTF/wtf/text/WTFString.cpp
Source/WTF/wtf/text/WTFString.h
Source/WebKit2/ChangeLog
Source/WebKit2/win/WebKit2.def
Tools/ChangeLog
Tools/TestWebKitAPI/CMakeLists.txt
Tools/TestWebKitAPI/GNUmakefile.am
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WTF/IntegerToStringConversion.cpp [new file with mode: 0644]