Changeset 48264 in webkit for trunk/JavaScriptCore/wtf


Ignore:
Timestamp:
Sep 10, 2009, 1:01:57 PM (16 years ago)
Author:
[email protected]
Message:

Refactor StructureTransitionTable and Structure to unify handling of the single slot optimization
https://bugs.webkit.org/show_bug.cgi?id=29141

Reviewed by Geoff Garen

Make StructureTransitionTable encapsulate the single transition slot optimization.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/PtrAndFlags.h

    r46879 r48264  
    3535
    3636namespace WTF {
    37     template<class T, typename FlagEnum> class PtrAndFlags {
     37    template<class T, typename FlagEnum> class PtrAndFlagsBase {
    3838    public:
    39         PtrAndFlags() : m_ptrAndFlags(0) {}
    40         PtrAndFlags(T* ptr) : m_ptrAndFlags(0) { set(ptr); }
    41 
    4239        bool isFlagSet(FlagEnum flagNumber) const { ASSERT(flagNumber < 2); return m_ptrAndFlags & (1 << flagNumber); }
    4340        void setFlag(FlagEnum flagNumber) { ASSERT(flagNumber < 2); m_ptrAndFlags |= (1 << flagNumber);}
     
    5653        T* operator->() const { return reinterpret_cast<T*>(m_ptrAndFlags & ~3); }
    5754
    58     private:
     55    protected:
    5956        intptr_t m_ptrAndFlags;
    6057#ifndef NDEBUG
     
    6259#endif
    6360    };
     61
     62    template<class T, typename FlagEnum> class PtrAndFlags : public PtrAndFlagsBase<T, FlagEnum> {
     63    public:
     64        PtrAndFlags()
     65        {
     66            PtrAndFlagsBase<T, FlagEnum>::m_ptrAndFlags = 0;
     67        }
     68        PtrAndFlags(T* ptr)
     69        {
     70            PtrAndFlagsBase<T, FlagEnum>::m_ptrAndFlags = 0;
     71            set(ptr);
     72        }
     73    };
    6474} // namespace WTF
    6575
     76using WTF::PtrAndFlagsBase;
    6677using WTF::PtrAndFlags;
    6778
Note: See TracChangeset for help on using the changeset viewer.