Ignore:
Timestamp:
Aug 12, 2010, 8:58:37 PM (15 years ago)
Author:
[email protected]
Message:

Unify UString::UTF8String() & String::utf8() methods,
remove UString::cost() & make atArrayIndex a free function.

Reviewed by Sam Weinig

JavaScriptCore:

(JSC::constantName):
(JSC::idName):
(JSC::CodeBlock::registerName):
(JSC::regexpName):
(JSC::printGlobalResolveInfo):
(JSC::printStructureStubInfo):
(JSC::CodeBlock::printStructure):
(JSC::CodeBlock::printStructures):

  • jsc.cpp:

(functionPrint):
(functionDebug):
(runInteractive):
(fillBufferWithContentsOfFile):

  • pcre/pcre_exec.cpp:

(Histogram::~Histogram):

  • profiler/CallIdentifier.h:

(JSC::CallIdentifier::c_str):

  • profiler/Profile.cpp:

(JSC::Profile::debugPrintDataSampleStyle):

  • profiler/ProfileGenerator.cpp:

(JSC::ProfileGenerator::willExecute):
(JSC::ProfileGenerator::didExecute):

  • profiler/ProfileNode.cpp:

(JSC::ProfileNode::debugPrintData):
(JSC::ProfileNode::debugPrintDataSampleStyle):

  • runtime/Arguments.cpp:

(JSC::Arguments::getOwnPropertySlot):
(JSC::Arguments::getOwnPropertyDescriptor):
(JSC::Arguments::put):
(JSC::Arguments::deleteProperty):

  • runtime/DateConversion.cpp:

(JSC::parseDate):

  • runtime/Identifier.h:

(JSC::Identifier::toStrictUInt32):

  • runtime/JSArray.cpp:

(JSC::JSArray::getOwnPropertySlot):
(JSC::JSArray::getOwnPropertyDescriptor):
(JSC::JSArray::put):
(JSC::JSArray::deleteProperty):

  • runtime/JSArray.h:

(JSC::toArrayIndex):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::encode):
(JSC::parseInt):
(JSC::globalFuncJSCPrint):

  • runtime/JSString.h:

(JSC::RopeBuilder::JSString):

  • runtime/UString.cpp:

(JSC::UString::toDouble):
(JSC::putUTF8Triple):
(JSC::UString::utf8):

  • runtime/UString.h:

(JSC::UString::~UString):
(JSC::UString::isNull):
(JSC::UString::isEmpty):
(JSC::UString::impl):

  • wtf/text/WTFString.cpp:

(WTF::String::utf8):

  • wtf/text/WTFString.h:

(WTF::String::~String):
(WTF::String::swap):
(WTF::String::isNull):
(WTF::String::isEmpty):
(WTF::String::impl):
(WTF::String::length):
(WTF::String::String):
(WTF::String::isHashTableDeletedValue):

WebCore:

  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::getOwnPropertySlot):
(WebCore::JSDOMWindow::getOwnPropertyDescriptor):

  • bridge/NP_jsobject.cpp:

(_NPN_Enumerate):

  • bridge/c/c_utility.cpp:

(JSC::Bindings::convertValueToNPVariant):

  • bridge/jni/JNIBridge.cpp:

(JavaParameter::JavaParameter):
(JavaMethod::JavaMethod):
(JavaMethod::signature):
(JavaMethod::methodID):

  • bridge/jni/JNIBridge.h:

(JSC::Bindings::JavaString::utf8):
(JSC::Bindings::JavaParameter::type):
(JSC::Bindings::JavaMethod::returnType):

  • bridge/jni/jni_jsobject.mm:

(JavaJSObject::call):
(JavaJSObject::eval):
(JavaJSObject::getMember):
(JavaJSObject::setMember):
(JavaJSObject::removeMember):
(JavaJSObject::convertJObjectToValue):

  • bridge/jni/jsc/JNIBridgeJSC.cpp:

(JavaField::JavaField):
(JavaField::valueFromInstance):
(JavaField::setValueToInstance):

  • bridge/jni/jsc/JNIBridgeJSC.h:

(JSC::Bindings::JavaField::type):

  • bridge/jni/jsc/JavaInstanceJSC.cpp:

(JavaInstance::invokeMethod):

  • bridge/jni/jsc/JavaStringJSC.h:

(JSC::Bindings::JavaStringImpl::utf8):

  • bridge/runtime_array.cpp:

(JSC::RuntimeArray::getOwnPropertySlot):
(JSC::RuntimeArray::getOwnPropertyDescriptor):
(JSC::RuntimeArray::put):

WebKit/mac:

  • Plugins/Hosted/NetscapePluginInstanceProxy.mm:

(WebKit::NetscapePluginInstanceProxy::enumerate):

WebKit/wx:

  • WebFrame.cpp:

(wxWebFrame::RunScript):

WebKit2:

  • WebProcess/Plugins/JSNPObject.cpp:

(WebKit::npIdentifierFromIdentifier):

  • WebProcess/Plugins/NPJSObject.cpp:

(WebKit::NPJSObject::enumerate):

  • WebProcess/Plugins/NPRuntimeObjectMap.cpp:

(WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/UString.h

    r65289 r65295  
    3939namespace JSC {
    4040
    41 using WTF::PlacementNewAdoptType;
    42 using WTF::PlacementNewAdopt;
    43 
    4441class UString {
    4542public:
     
    6461    UString(RefPtr<StringImpl> impl) : m_impl(impl) { }
    6562
     63    // Inline the destructor.
     64    ALWAYS_INLINE ~UString() { }
     65
    6666    void swap(UString& o) { m_impl.swap(o.m_impl); }
    6767
     
    6969    static UString adopt(Vector<UChar, inlineCapacity>& vector) { return StringImpl::adopt(vector); }
    7070
    71     static UString number(int);
    72     static UString number(long long);
    73     static UString number(unsigned);
    74     static UString number(long);
    75     static UString number(double);
    76 
    77     // NOTE: This method should only be used for *debugging* purposes as it
    78     // is neither Unicode safe nor free from side effects nor thread-safe.
    79     char* ascii() const;
    80 
    81     /**
    82      * Convert the string to UTF-8, assuming it is UTF-16 encoded.
    83      * In non-strict mode, this function is tolerant of badly formed UTF-16, it
    84      * can create UTF-8 strings that are invalid because they have characters in
    85      * the range U+D800-U+DDFF, U+FFFE, or U+FFFF, but the UTF-8 string is
    86      * guaranteed to be otherwise valid.
    87      * In strict mode, error is returned as null CString.
    88      */
    89     CString UTF8String(bool strict = false) const;
     71    bool isNull() const { return !m_impl; }
     72    bool isEmpty() const { return !m_impl || !m_impl->length(); }
     73
     74    StringImpl* impl() const { return m_impl.get(); }
    9075
    9176    unsigned length() const
     
    10388    }
    10489
     90    CString utf8(bool strict = false) const;
     91
    10592    UChar operator[](unsigned index) const
    10693    {
     
    11097    }
    11198
     99    static UString number(int);
     100    static UString number(unsigned);
     101    static UString number(long);
     102    static UString number(long long);
     103    static UString number(double);
     104
     105
     106
    112107    double toDouble(bool tolerateTrailingJunk, bool tolerateEmptyString) const;
    113108    double toDouble(bool tolerateTrailingJunk) const;
     
    117112    uint32_t toUInt32(bool* ok, bool tolerateEmptyString) const;
    118113    uint32_t toStrictUInt32(bool* ok = 0) const;
    119 
    120     unsigned toArrayIndex(bool* ok = 0) const;
    121114
    122115    static const unsigned NotFound = 0xFFFFFFFFu;
     
    128121    UString substr(unsigned pos = 0, unsigned len = 0xFFFFFFFF) const;
    129122
    130     bool isNull() const { return !m_impl; }
    131     bool isEmpty() const { return !m_impl || !m_impl->length(); }
    132 
    133     StringImpl* impl() const { return m_impl.get(); }
    134 
    135     size_t cost() const
    136     {
    137         if (!m_impl)
    138             return 0;
    139         return m_impl->cost();
    140     }
    141 
    142     ALWAYS_INLINE ~UString() { }
     123    // NOTE: This method should only be used for *debugging* purposes as it
     124    // is neither Unicode safe nor free from side effects nor thread-safe.
     125    char* ascii() const;
     126
    143127private:
    144128    RefPtr<StringImpl> m_impl;
     
    218202}
    219203
    220 // Rule from ECMA 15.2 about what an array index is.
    221 // Must exactly match string form of an unsigned integer, and be less than 2^32 - 1.
    222 inline unsigned UString::toArrayIndex(bool* ok) const
    223 {
    224     unsigned i = toStrictUInt32(ok);
    225     if (ok && i >= 0xFFFFFFFFU)
    226         *ok = false;
    227     return i;
    228 }
    229 
    230204// We'd rather not do shared substring append for small strings, since
    231205// this runs too much risk of a tiny initial string holding down a
Note: See TracChangeset for help on using the changeset viewer.