Changeset 127191 in webkit for trunk/Source/JavaScriptCore/yarr


Ignore:
Timestamp:
Aug 30, 2012, 2:23:51 PM (13 years ago)
Author:
[email protected]
Message:

Replace JSC::UString by WTF::String
https://bugs.webkit.org/show_bug.cgi?id=95271

Patch by Benjamin Poulain <[email protected]> on 2012-08-30
Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Having JSC::UString and WTF::String increase the complexity of working on WebKit, and
add useless conversions in the bindings. It also cause some code bloat.

The performance advantages of UString have been ported over in previous patches. This patch
is the last step: getting rid of UString.

In addition to the simplified code, this also reduce the binary size by 15kb on x86_64.

  • API/OpaqueJSString.cpp:

(OpaqueJSString::ustring):

  • runtime/Identifier.h:

(JSC::Identifier::ustring):
To avoid changing everything at once, the function named ustring() were kept as is. They
will be renamed in a follow up patch.

  • runtime/JSString.h:

(JSC::JSString::string):
(JSC::JSValue::toWTFString):
(JSC::inlineJSValueNotStringtoString):
(JSC::JSValue::toWTFStringInline):
Since JSValue::toString() already exist (and return the JSString), the direct accessor is renamed
to ::toWTFString(). We may change ::string() to ::jsString() and ::toWTFString() to ::toString()
in the future.

  • runtime/StringPrototype.cpp:

(JSC::substituteBackreferencesSlow): Replace the use of UString::getCharacters<>() by String::getCharactersWithUpconvert<>().

Source/WebCore:

Update the code to use String instead of UString.

On x86_64, this reduces the binary size by 22kb.

Since it is no longer possible to differenciate JSC::jsString() and WebCore::jsString() by the input
types, WebCore::jsString() is renated to WebCore::jsStringWithCache().

Since the cache is using a PtrHash, JSC::jsString() is used in place of the old WebCore::jsString() when
the string is generated locally. This is because the cache can never match in those cases.

Source/WebKit/blackberry:

Replace UString by String.

  • WebCoreSupport/ClientExtension.cpp:
  • WebCoreSupport/PagePopupBlackBerry.cpp:

(WebCore::PagePopupBlackBerry::installDomFunction):

Source/WebKit/efl:

Replace UString by String.

  • WebCoreSupport/DumpRenderTreeSupportEfl.cpp:

(DumpRenderTreeSupportEfl::sendWebIntentResponse):

  • ewk/ewk_frame.cpp:

(ewk_frame_script_execute):

Source/WebKit/gtk:

Replace UString by String.

  • gdom/ConvertToGCharPrivate.h:

(copyAsGchar):

Source/WebKit/mac:

Get rid of UString, replace it by String, and simplify the code when possible.

On x86_64, this reduces the binary size by 7kb.

  • Plugins/Hosted/NetscapePluginHostProxy.mm:

(identifierFromIdentifierRep):

  • Plugins/Hosted/NetscapePluginInstanceProxy.mm:

(WebKit::NetscapePluginInstanceProxy::addValueToArray):
(WebKit::NetscapePluginInstanceProxy::moveGlobalExceptionToExecState):

  • Plugins/Hosted/ProxyInstance.mm:

(WebKit::ProxyRuntimeMethod::create):
(WebKit::ProxyRuntimeMethod::finishCreation):
(WebKit::ProxyInstance::getPropertyNames):
(WebKit::ProxyInstance::methodsNamed):
(WebKit::ProxyInstance::fieldNamed):

  • WebView/WebFrame.mm:

(-[WebFrame _stringByEvaluatingJavaScriptFromString:forceUserGesture:]):
(-[WebFrame _stringByEvaluatingJavaScriptFromString:withGlobalObject:inScriptWorld:]):

  • WebView/WebScriptDebugDelegate.mm:

(-[WebScriptCallFrame functionName]):
(-[WebScriptCallFrame evaluateWebScript:]):

  • WebView/WebScriptDebugger.h:

(WTF):
(JSC):
(WebScriptDebugger):

  • WebView/WebScriptDebugger.mm:

(toNSURL):
(WebScriptDebugger::sourceParsed):

  • WebView/WebView.mm:

(aeDescFromJSValue):

Source/WebKit/qt:

Replace UString by String.

  • Api/qwebelement.cpp:

(QWebElement::evaluateJavaScript):

Source/WebKit/win:

Replace UString by String.

  • WebFrame.cpp:

(WebFrame::stringByEvaluatingJavaScriptInScriptWorld):

  • WebView.cpp:

(WebView::stringByEvaluatingJavaScriptFromString):

Source/WebKit/wx:

Update the #includes to use the correct types.

  • WebFrame.cpp:
  • WebView.cpp:

Source/WebKit2:

Update to code to switch from UString to String.

  • WebProcess/Plugins/Netscape/JSNPMethod.cpp:

(WebKit::JSNPMethod::finishCreation):

  • WebProcess/Plugins/Netscape/JSNPMethod.h:

(WebKit::JSNPMethod::create):
(JSNPMethod):

  • WebProcess/Plugins/Netscape/JSNPObject.cpp:

(WebKit::npIdentifierFromIdentifier):

  • WebProcess/Plugins/Netscape/NPRuntimeObjectMap.cpp:

(WebKit::NPRuntimeObjectMap::evaluate):
(WebKit::NPRuntimeObjectMap::moveGlobalExceptionToExecState):

Source/WTF:

  • wtf/Platform.h: Useless edit to force a full build. This is needed for some bots for some reason.
  • wtf/text/WTFString.h: Export a symbol that was exported on UString and needed in WebCore.

Add String::getCharactersWithUpconvert<>(), which is similar to String::getCharacters<>() but with the same
behaviors as UString::getCharacters<>().

String::getCharactersWithUpconvert<>() is useful when manipulating multiple strings, it allow writting code
using 16bits characters if any of the input String is not 8bit.

Tools:

Get rid of UString.

  • DumpRenderTree/efl/WorkQueueItemEfl.cpp:
  • gdb/webkit.py:

(WTFStringPrinter.to_string):
(JSCIdentifierPrinter.to_string):
(JSCJSStringPrinter.to_string):
(add_pretty_printers):

Websites/webkit.org:

Update the coding style to avoid mentioning a class that no longer exist.

  • coding/coding-style.html:
Location:
trunk/Source/JavaScriptCore/yarr
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/yarr/YarrInterpreter.cpp

    r112564 r127191  
    2828#include "YarrInterpreter.h"
    2929
    30 #include "UString.h"
    3130#include "Yarr.h"
    3231#include "YarrCanonicalizeUCS2.h"
     
    3433#include <wtf/DataLog.h>
    3534#include <wtf/text/CString.h>
     35#include <wtf/text/WTFString.h>
    3636
    3737#ifndef NDEBUG
     
    19351935}
    19361936
    1937 unsigned interpret(BytecodePattern* bytecode, const UString& input, unsigned start, unsigned* output)
     1937unsigned interpret(BytecodePattern* bytecode, const String& input, unsigned start, unsigned* output)
    19381938{
    19391939    if (input.is8Bit())
  • trunk/Source/JavaScriptCore/yarr/YarrInterpreter.h

    r112564 r127191  
    377377
    378378JS_EXPORT_PRIVATE PassOwnPtr<BytecodePattern> byteCompile(YarrPattern&, BumpPointerAllocator*);
    379 JS_EXPORT_PRIVATE unsigned interpret(BytecodePattern*, const UString& input, unsigned start, unsigned* output);
     379JS_EXPORT_PRIVATE unsigned interpret(BytecodePattern*, const String& input, unsigned start, unsigned* output);
    380380unsigned interpret(BytecodePattern*, const LChar* input, unsigned length, unsigned start, unsigned* output);
    381381unsigned interpret(BytecodePattern*, const UChar* input, unsigned length, unsigned start, unsigned* output);
  • trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp

    r120786 r127191  
    4040template<YarrJITCompileMode compileMode>
    4141class YarrGenerator : private MacroAssembler {
    42     friend void jitCompile(JSGlobalData*, YarrCodeBlock& jitObject, const UString& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase, bool multiline);
     42    friend void jitCompile(JSGlobalData*, YarrCodeBlock& jitObject, const String& pattern, unsigned& numSubpatterns, const char*& error, bool ignoreCase, bool multiline);
    4343
    4444#if CPU(ARM)
  • trunk/Source/JavaScriptCore/yarr/YarrJIT.h

    r112454 r127191  
    3232#include "MacroAssemblerCodeRef.h"
    3333#include "MatchResult.h"
    34 #include "UString.h"
    3534#include "Yarr.h"
    3635#include "YarrPattern.h"
  • trunk/Source/JavaScriptCore/yarr/YarrParser.h

    r108999 r127191  
    2727#define YarrParser_h
    2828
    29 #include <runtime/UString.h>
    3029#include "Yarr.h"
    3130#include <wtf/ASCIICType.h>
     31#include <wtf/text/WTFString.h>
    3232#include <wtf/unicode/Unicode.h>
    3333
     
    4848private:
    4949    template<class FriendDelegate>
    50     friend const char* parse(FriendDelegate& delegate, const UString& pattern, unsigned backReferenceLimit);
     50    friend const char* parse(FriendDelegate&, const String& pattern, unsigned backReferenceLimit);
    5151
    5252    enum ErrorCode {
     
    229229    };
    230230
    231     Parser(Delegate& delegate, const UString& pattern, unsigned backReferenceLimit)
     231    Parser(Delegate& delegate, const String& pattern, unsigned backReferenceLimit)
    232232        : m_delegate(delegate)
    233233        , m_backReferenceLimit(backReferenceLimit)
     
    869869
    870870template<class Delegate>
    871 const char* parse(Delegate& delegate, const UString& pattern, unsigned backReferenceLimit = quantifyInfinite)
     871const char* parse(Delegate& delegate, const String& pattern, unsigned backReferenceLimit = quantifyInfinite)
    872872{
    873873    if (pattern.is8Bit())
  • trunk/Source/JavaScriptCore/yarr/YarrPattern.cpp

    r112152 r127191  
    821821};
    822822
    823 const char* YarrPattern::compile(const UString& patternString)
     823const char* YarrPattern::compile(const String& patternString)
    824824{
    825825    YarrPatternConstructor constructor(*this);
     
    854854}
    855855
    856 YarrPattern::YarrPattern(const UString& pattern, bool ignoreCase, bool multiline, const char** error)
     856YarrPattern::YarrPattern(const String& pattern, bool ignoreCase, bool multiline, const char** error)
    857857    : m_ignoreCase(ignoreCase)
    858858    , m_multiline(multiline)
  • trunk/Source/JavaScriptCore/yarr/YarrPattern.h

    r104900 r127191  
    2828#define YarrPattern_h
    2929
    30 #include <runtime/UString.h>
    3130#include <wtf/CheckedArithmetic.h>
    3231#include <wtf/RefCounted.h>
    3332#include <wtf/Vector.h>
     33#include <wtf/text/WTFString.h>
    3434#include <wtf/unicode/Unicode.h>
    3535
     
    317317
    318318struct YarrPattern {
    319     JS_EXPORT_PRIVATE YarrPattern(const UString& pattern, bool ignoreCase, bool multiline, const char** error);
     319    JS_EXPORT_PRIVATE YarrPattern(const String& pattern, bool ignoreCase, bool multiline, const char** error);
    320320
    321321    ~YarrPattern()
     
    406406
    407407private:
    408     const char* compile(const UString& patternString);
     408    const char* compile(const String& patternString);
    409409
    410410    CharacterClass* newlineCached;
  • trunk/Source/JavaScriptCore/yarr/YarrSyntaxChecker.cpp

    r95901 r127191  
    5151};
    5252
    53 const char* checkSyntax(const UString& pattern)
     53const char* checkSyntax(const String& pattern)
    5454{
    5555    SyntaxChecker syntaxChecker;
  • trunk/Source/JavaScriptCore/yarr/YarrSyntaxChecker.h

    r95901 r127191  
    2727#define YarrSyntaxChecker_h
    2828
    29 #include <runtime/UString.h>
     29#include <wtf/text/WTFString.h>
    3030
    3131namespace JSC { namespace Yarr {
    3232
    33 const char* checkSyntax(const UString& pattern);
     33const char* checkSyntax(const String& pattern);
    3434
    3535}} // JSC::YARR
  • trunk/Source/JavaScriptCore/yarr/yarr.pri

    r114042 r127191  
    1111    $$PWD/YarrCanonicalizeUCS2.cpp
    1212
    13 # For UString.h
    14 v8 {
    15     INCLUDEPATH += \
    16         $$PWD/.. \
    17         $$PWD/../runtime
    18 }
Note: See TracChangeset for help on using the changeset viewer.