Ignore:
Timestamp:
Oct 5, 2013, 11:04:40 AM (12 years ago)
Author:
Darin Adler
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/StringObject.cpp

    r155143 r156964  
    150150    int size = thisObject->internalValue()->length();
    151151    for (int i = 0; i < size; ++i)
    152         propertyNames.add(Identifier(exec, String::number(i)));
     152        propertyNames.add(Identifier::from(exec, i));
    153153    if (mode == IncludeDontEnumProperties)
    154154        propertyNames.add(exec->propertyNames().length);
Note: See TracChangeset for help on using the changeset viewer.