Changeset 43090 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Apr 30, 2009, 2:18:31 PM (16 years ago)
Author:
[email protected]
Message:

2009-04-30 Maciej Stachowiak <[email protected]>

Reviewed by Geoff Garen.

  • make BaseStrings have themselves as a base, instead of nothing, to remove common branches

~0.7% SunSpider speedup

  • runtime/UString.h: (JSC::UString::Rep::Rep): For the constructor without a base, set self as base instead of null. (JSC::UString::Rep::baseString): Just read m_baseString - no more branching.
Location:
trunk/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r43087 r43090  
     12009-04-30  Maciej Stachowiak  <[email protected]>
     2
     3        Reviewed by Geoff Garen.
     4
     5        - make BaseStrings have themselves as a base, instead of nothing, to remove common branches
     6
     7        ~0.7% SunSpider speedup
     8
     9        * runtime/UString.h:
     10        (JSC::UString::Rep::Rep): For the constructor without a base, set self as base instead of null.
     11        (JSC::UString::Rep::baseString): Just read m_baseString - no more branching.
     12
    1132009-04-30  Gavin Barraclough  <[email protected]>
    214
  • trunk/JavaScriptCore/runtime/UString.h

    r42680 r43090  
    134134
    135135        protected:
     136            // constructor for use by BaseString subclass; they are their own bases
    136137            Rep(int length)
    137138                : offset(0)
     
    139140                , rc(1)
    140141                , _hash(0)
    141                 , m_nothing(0)
     142                , m_baseString(static_cast<BaseString*>(this))
    142143            {
    143144            }
     
    153154            }
    154155
    155             union {
    156                 // If !baseIsSelf()
    157                 BaseString* m_baseString;
    158                 // If baseIsSelf()
    159                 void* m_nothing;
    160             };
     156
     157            BaseString* m_baseString;
    161158
    162159        private:
     
    411408    inline UString::BaseString* UString::Rep::baseString()
    412409    {
    413         return baseIsSelf() ? reinterpret_cast<BaseString*>(this) : m_baseString;
     410        return m_baseString;
    414411    }
    415412
    416413    inline const UString::BaseString* UString::Rep::baseString() const
    417414    {
    418         return const_cast<Rep*>(this)->baseString();
     415        return m_baseString;
    419416    }
    420417
Note: See TracChangeset for help on using the changeset viewer.