Ignore:
Timestamp:
May 11, 2010, 7:25:40 PM (15 years ago)
Author:
[email protected]
Message:

Patch by Gavin Barraclough.

Reviewed by Maciej Stachowiak.

Rest of REGRESSION (r57900-57919): 3% PLT Regression from moving strings into WTF.
https://bugs.webkit.org/show_bug.cgi?id=38930
<rdar://problem/7937188>

Inline string functions that are commonly used in WTFString, CString, and AtomicString.

  • JavaScriptCore.exp: Remove exports of inline functions.
  • wtf/text/AtomicString.cpp:

(WebCore::AtomicString::addSlowCase): Rename add to addSlowCase, and inline the fast path

of add.

  • wtf/text/AtomicString.h:

(WebCore::AtomicString::add): Inline the fast path of add.

  • wtf/text/CString.cpp: Inline implementation of data and length in the header.
  • wtf/text/CString.h:

(WTF::CString::data): Inline implementation of data.
(WTF::CString::length): Inline implementation of length.

  • wtf/text/WTFString.cpp: Remove implementations of functions to be inlined.
  • wtf/text/WTFString.h:

(WebCore::String::String): Inline implementation.
(WebCore::String::length): Ditto.
(WebCore::String::characters): Ditto.
(WebCore::String::operator[]): Ditto.
(WebCore::String::isEmpty): Ditto.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/text/WTFString.cpp

    r57904 r59196  
    3838namespace WebCore {
    3939
    40 String::String(const UChar* str, unsigned len)
    41 {
    42     if (!str)
    43         return;
    44     m_impl = StringImpl::create(str, len);
    45 }
    46 
    4740String::String(const UChar* str)
    4841{
     
    5548   
    5649    m_impl = StringImpl::create(str, len);
    57 }
    58 
    59 String::String(const char* str)
    60 {
    61     if (!str)
    62         return;
    63     m_impl = StringImpl::create(str);
    64 }
    65 
    66 String::String(const char* str, unsigned length)
    67 {
    68     if (!str)
    69         return;
    70     m_impl = StringImpl::create(str, length);
    7150}
    7251
     
    203182}
    204183
    205 UChar String::operator[](unsigned i) const
     184UChar32 String::characterStartingAt(unsigned i) const
    206185{
    207186    if (!m_impl || i >= m_impl->length())
    208187        return 0;
    209     return m_impl->characters()[i];
    210 }
    211 
    212 UChar32 String::characterStartingAt(unsigned i) const
    213 {
    214     if (!m_impl || i >= m_impl->length())
    215         return 0;
    216188    return m_impl->characterStartingAt(i);
    217 }
    218 
    219 unsigned String::length() const
    220 {
    221     if (!m_impl)
    222         return 0;
    223     return m_impl->length();
    224189}
    225190
     
    310275    result = charactersToIntStrict(m_impl->characters(), m_impl->length() - 1);
    311276    return true;
    312 }
    313 
    314 const UChar* String::characters() const
    315 {
    316     if (!m_impl)
    317         return 0;
    318     return m_impl->characters();
    319277}
    320278
     
    592550}
    593551
    594 bool String::isEmpty() const
    595 {
    596     return !m_impl || !m_impl->length();
    597 }
    598 
    599552void String::split(const String& separator, bool allowEmptyEntries, Vector<String>& result) const
    600553{
Note: See TracChangeset for help on using the changeset viewer.