Cut down on use of String::number
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Oct 2013 18:04:40 +0000 (18:04 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 Oct 2013 18:04:40 +0000 (18:04 +0000)
commit7699ff47b8d7558516ddd2106e5d1798b7717bf9
tree449fc2b43165bfc1ee7972ebdb094784c04f544b
parent20c87dc31958b2647e3a7504e6e091925851acf2
Cut down on use of String::number
https://bugs.webkit.org/show_bug.cgi?id=122382

Reviewed by Anders Carlsson.

Source/JavaScriptCore:

* API/JSCallbackObjectFunctions.h:
(JSC::JSCallbackObject::putByIndex): Use Identifier::from instead of calling
String::number and creating an identifier from that. Can save creating and then
destroying a string if an identifier already exists.
* runtime/Arguments.cpp:
(JSC::Arguments::getOwnPropertySlotByIndex): Ditto.
(JSC::Arguments::getOwnPropertyNames): Ditto.
(JSC::Arguments::putByIndex): Ditto.
* runtime/JSGenericTypedArrayViewInlines.h:
(JSC::::getOwnPropertyNames): Ditto.
* runtime/StringObject.cpp:
(JSC::StringObject::getOwnPropertyNames): Ditto.

Source/WebCore:

* css/CSSGradientValue.cpp:
(WebCore::CSSLinearGradientValue::customCSSText): Use StringBuilder::appendNumber,
instead of creating a string and then appending it.
(WebCore::CSSRadialGradientValue::customCSSText): Ditto.
* css/CSSParser.cpp:
(WebCore::CSSParser::createKeyframe): Ditto.
* editing/DeleteButtonController.cpp:
(WebCore::DeleteButtonController::createDeletionUI): Use ASCII literals instead of
converting numeric constants to strings at runtime with String::number.
(WebCore::DeleteButtonController::show): Ditto.
* svg/SVGNumberList.cpp:
(WebCore::SVGNumberList::valueAsString): Use StringBuilder::appendNumber.
* svg/SVGPointList.cpp:
(WebCore::SVGPointList::valueAsString): Ditto.
* svg/SVGRect.h: Ditto.

Source/WebKit2:

* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::dumpChangedLayers): Use StringBuilder::appendNumber.

Source/WTF:

* wtf/DateMath.cpp:
(WTF::appendTwoDigitNumber): Added. Replaces twoDigitStringFromNumber, which returned a
String and also allocated a temporary string for any number 10 or higher.
(WTF::makeRFC2822DateString): Updated to use the new function.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156964 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/Arguments.cpp
Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h
Source/JavaScriptCore/runtime/StringObject.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/DateMath.cpp
Source/WebCore/ChangeLog
Source/WebCore/css/CSSGradientValue.cpp
Source/WebCore/css/CSSParser.cpp
Source/WebCore/editing/DeleteButtonController.cpp
Source/WebCore/svg/SVGNumberList.cpp
Source/WebCore/svg/SVGPointList.cpp
Source/WebCore/svg/SVGRect.h
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm