Changeset 34361 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jun 4, 2008, 11:10:15 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin.

Fix JSClassCreate to work with old JSCore API threading model.

No change on SunSpider.

  • API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): Since JSClass is constructed without a context, there is no way for it to create Identifiers. Also, added initializeThreading(), just for good measure.
  • API/JSCallbackObjectFunctions.h: (KJS::::getPropertyNames): Make an Identifier out of the string here, because propertyNames.add() needs that.
  • kjs/identifier.cpp:
  • kjs/identifier.h: (KJS::Identifier::equal):
  • kjs/ustring.cpp: (KJS::equal): Moved equal() from identifier.h to ustring.h, because it's not really about Identifiers, and to make it possible to use it from StrHash. Include StrHash.h from ustring.h to avoid having the behavior depend on headers that happen to be included.
  • wtf/StrHash.h: Removed.
  • kjs/ustring.h: Made RefPtr<UString::Rep> use the same default hash as UString::Rep* (it used to default to pointer equality). Moved the whole StrHash header into ustring.h.
  • JavaScriptCore.exp: Export equal() for WebCore use (this StrHash is used in c_class.cpp, jni_class.cpp, and npruntime.cpp).
Location:
trunk/JavaScriptCore
Files:
1 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSCallbackObjectFunctions.h

    r34355 r34361  
    345345                StaticValueEntry* entry = it->second;
    346346                if (entry->getProperty && !(entry->attributes & kJSPropertyAttributeDontEnum))
    347                     propertyNames.add(name);
     347                    propertyNames.add(Identifier(name));
    348348            }
    349349        }
     
    356356                StaticFunctionEntry* entry = it->second;
    357357                if (!(entry->attributes & kJSPropertyAttributeDontEnum))
    358                     propertyNames.add(name);
     358                    propertyNames.add(Identifier(name));
    359359            }
    360360        }
  • trunk/JavaScriptCore/API/JSClassRef.cpp

    r33374 r34361  
    3333#include <kjs/JSGlobalObject.h>
    3434#include <kjs/identifier.h>
     35#include <kjs/InitializeThreading.h>
    3536#include <kjs/object_object.h>
    3637
     
    5859    , cachedPrototype(0)
    5960{
     61    initializeThreading();
     62
    6063    if (const JSStaticValue* staticValue = definition->staticValues) {
    6164        staticValues = new StaticValuesTable();
    6265        while (staticValue->name) {
    63             staticValues->add(Identifier(UString::Rep::createFromUTF8(staticValue->name).get()).ustring().rep(),
     66            staticValues->add(UString::Rep::createFromUTF8(staticValue->name),
    6467                              new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes));
    6568            ++staticValue;
     
    7073        staticFunctions = new StaticFunctionsTable();
    7174        while (staticFunction->name) {
    72             staticFunctions->add(Identifier(UString::Rep::createFromUTF8(staticFunction->name).get()).ustring().rep(),
     75            staticFunctions->add(UString::Rep::createFromUTF8(staticFunction->name),
    7376                                 new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes));
    7477            ++staticFunction;
  • trunk/JavaScriptCore/ChangeLog

    r34360 r34361  
     12008-06-04  Alexey Proskuryakov  <[email protected]>
     2
     3        Reviewed by Darin.
     4
     5        Fix JSClassCreate to work with old JSCore API threading model.
     6
     7        No change on SunSpider.
     8
     9        * API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): Since JSClass is constructed without
     10        a context, there is no way for it to create Identifiers.
     11        Also, added initializeThreading(), just for good measure.
     12
     13        * API/JSCallbackObjectFunctions.h: (KJS::::getPropertyNames): Make an Identifier out of the
     14        string here, because propertyNames.add() needs that.
     15
     16        * kjs/identifier.cpp:
     17        * kjs/identifier.h:
     18        (KJS::Identifier::equal):
     19        * kjs/ustring.cpp:
     20        (KJS::equal):
     21        Moved equal() from identifier.h to ustring.h, because it's not really about Identifiers,
     22        and to make it possible to use it from StrHash.
     23        Include StrHash.h from ustring.h to avoid having the behavior depend on headers that happen
     24        to be included.
     25
     26        * wtf/StrHash.h: Removed.
     27        * kjs/ustring.h: Made RefPtr<UString::Rep> use the same default hash as UString::Rep* (it
     28        used to default to pointer equality). Moved the whole StrHash header into ustring.h.
     29
     30        * JavaScriptCore.exp: Export equal() for WebCore use (this StrHash is used in c_class.cpp,
     31        jni_class.cpp, and npruntime.cpp).
     32
    1332008-06-04  Alexey Proskuryakov  <[email protected]>
    234
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r34355 r34361  
    1 _JSCheckScriptSyntax
    2 _JSClassCreate
    3 _JSClassRelease
    4 _JSClassRetain
    5 _JSContextGetGlobalObject
    6 _JSEvaluateScript
    7 _JSGarbageCollect
    8 _JSGlobalContextCreate
    9 _JSGlobalContextRelease
    10 _JSGlobalContextRetain
    11 _JSObjectCallAsConstructor
    12 _JSObjectCallAsFunction
    13 _JSObjectCopyPropertyNames
    14 _JSObjectDeleteProperty
    15 _JSObjectGetPrivate
    16 _JSObjectGetProperty
    17 _JSObjectGetPropertyAtIndex
    18 _JSObjectGetPrototype
    19 _JSObjectHasProperty
    20 _JSObjectIsConstructor
    21 _JSObjectIsFunction
    22 _JSObjectMake
    23 _JSObjectMakeConstructor
    24 _JSObjectMakeFunction
    25 _JSObjectMakeFunctionWithCallback
    26 _JSObjectSetPrivate
    27 _JSObjectSetProperty
    28 _JSObjectSetPropertyAtIndex
    29 _JSObjectSetPrototype
    30 _JSPropertyNameAccumulatorAddName
    31 _JSPropertyNameArrayGetCount
    32 _JSPropertyNameArrayGetNameAtIndex
    33 _JSPropertyNameArrayRelease
    34 _JSPropertyNameArrayRetain
    35 _JSStringCopyCFString
    36 _JSStringCreateWithCFString
    37 _JSStringCreateWithCharacters
    38 _JSStringCreateWithUTF8CString
    39 _JSStringGetCharactersPtr
    40 _JSStringGetLength
    41 _JSStringGetMaximumUTF8CStringSize
    42 _JSStringGetUTF8CString
    43 _JSStringIsEqual
    44 _JSStringIsEqualToUTF8CString
    45 _JSStringRelease
    46 _JSStringRetain
    47 _JSValueGetType
    48 _JSValueIsBoolean
    49 _JSValueIsEqual
    50 _JSValueIsInstanceOfConstructor
    51 _JSValueIsNull
    52 _JSValueIsNumber
    53 _JSValueIsObject
    54 _JSValueIsObjectOfClass
    55 _JSValueIsStrictEqual
    56 _JSValueIsString
    57 _JSValueIsUndefined
    58 _JSValueMakeBoolean
    59 _JSValueMakeNull
    60 _JSValueMakeNumber
    61 _JSValueMakeString
    62 _JSValueMakeUndefined
    63 _JSValueProtect
    64 _JSValueToBoolean
    65 _JSValueToNumber
    66 _JSValueToObject
    67 _JSValueToStringCopy
    68 _JSValueUnprotect
    69 _WTFLog
    70 _WTFLogVerbose
    71 _WTFReportArgumentAssertionFailure
    72 _WTFReportAssertionFailure
    73 _WTFReportAssertionFailureWithMessage
    74 _WTFReportError
    75 _WTFReportFatalError
    761__Z12jsRegExpFreeP8JSRegExp
    772__Z15jsRegExpCompilePKti24JSRegExpIgnoreCaseOption23JSRegExpMultilineOptionPjPPKc
     
    11338__ZN3KJS13ArrayInstance4infoE
    11439__ZN3KJS13CodeGenerator21setDumpsGeneratedCodeEb
     40__ZN3KJS13jsOwnedStringERKNS_7UStringE
    11541__ZN3KJS13StatementNode6setLocEii
    116 __ZN3KJS13jsOwnedStringERKNS_7UStringE
    11742__ZN3KJS14JSGlobalObject10globalExecEv
    11843__ZN3KJS14JSGlobalObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectE
     
    12853__ZN3KJS14StringInstance14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
    12954__ZN3KJS14StringInstance16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
     55__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
    13056__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
    131 __ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
    13257__ZN3KJS14StringInstance3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
    13358__ZN3KJS14StringInstance4infoE
     
    14065__ZN3KJS16ParserRefCounted5derefEv
    14166__ZN3KJS17PropertyNameArray3addEPNS_7UString3RepE
     67__ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
    14268__ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEPNS_17FunctionPrototypeEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
    143 __ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
    14469__ZN3KJS17RegisterFileStack20allocateRegisterFileEmPS0_
     70__ZN3KJS19initializeThreadingEv
    14571__ZN3KJS19InternalFunctionImp11getCallDataERNS_8CallDataE
    14672__ZN3KJS19InternalFunctionImp4infoE
    14773__ZN3KJS19InternalFunctionImpC2EPNS_17FunctionPrototypeERKNS_10IdentifierE
    148 __ZN3KJS19initializeThreadingEv
    14974__ZN3KJS23objectProtoFuncToStringEPNS_9ExecStateEPNS_8JSObjectERKNS_4ListE
    15075__ZN3KJS4List15expandAndAppendEPNS_7JSValueE
    15176__ZN3KJS4List7markSetEv
     77__ZN3KJS5equalEPKNS_7UString3RepES3_
    15278__ZN3KJS6JSCell11getCallDataERNS_8CallDataE
    15379__ZN3KJS6JSCell16getConstructDataERNS_13ConstructDataE
     80__ZN3KJS6JSCell18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
    15481__ZN3KJS6JSCell18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
    155 __ZN3KJS6JSCell18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
     82__ZN3KJS6JSCell3putEPNS_9ExecStateEjPNS_7JSValueE
    15683__ZN3KJS6JSCell3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
    157 __ZN3KJS6JSCell3putEPNS_9ExecStateEjPNS_7JSValueE
    15884__ZN3KJS6JSCell9getObjectEv
    15985__ZN3KJS6JSCellnwEm
     
    16793__ZN3KJS6parserEv
    16894__ZN3KJS6strtodEPKcPPc
     95__ZN3KJS7CStringaSERKS0_
    16996__ZN3KJS7CStringD1Ev
    170 __ZN3KJS7CStringaSERKS0_
    17197__ZN3KJS7Machine13dumpCallFrameEPKNS_9CodeBlockEPNS_14ScopeChainNodeEPNS_12RegisterFileEPKNS_8RegisterE
    17298__ZN3KJS7UString3Rep11computeHashEPKti
     
    176102__ZN3KJS7UString6appendEPKc
    177103__ZN3KJS7UString6appendERKS0_
     104__ZN3KJS7UStringaSEPKc
    178105__ZN3KJS7UStringC1EPKc
    179106__ZN3KJS7UStringC1EPKti
    180107__ZN3KJS7UStringC1ERKS0_S2_
    181 __ZN3KJS7UStringaSEPKc
    182108__ZN3KJS8Debugger6attachEPNS_14JSGlobalObjectE
    183109__ZN3KJS8Debugger6detachEPNS_14JSGlobalObjectE
     
    191117__ZN3KJS8JSObject12removeDirectERKNS_10IdentifierE
    192118__ZN3KJS8JSObject14callAsFunctionEPNS_9ExecStateEPS0_RKNS_4ListE
     119__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateEj
    193120__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
    194 __ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateEj
    195121__ZN3KJS8JSObject14implementsCallEv
    196122__ZN3KJS8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
    197123__ZN3KJS8JSObject17putDirectFunctionEPNS_19InternalFunctionImpEi
     124__ZN3KJS8JSObject17putWithAttributesEPNS_9ExecStateEjPNS_7JSValueEj
    198125__ZN3KJS8JSObject17putWithAttributesEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueEj
    199 __ZN3KJS8JSObject17putWithAttributesEPNS_9ExecStateEjPNS_7JSValueEj
    200126__ZN3KJS8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
    201127__ZN3KJS8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRPNS_7JSValueE
    202128__ZN3KJS8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPPNS_7JSValueE
     129__ZN3KJS8JSObject3putEPNS_9ExecStateEjPNS_7JSValueE
    203130__ZN3KJS8JSObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
    204 __ZN3KJS8JSObject3putEPNS_9ExecStateEjPNS_7JSValueE
    205131__ZN3KJS8JSObject4markEv
    206132__ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListE
    207133__ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListERKNS_10IdentifierERKNS_7UStringEi
     134__ZN3KJS8jsStringEPKc
     135__ZN3KJS8jsStringERKNS_7UStringE
    208136__ZN3KJS8Profiler13stopProfilingEPNS_9ExecStateERKNS_7UStringE
    209137__ZN3KJS8Profiler14startProfilingEPNS_9ExecStateERKNS_7UStringE
    210138__ZN3KJS8Profiler8profilerEv
    211 __ZN3KJS8jsStringEPKc
    212 __ZN3KJS8jsStringERKNS_7UStringE
    213139__ZN3KJS9Collector14allocateNumberEm
    214140__ZN3KJS9Collector15recordExtraCostEm
     
    285211__ZNK3KJS7UString8toUInt32EPb
    286212__ZNK3KJS7UString8toUInt32EPbb
     213__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateEj
    287214__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
    288 __ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateEj
    289215__ZNK3KJS8JSObject12defaultValueEPNS_9ExecStateENS_6JSTypeE
    290216__ZNK3KJS8JSObject12toThisObjectEPNS_9ExecStateE
     
    309235__ZTVN3KJS8JSObjectE
    310236__ZTVN3KJS9NumberImpE
     237_JSCheckScriptSyntax
     238_JSClassCreate
     239_JSClassRelease
     240_JSClassRetain
     241_JSContextGetGlobalObject
    311242_jscore_collector_introspection
    312243_jscore_fastmalloc_introspection
     244_JSEvaluateScript
     245_JSGarbageCollect
     246_JSGlobalContextCreate
     247_JSGlobalContextRelease
     248_JSGlobalContextRetain
     249_JSObjectCallAsConstructor
     250_JSObjectCallAsFunction
     251_JSObjectCopyPropertyNames
     252_JSObjectDeleteProperty
     253_JSObjectGetPrivate
     254_JSObjectGetProperty
     255_JSObjectGetPropertyAtIndex
     256_JSObjectGetPrototype
     257_JSObjectHasProperty
     258_JSObjectIsConstructor
     259_JSObjectIsFunction
     260_JSObjectMake
     261_JSObjectMakeConstructor
     262_JSObjectMakeFunction
     263_JSObjectMakeFunctionWithCallback
     264_JSObjectSetPrivate
     265_JSObjectSetProperty
     266_JSObjectSetPropertyAtIndex
     267_JSObjectSetPrototype
     268_JSPropertyNameAccumulatorAddName
     269_JSPropertyNameArrayGetCount
     270_JSPropertyNameArrayGetNameAtIndex
     271_JSPropertyNameArrayRelease
     272_JSPropertyNameArrayRetain
     273_JSStringCopyCFString
     274_JSStringCreateWithCFString
     275_JSStringCreateWithCharacters
     276_JSStringCreateWithUTF8CString
     277_JSStringGetCharactersPtr
     278_JSStringGetLength
     279_JSStringGetMaximumUTF8CStringSize
     280_JSStringGetUTF8CString
     281_JSStringIsEqual
     282_JSStringIsEqualToUTF8CString
     283_JSStringRelease
     284_JSStringRetain
     285_JSValueGetType
     286_JSValueIsBoolean
     287_JSValueIsEqual
     288_JSValueIsInstanceOfConstructor
     289_JSValueIsNull
     290_JSValueIsNumber
     291_JSValueIsObject
     292_JSValueIsObjectOfClass
     293_JSValueIsStrictEqual
     294_JSValueIsString
     295_JSValueIsUndefined
     296_JSValueMakeBoolean
     297_JSValueMakeNull
     298_JSValueMakeNumber
     299_JSValueMakeString
     300_JSValueMakeUndefined
     301_JSValueProtect
     302_JSValueToBoolean
     303_JSValueToNumber
     304_JSValueToObject
     305_JSValueToStringCopy
     306_JSValueUnprotect
    313307_kJSClassDefinitionEmpty
    314308_releaseFastMallocFreeMemory
     309_WTFLog
     310_WTFLogVerbose
     311_WTFReportArgumentAssertionFailure
     312_WTFReportAssertionFailure
     313_WTFReportAssertionFailureWithMessage
     314_WTFReportError
     315_WTFReportFatalError
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r34273 r34361  
    214214                95742F650DD11F5A000917FB /* Profile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95742F630DD11F5A000917FB /* Profile.cpp */; };
    215215                95742F660DD11F5A000917FB /* Profile.h in Headers */ = {isa = PBXBuildFile; fileRef = 95742F640DD11F5A000917FB /* Profile.h */; settings = {ATTRIBUTES = (Private, ); }; };
    216                 958D85830DC93230008ABF27 /* StrHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 958D85820DC93230008ABF27 /* StrHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
    217216                95AB83420DA4322500BC83F3 /* Profiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95AB832E0DA42CAD00BC83F3 /* Profiler.cpp */; };
    218217                95AB83480DA432EB00BC83F3 /* Profiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 95AB832F0DA42CAD00BC83F3 /* Profiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    560559                95742F630DD11F5A000917FB /* Profile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Profile.cpp; path = profiler/Profile.cpp; sourceTree = "<group>"; };
    561560                95742F640DD11F5A000917FB /* Profile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Profile.h; path = profiler/Profile.h; sourceTree = "<group>"; };
    562                 958D85820DC93230008ABF27 /* StrHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StrHash.h; sourceTree = "<group>"; };
    563561                95AB832E0DA42CAD00BC83F3 /* Profiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Profiler.cpp; path = profiler/Profiler.cpp; sourceTree = "<group>"; };
    564562                95AB832F0DA42CAD00BC83F3 /* Profiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Profiler.h; path = profiler/Profiler.h; sourceTree = "<group>"; };
     
    959957                                6592C316098B7DE10003D4F6 /* Vector.h */,
    960958                                6592C317098B7DE10003D4F6 /* VectorTraits.h */,
    961                                 958D85820DC93230008ABF27 /* StrHash.h */,
    962959                        );
    963960                        path = wtf;
     
    12821279                                E1B7C8BE0DA3A3360074B0DC /* ThreadSpecific.h in Headers */,
    12831280                                06D358B20DAADA93003B174E /* MainThread.h in Headers */,
    1284                                 958D85830DC93230008ABF27 /* StrHash.h in Headers */,
    12851281                                95742F660DD11F5A000917FB /* Profile.h in Headers */,
    12861282                                5DE3D0F50DD8DDFB00468714 /* WebKitAvailability.h in Headers */,
  • trunk/JavaScriptCore/kjs/identifier.cpp

    r32799 r34361  
    2929#include <wtf/FastMalloc.h>
    3030#include <wtf/HashSet.h>
    31 #include <wtf/StrHash.h>
    3231#if USE(MULTIPLE_THREADS)
    3332#include <wtf/ThreadSpecific.h>
     
    112111        return false;
    113112    const UChar *d = r->data();
    114     for (int i = 0; i != length; ++i)
    115         if (d[i] != s[i])
    116             return false;
    117     return true;
    118 }
    119 
    120 bool Identifier::equal(const UString::Rep *r, const UString::Rep *b)
    121 {
    122     int length = r->len;
    123     if (length != b->len)
    124         return false;
    125     const UChar *d = r->data();
    126     const UChar *s = b->data();
    127113    for (int i = 0; i != length; ++i)
    128114        if (d[i] != s[i])
  • trunk/JavaScriptCore/kjs/identifier.h

    r32222 r34361  
    6666        static bool equal(const UString::Rep*, const char*);
    6767        static bool equal(const UString::Rep*, const UChar*, int length);
    68         static bool equal(const UString::Rep*, const UString::Rep*);
     68        static bool equal(const UString::Rep* a, const UString::Rep* b) { return KJS::equal(a, b); }
    6969
    7070        static PassRefPtr<UString::Rep> add(const char*);
  • trunk/JavaScriptCore/kjs/ustring.cpp

    r33941 r34361  
    13161316}
    13171317
     1318bool equal(const UString::Rep* r, const UString::Rep* b)
     1319{
     1320    int length = r->len;
     1321    if (length != b->len)
     1322        return false;
     1323    const UChar* d = r->data();
     1324    const UChar* s = b->data();
     1325    for (int i = 0; i != length; ++i)
     1326        if (d[i] != s[i])
     1327            return false;
     1328    return true;
     1329}
     1330
    13181331CString UString::UTF8String(bool strict) const
    13191332{
  • trunk/JavaScriptCore/kjs/ustring.h

    r33941 r34361  
    382382  int compare(const UString &, const UString &);
    383383
     384  bool equal(const UString::Rep*, const UString::Rep*);
     385
     386
    384387inline UString::UString()
    385388  : m_rep(&Rep::null)
     
    430433}
    431434
    432 } // namespace
     435} // namespace KJS
     436
     437
     438namespace WTF {
     439
     440    template<typename T> struct DefaultHash;
     441    template<typename T> struct StrHash;
     442
     443    template<> struct StrHash<KJS::UString::Rep*> {
     444        static unsigned hash(const KJS::UString::Rep* key) { return key->hash(); }
     445        static bool equal(const KJS::UString::Rep* a, const KJS::UString::Rep* b) { return KJS::equal(a, b); }
     446        static const bool safeToCompareToEmptyOrDeleted = false;
     447    };
     448
     449    template<> struct StrHash<RefPtr<KJS::UString::Rep> > : public StrHash<KJS::UString::Rep*> {
     450        using StrHash<KJS::UString::Rep*>::hash;
     451        static unsigned hash(const RefPtr<KJS::UString::Rep>& key) { return key->hash(); }
     452        using StrHash<KJS::UString::Rep*>::equal;
     453        static bool equal(const RefPtr<KJS::UString::Rep>& a, const RefPtr<KJS::UString::Rep>& b) { return KJS::equal(a.get(), b.get()); }
     454        static bool equal(const KJS::UString::Rep* a, const RefPtr<KJS::UString::Rep>& b) { return KJS::equal(a, b.get()); }
     455        static bool equal(const RefPtr<KJS::UString::Rep>& a, const KJS::UString::Rep* b) { return KJS::equal(a.get(), b); }
     456
     457        static const bool safeToCompareToEmptyOrDeleted = false;
     458    };
     459
     460    template<> struct DefaultHash<KJS::UString::Rep*> {
     461        typedef StrHash<KJS::UString::Rep*> Hash;
     462    };
     463
     464    template<> struct DefaultHash<RefPtr<KJS::UString::Rep> > {
     465        typedef StrHash<RefPtr<KJS::UString::Rep> > Hash;
     466    };
     467} // namespace WTF
    433468
    434469#endif
  • trunk/JavaScriptCore/profiler/ProfileNode.h

    r34310 r34361  
    3434#include <wtf/RefCounted.h>
    3535#include <wtf/RefPtr.h>
    36 #include <wtf/StrHash.h>
    3736
    3837namespace KJS {
Note: See TracChangeset for help on using the changeset viewer.