Ignore:
Timestamp:
Jan 4, 2009, 4:18:53 PM (16 years ago)
Author:
[email protected]
Message:

2009-01-04 Alice Liu <[email protected]>

<rdar://problem/6341776> Merge m_transitionCount and m_offset in Structure.

Reviewed by Darin Adler.

  • runtime/Structure.cpp: (JSC::Structure::Structure): Remove m_transitionCount (JSC::Structure::addPropertyTransitionToExistingStructure): No need to wait until after the assignment to offset to assert if it's notFound; move it up. (JSC::Structure::addPropertyTransition): Use method for transitionCount instead of m_transitionCount. Remove line that maintains the m_transitionCount. (JSC::Structure::changePrototypeTransition): Remove line that maintains the m_transitionCount. (JSC::Structure::getterSetterTransition): Remove line that maintains the m_transitionCount.
  • runtime/Structure.h: Changed s_maxTransitionLength and m_offset from size_t to signed char. m_offset will never become greater than 64 because the structure transitions to a dictionary at that time. (JSC::Structure::transitionCount): method to replace the data member
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Structure.h

    r39502 r39593  
    107107        void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; }
    108108
    109         bool isEmpty() const { return m_propertyTable ? !m_propertyTable->keyCount : m_offset == WTF::notFound; }
     109        bool isEmpty() const { return m_propertyTable ? !m_propertyTable->keyCount : m_offset == noOffset; }
    110110
    111111    private:
     
    140140        }
    141141
     142        signed char transitionCount() const
     143        {
     144            // Since the number of transitions is always the same as m_offset, we keep the size of Structure down by not storing both.
     145            return m_offset == noOffset ? 0 : m_offset + 1;
     146        }
     147
    142148        static const unsigned emptyEntryIndex = 0;
    143149   
    144         static const size_t s_maxTransitionLength = 64;
     150        static const signed char s_maxTransitionLength = 64;
     151
     152        static const signed char noOffset = -1;
    145153
    146154        TypeInfo m_typeInfo;
     
    152160        RefPtr<UString::Rep> m_nameInPrevious;
    153161
    154         size_t m_transitionCount;
    155162        union {
    156163            Structure* singleTransition;
     
    163170
    164171        size_t m_propertyStorageCapacity;
    165         size_t m_offset;
     172        signed char m_offset;
    166173
    167174        bool m_isDictionary : 1;
Note: See TracChangeset for help on using the changeset viewer.