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/Arguments.cpp

    r156677 r156964  
    9999    }
    100100
    101     return JSObject::getOwnPropertySlot(thisObject, exec, Identifier(exec, String::number(i)), slot);
     101    return JSObject::getOwnPropertySlot(thisObject, exec, Identifier::from(exec, i), slot);
    102102}
    103103   
     
    161161        if (!thisObject->isArgument(i))
    162162            continue;
    163         propertyNames.add(Identifier(exec, String::number(i)));
     163        propertyNames.add(Identifier::from(exec, i));
    164164    }
    165165    if (mode == IncludeDontEnumProperties) {
     
    177177
    178178    PutPropertySlot slot(shouldThrow);
    179     JSObject::put(thisObject, exec, Identifier(exec, String::number(i)), value, slot);
     179    JSObject::put(thisObject, exec, Identifier::from(exec, i), value, slot);
    180180}
    181181
Note: See TracChangeset for help on using the changeset viewer.