Ignore:
Timestamp:
Mar 16, 2014, 10:35:53 AM (11 years ago)
Author:
Darin Adler
Message:

Remove all uses of deprecatedCharacters from JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=130304

Reviewed by Anders Carlsson.

Source/JavaScriptCore:

  • API/JSValueRef.cpp:

(JSValueMakeFromJSONString): Use characters16 in the 16-bit code path.

  • API/OpaqueJSString.cpp:

(OpaqueJSString::~OpaqueJSString): Use characters 16 in the 16-bit code path.
(OpaqueJSString::identifier): Get rid of custom Identifier constructor, and
juse use the standard one that takes a String.
(OpaqueJSString::characters): Use getCharactersWithUpconvert instead of a
hand-written alternative.

  • bindings/ScriptValue.cpp:

(Deprecated::jsToInspectorValue): Create InspectorString from String directly
instead of involving a character pointer. Use the String from Identifier
directly instead of making a new String.

  • inspector/ContentSearchUtilities.cpp:

(Inspector::ContentSearchUtilities::createSearchRegexSource): Use StringBuilder
instead of building a String a character at a time. This is still a very slow
way to do this. Also use strchr to search for a character instead of building
a String every time just to use find on it.

  • inspector/InspectorValues.cpp:

(Inspector::doubleQuoteString): Remove unnecessary trip through a
character pointer. This is still a really slow way to do this.
(Inspector::InspectorValue::parseJSON): Use StringView::upconvertedCharacters
instead of String::deprecatedCharacters. Still slow to always upconvert.

  • runtime/DateConstructor.cpp: Removed unneeded include.
  • runtime/DatePrototype.cpp: Ditto.
  • runtime/Identifier.h: Removed deprecatedCharacters function.
  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::encode): Added a type cast to avoid ambiguity with the two character-
appending functions from JSStringBuilder. Removed unneeded code duplicating
what JSStringBuilder already does in its character append function.
(JSC::decode): Deleted code that creates a JSStringBuilder that is never used.
(JSC::parseIntOverflow): Changed lengths to unsigned. Made only the overload that
is used outside this file have external linkage. Added a new overload that takes
a StringView.
(JSC::parseInt): Use StringView::substring to call parseIntOverflow.
(JSC::globalFuncEscape): Use JSBuilder::append in a more efficient way for a
single character.

  • runtime/JSGlobalObjectFunctions.h: Removed unused overloads of parseIntOverflow.
  • runtime/JSStringBuilder.h: Marked this "lightly deprecated".

(JSC::JSStringBuilder::append): Overloaded for better speed with 8-bit characters.
Made one overload private. Fixed a performance bug where we would reserve capacity
in the 8-bit buffer but then append to the 16-bit buffer.

  • runtime/ObjectPrototype.cpp: Removed unneeded include.
  • runtime/StringPrototype.cpp:

(JSC::stringProtoFuncFontsize): Use StringView::getCharactersWithUpconvert.
(JSC::stringProtoFuncLink): Ditto.

Source/WTF:

  • wtf/dtoa.h:

(WTF::parseDouble): Added an overload that takes a StringView.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bindings/ScriptValue.cpp

    r165676 r165703  
    116116    if (value.isNumber())
    117117        return InspectorBasicValue::create(value.asNumber());
    118     if (value.isString()) {
    119         String s = value.getString(scriptState);
    120         return InspectorString::create(String(s.deprecatedCharacters(), s.length()));
    121     }
     118    if (value.isString())
     119        return InspectorString::create(value.getString(scriptState));
    122120
    123121    if (value.isObject()) {
     
    140138        object->methodTable()->getOwnPropertyNames(object, scriptState, propertyNames, ExcludeDontEnumProperties);
    141139        for (size_t i = 0; i < propertyNames.size(); i++) {
    142             const Identifier& name =  propertyNames[i];
     140            const Identifier& name = propertyNames[i];
    143141            JSValue propertyValue = object->get(scriptState, name);
    144142            RefPtr<InspectorValue> inspectorValue = jsToInspectorValue(scriptState, propertyValue, maxDepth);
    145143            if (!inspectorValue)
    146144                return nullptr;
    147             inspectorObject->setValue(String(name.deprecatedCharacters(), name.length()), inspectorValue);
     145            inspectorObject->setValue(name.string(), inspectorValue);
    148146        }
    149147        return inspectorObject;
Note: See TracChangeset for help on using the changeset viewer.