Ignore:
Timestamp:
Jul 29, 2008, 1:16:17 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Oliver Hunt.

Store UString::Rep::isStatic bit in identifierTable pointer instead of reportedCost for
slightly nicer code and a 0.5% SunSpider improvement.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/ustring.cpp

    r35227 r35418  
    170170// reduce the possibility of it becoming zero due to ref/deref not being thread-safe.
    171171static UChar sharedEmptyChar;
    172 UString::Rep UString::Rep::null = { 0, 0, INT_MAX / 2, 0, 0, &UString::Rep::null, true, 0, 0, 0, 0, 0, 0 };
    173 UString::Rep UString::Rep::empty = { 0, 0, INT_MAX / 2, 0, 0, &UString::Rep::empty, true, 0, &sharedEmptyChar, 0, 0, 0, 0 };
     172UString::Rep UString::Rep::null = { 0, 0, INT_MAX / 2, 0, 1, &UString::Rep::null, 0, 0, 0, 0, 0, 0 };
     173UString::Rep UString::Rep::empty = { 0, 0, INT_MAX / 2, 0, 1, &UString::Rep::empty, 0, &sharedEmptyChar, 0, 0, 0, 0 };
    174174
    175175static char* statBuffer = 0; // Only used for debugging via UString::ascii().
     
    191191    r->rc = 1;
    192192    r->_hash = 0;
    193     r->identifierTable = 0;
     193    r->m_identifierTable = 0;
    194194    r->baseString = r;
    195     r->isStatic = false;
    196195    r->reportedCost = 0;
    197196    r->buf = d;
     
    221220    r->rc = 1;
    222221    r->_hash = 0;
    223     r->identifierTable = 0;
     222    r->m_identifierTable = 0;
    224223    r->baseString = base.releaseRef();
    225     r->isStatic = false;
    226224    r->reportedCost = 0;
    227225    r->buf = 0;
     
    253251    // Static null and empty strings can never be destroyed, but we cannot rely on
    254252    // reference counting, because ref/deref are not thread-safe.
    255     if (!isStatic) {
    256         if (identifierTable)
     253    if (!isStatic()) {
     254        if (identifierTable())
    257255            Identifier::remove(this);
    258256        if (baseString == this)
Note: See TracChangeset for help on using the changeset viewer.