Ignore:
Timestamp:
Oct 19, 2011, 12:45:35 PM (14 years ago)
Author:
[email protected]
Message:

Some rope cleanup following r97827
https://bugs.webkit.org/show_bug.cgi?id=70398

Reviewed by Oliver Hunt.

9% speedup on date-format-xparb, neutral overall.

  • Removed RopeImpl*.
  • Removed JSString::m_fiberCount, since this can be deduced from other data.
  • Renamed a jsString() variant to jsStringFromArguments for clarity.
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileGetCharCodeAt):
(JSC::DFG::SpeculativeJIT::compileGetByValOnString):

  • jit/JITInlineMethods.h:

(JSC::JIT::emitLoadCharacterString):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::stringGetByValStubGenerator):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::stringGetByValStubGenerator):

  • jit/SpecializedThunkJIT.h:

(JSC::SpecializedThunkJIT::loadJSStringArgument):

  • jit/ThunkGenerators.cpp:

(JSC::stringCharLoad): Use a NULL m_value to signal rope-iness, instead
of testing m_fiberCount, since m_fiberCount is gone now.

  • runtime/JSString.cpp:

(JSC::JSString::RopeBuilder::expand):
(JSC::JSString::visitChildren):
(JSC::JSString::resolveRope):
(JSC::JSString::resolveRopeSlowCase):
(JSC::JSString::outOfMemory): Use a NULL fiber to indicate "last fiber
in the vector" instead of testing m_fiberCount, since m_fiberCount is gone now.

  • runtime/JSString.h:

(JSC::RopeBuilder::JSString):
(JSC::RopeBuilder::finishCreation):
(JSC::RopeBuilder::offsetOfLength):
(JSC::RopeBuilder::isRope):
(JSC::RopeBuilder::string): Removed m_fiberCount. Renamed
jsString => jsStringFromArguments for clarity.

  • runtime/Operations.h:

(JSC::jsStringFromArguments): Renamed.

  • runtime/RopeImpl.cpp: Removed.
  • runtime/RopeImpl.h: Removed.
  • runtime/SmallStrings.cpp:

(JSC::SmallStrings::createEmptyString): Switched to StringImpl::empty,
which is slightly faster.

  • runtime/StringPrototype.cpp:

(JSC::stringProtoFuncConcat): Updated for rename.

  • wtf/text/StringImplBase.h:

(WTF::StringImplBase::StringImplBase): Removed the concept of an invalid
StringImpl, since this was only used by RopeImpl, which is now gone.

File:
1 edited

Legend:

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

    r97827 r97872  
    2929#include "PropertyDescriptor.h"
    3030#include "PropertySlot.h"
    31 #include "RopeImpl.h"
    3231#include "Structure.h"
    3332
     
    7776                : m_globalData(globalData)
    7877                , m_jsString(jsStringBuilder(&globalData))
     78                , m_index(0)
    7979            {
    8080            }
     
    8282            void append(JSString* jsString)
    8383            {
    84                 if (m_jsString->m_fiberCount == JSString::s_maxInternalRopeLength)
     84                if (m_index == JSString::s_maxInternalRopeLength)
    8585                    expand();
    86                 m_jsString->m_fibers[m_jsString->m_fiberCount].set(m_globalData, m_jsString, jsString);
    87                 m_jsString->m_fiberCount += 1;
     86                m_jsString->m_fibers[m_index++].set(m_globalData, m_jsString, jsString);
    8887                m_jsString->m_length += jsString->m_length;
    8988            }
     
    103102            JSGlobalData& m_globalData;
    104103            JSString* m_jsString;
     104            size_t m_index;
    105105        };
    106106
     
    109109            : JSCell(globalData, globalData.stringStructure.get())
    110110            , m_value(value)
    111             , m_fiberCount(0)
    112111        {
    113112        }
     
    115114        JSString(JSGlobalData& globalData)
    116115            : JSCell(globalData, globalData.stringStructure.get())
    117             , m_fiberCount(0)
    118116        {
    119117        }
     
    144142            Base::finishCreation(globalData);
    145143            m_length = s1->length() + s2->length();
    146             m_fiberCount = 2;
    147144            m_fibers[0].set(globalData, this, s1);
    148145            m_fibers[1].set(globalData, this, s2);
     
    153150            Base::finishCreation(globalData);
    154151            m_length = s1->length() + s2->length() + s3->length();
    155             m_fiberCount = 3;
    156152            m_fibers[0].set(globalData, this, s1);
    157153            m_fibers[1].set(globalData, this, s2);
     
    236232
    237233        static size_t offsetOfLength() { return OBJECT_OFFSETOF(JSString, m_length); }
    238         static size_t offsetOfFiberCount() { return OBJECT_OFFSETOF(JSString, m_fiberCount); }
    239234        static size_t offsetOfValue() { return OBJECT_OFFSETOF(JSString, m_value); }
    240235
     
    246241        JSString(VPtrStealingHackType)
    247242            : JSCell(VPtrStealingHack)
    248             , m_fiberCount(0)
    249243        {
    250244        }
     
    265259        static const unsigned s_maxInternalRopeLength = 3;
    266260
    267         // A string is represented either by a UString or a RopeImpl.
     261        // A string is represented either by a UString or a rope of fibers.
    268262        unsigned m_length;
    269263        mutable UString m_value;
    270         mutable unsigned m_fiberCount;
    271264        mutable FixedArray<WriteBarrier<JSString>, s_maxInternalRopeLength> m_fibers;
    272265
    273         bool isRope() const { return m_fiberCount; }
     266        bool isRope() const { return m_value.isNull(); }
    274267        UString& string() { ASSERT(!isRope()); return m_value; }
    275         unsigned fiberCount() { return m_fiberCount ? m_fiberCount : 1; }
    276 
    277         friend JSValue jsString(ExecState* exec, JSString* s1, JSString* s2);
    278         friend JSValue jsString(ExecState* exec, Register* strings, unsigned count);
    279         friend JSValue jsString(ExecState* exec, JSValue thisValue);
    280         friend JSString* jsSubstring(ExecState* exec, JSString* s, unsigned offset, unsigned length);
     268
     269        friend JSValue jsString(ExecState*, JSString*, JSString*);
     270        friend JSValue jsString(ExecState*, Register*, unsigned count);
     271        friend JSValue jsStringFromArguments(ExecState*, JSValue thisValue);
     272        friend JSString* jsSubstring(ExecState*, JSString*, unsigned offset, unsigned length);
    281273    };
    282274
Note: See TracChangeset for help on using the changeset viewer.