Ignore:
Timestamp:
Mar 10, 2010, 6:36:08 PM (15 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=35991
Would be faster to not use a thread specific to implement StringImpl::empty()

Reviewed by Darin Adler, Geoffrey Garen, Maciej Stachowiak.

JavaScriptCore:

Change JSC::UStringImpl's implementation of empty() match to match StringImpl's new implementation
(use a static defined within the empty() method), and change the interface to match too (return
a pointer not a reference).

~0% performance impact (possible minor progression from moving empty() from .h to .cpp).

(JSC::Identifier::add):
(JSC::Identifier::addSlowCase):

  • runtime/PropertyNameArray.cpp:

(JSC::PropertyNameArray::add):

  • runtime/UString.cpp:

(JSC::initializeUString):
(JSC::UString::UString):

  • runtime/UStringImpl.cpp:

(JSC::UStringImpl::empty):
(JSC::UStringImpl::create):

  • runtime/UStringImpl.h:

(JSC::UStringImpl::adopt):
(JSC::UStringImpl::createUninitialized):
(JSC::UStringImpl::tryCreateUninitialized):

WebCore:

Copy JavaScriptCore in making 'static' strings threadsafe, make the empty string a static,
shared by all threads.

~2% progression on Dromaeo DOM core & JS lib tests.

  • platform/ThreadGlobalData.cpp:

(WebCore::ThreadGlobalData::ThreadGlobalData):
(WebCore::ThreadGlobalData::~ThreadGlobalData):

  • platform/ThreadGlobalData.h:

(WebCore::ThreadGlobalData::eventNames):

  • platform/text/StringImpl.cpp:

(WebCore::StringImpl::StringImpl):
(WebCore::StringImpl::empty):

  • platform/text/StringImpl.h:

(WebCore::StringImpl::deref):
(WebCore::StringImpl::hasOneRef):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Identifier.cpp

    r55751 r55825  
    131131    }
    132132    if (!c[0]) {
    133         UString::Rep::empty().hash();
    134         return &UString::Rep::empty();
     133        UString::Rep::empty()->hash();
     134        return UString::Rep::empty();
    135135    }
    136136    if (!c[1])
     
    195195    }
    196196    if (!length) {
    197         UString::Rep::empty().hash();
    198         return &UString::Rep::empty();
     197        UString::Rep::empty()->hash();
     198        return UString::Rep::empty();
    199199    }
    200200    UCharBuffer buf = {s, length};
     
    226226    }
    227227    if (!r->length()) {
    228         UString::Rep::empty().hash();
    229         return &UString::Rep::empty();
     228        UString::Rep::empty()->hash();
     229        return UString::Rep::empty();
    230230    }
    231231    return *globalData->identifierTable->add(r).first;
Note: See TracChangeset for help on using the changeset viewer.