Ignore:
Timestamp:
Jun 9, 2015, 11:03:40 AM (10 years ago)
Author:
[email protected]
Message:

[JSC] JSString::getIndex() should avoid reifying substrings.
<https://webkit.org/b/145803>

Reviewed by Darin Adler.

Implement getIndex() using JSString::view(), which cuts it down to a one-liner
and also avoids reifying substrings.

I saw 178 kB of reified substrings below operationGetByVal -> getIndex()
on cnet.com, so this should help.

  • runtime/JSString.cpp:

(JSC::JSRopeString::getIndexSlowCase): Deleted.

  • runtime/JSString.h:

(JSC::JSString::getIndex):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSString.h

    r185109 r185368  
    373373    StringView view(ExecState*) const;
    374374
    375     JS_EXPORT_PRIVATE JSString* getIndexSlowCase(ExecState*, unsigned);
    376 
    377375    WriteBarrierBase<JSString>& fiber(unsigned i) const
    378376    {
     
    494492{
    495493    ASSERT(canGetIndex(i));
    496     if (isRope())
    497         return static_cast<JSRopeString*>(this)->getIndexSlowCase(exec, i);
    498     ASSERT(i < m_value.length());
    499     return jsSingleCharacterString(exec, m_value[i]);
     494    return jsSingleCharacterString(exec, view(exec)[i]);
    500495}
    501496
Note: See TracChangeset for help on using the changeset viewer.