⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 169903 in webkit


Ignore:
Timestamp:
Jun 12, 2014, 11:22:46 AM (12 years ago)
Author:
mhahnenberg@apple.com
Message:

Move structureHasRareData out of TypeInfo
​https://bugs.webkit.org/show_bug.cgi?id=133800

Reviewed by Andreas Kling.

StructureHasRareData was originally put in TypeInfo to avoid making Structure bigger,
but we have a few spare bits in Structure so it would be nice to remove this hack.

  • runtime/JSTypeInfo.h:

(JSC::TypeInfo::newImpurePropertyFiresWatchpoints):
(JSC::TypeInfo::structureHasRareData): Deleted.

  • runtime/Structure.cpp:

(JSC::Structure::Structure):
(JSC::Structure::allocateRareData):
(JSC::Structure::cloneRareDataFrom):

  • runtime/Structure.h:

(JSC::Structure::previousID):
(JSC::Structure::objectToStringValue):
(JSC::Structure::setObjectToStringValue):
(JSC::Structure::setPreviousID):
(JSC::Structure::clearPreviousID):
(JSC::Structure::previous):
(JSC::Structure::rareData):

  • runtime/StructureInlines.h:

(JSC::Structure::setEnumerationCache):
(JSC::Structure::enumerationCache):

Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r169889 r169903  
     12014-06-12  Mark Hahnenberg  <mhahnenberg@apple.com>
     2
     3        Move structureHasRareData out of TypeInfo
     4        https://bugs.webkit.org/show_bug.cgi?id=133800
     5
     6        Reviewed by Andreas Kling.
     7
     8        StructureHasRareData was originally put in TypeInfo to avoid making Structure bigger,
     9        but we have a few spare bits in Structure so it would be nice to remove this hack.
     10
     11        * runtime/JSTypeInfo.h:
     12        (JSC::TypeInfo::newImpurePropertyFiresWatchpoints):
     13        (JSC::TypeInfo::structureHasRareData): Deleted.
     14        * runtime/Structure.cpp:
     15        (JSC::Structure::Structure):
     16        (JSC::Structure::allocateRareData):
     17        (JSC::Structure::cloneRareDataFrom):
     18        * runtime/Structure.h:
     19        (JSC::Structure::previousID):
     20        (JSC::Structure::objectToStringValue):
     21        (JSC::Structure::setObjectToStringValue):
     22        (JSC::Structure::setPreviousID):
     23        (JSC::Structure::clearPreviousID):
     24        (JSC::Structure::previous):
     25        (JSC::Structure::rareData):
     26        * runtime/StructureInlines.h:
     27        (JSC::Structure::setEnumerationCache):
     28        (JSC::Structure::enumerationCache):
     29
    1302014-06-12  Zsolt Borbely  <zsborbely.u-szeged@partner.samsung.com>
    231
  • trunk/Source/JavaScriptCore/runtime/JSTypeInfo.h

    r165676 r169903  
    5050    static const unsigned HasImpureGetOwnPropertySlot = 1 << 10;
    5151    static const unsigned NewImpurePropertyFiresWatchpoints = 1 << 11;
    52     static const unsigned StructureHasRareData = 1 << 12;
    53     static const unsigned StructureIsImmortal = 1 << 13;
     52    static const unsigned StructureIsImmortal = 1 << 12;
    5453
    5554    class TypeInfo {
    … …  
    9796        bool hasImpureGetOwnPropertySlot() const { return isSetOnFlags2(HasImpureGetOwnPropertySlot); }
    9897        bool newImpurePropertyFiresWatchpoints() const { return isSetOnFlags2(NewImpurePropertyFiresWatchpoints); }
    99         bool structureHasRareData() const { return isSetOnFlags2(StructureHasRareData); }
    10098        bool structureIsImmortal() const { return isSetOnFlags2(StructureIsImmortal); }
    10199
  • trunk/Source/JavaScriptCore/runtime/Structure.cpp

    r169853 r169903  
    170170    , m_didTransition(false)
    171171    , m_staticFunctionReified(false)
     172    , m_hasRareData(false)
    172173{
    173174    ASSERT(inlineCapacity <= JSFinalObject::maxInlineCapacity());
    174175    ASSERT(static_cast<PropertyOffset>(inlineCapacity) < firstOutOfLineOffset);
    175     ASSERT(!typeInfo.structureHasRareData());
     176    ASSERT(!m_hasRareData);
    176177    ASSERT(hasReadOnlyOrGetterSetterPropertiesExcludingProto() || !m_classInfo->hasStaticSetterOrReadonlyProperties(vm));
    177178    ASSERT(hasGetterSetterProperties() || !m_classInfo->hasStaticSetterOrReadonlyProperties(vm));
    … …  
    199200    , m_didTransition(false)
    200201    , m_staticFunctionReified(false)
     202    , m_hasRareData(false)
    201203{
    202204    TypeInfo typeInfo = TypeInfo(CompoundType, OverridesVisitChildren | StructureIsImmortal);
    … …  
    227229    , m_didTransition(true)
    228230    , m_staticFunctionReified(previous->m_staticFunctionReified)
    229 {
    230     TypeInfo typeInfo = TypeInfo(previous->typeInfo().type(), previous->typeInfo().flags() & ~StructureHasRareData);
     231    , m_hasRareData(false)
     232{
     233    TypeInfo typeInfo = previous->typeInfo();
    231234    m_blob = StructureIDBlob(vm.heap.structureIDTable().allocateID(this), previous->indexingTypeIncludingHistory(), typeInfo);
    232235    m_outOfLineTypeFlags = typeInfo.outOfLineTypeFlags();
    233236
    234237    ASSERT(!previous->typeInfo().structureIsImmortal());
    235     if (previous->typeInfo().structureHasRareData() && previous->rareData()->needsCloning())
     238    if (previous->m_hasRareData && previous->rareData()->needsCloning())
    236239        cloneRareDataFrom(vm, previous);
    237240    setPreviousID(vm, this, previous);
    … …  
    791794void Structure::allocateRareData(VM& vm)
    792795{
    793     ASSERT(!typeInfo().structureHasRareData());
     796    ASSERT(!m_hasRareData);
    794797    StructureRareData* rareData = StructureRareData::create(vm, previous());
    795     TypeInfo oldTypeInfo = typeInfo();
    796     TypeInfo newTypeInfo = TypeInfo(oldTypeInfo.type(), oldTypeInfo.flags() | StructureHasRareData);
    797     m_outOfLineTypeFlags = newTypeInfo.outOfLineTypeFlags();
    798798    m_previousOrRareData.set(vm, this, rareData);
    799     ASSERT(typeInfo().structureHasRareData());
     799    m_hasRareData = true;
     800    ASSERT(m_hasRareData);
    800801}
    801802
    802803void Structure::cloneRareDataFrom(VM& vm, const Structure* other)
    803804{
    804     ASSERT(other->typeInfo().structureHasRareData());
     805    ASSERT(!m_hasRareData);
     806    ASSERT(other->m_hasRareData);
    805807    StructureRareData* newRareData = StructureRareData::clone(vm, other->rareData());
    806     TypeInfo oldTypeInfo = typeInfo();
    807     TypeInfo newTypeInfo = TypeInfo(oldTypeInfo.type(), oldTypeInfo.flags() | StructureHasRareData);
    808     m_outOfLineTypeFlags = newTypeInfo.outOfLineTypeFlags();
    809808    m_previousOrRareData.set(vm, this, newRareData);
    810     ASSERT(typeInfo().structureHasRareData());
     809    m_hasRareData = true;
     810    ASSERT(m_hasRareData);
    811811}
    812812
  • trunk/Source/JavaScriptCore/runtime/Structure.h

    r169853 r169903  
    197197    {
    198198        ASSERT(structure()->classInfo() == info());
    199         if (typeInfo().structureHasRareData())
     199        if (m_hasRareData)
    200200            return rareData()->previousID();
    201201        return previous();
    … …  
    306306    JSString* objectToStringValue()
    307307    {
    308         if (!typeInfo().structureHasRareData())
     308        if (!m_hasRareData)
    309309            return 0;
    310310        return rareData()->objectToStringValue();
    … …  
    313313    void setObjectToStringValue(VM& vm, const JSCell* owner, JSString* value)
    314314    {
    315         if (!typeInfo().structureHasRareData())
     315        if (!m_hasRareData)
    316316            allocateRareData(vm);
    317317        rareData()->setObjectToStringValue(vm, owner, value);
    … …  
    459459    void setPreviousID(VM& vm, Structure* transition, Structure* structure)
    460460    {
    461         if (typeInfo().structureHasRareData())
     461        if (m_hasRareData)
    462462            rareData()->setPreviousID(vm, transition, structure);
    463463        else
    … …  
    467467    void clearPreviousID()
    468468    {
    469         if (typeInfo().structureHasRareData())
     469        if (m_hasRareData)
    470470            rareData()->clearPreviousID();
    471471        else
    … …  
    486486    Structure* previous() const
    487487    {
    488         ASSERT(!typeInfo().structureHasRareData());
     488        ASSERT(!m_hasRareData);
    489489        return static_cast<Structure*>(m_previousOrRareData.get());
    490490    }
    … …  
    492492    StructureRareData* rareData() const
    493493    {
    494         ASSERT(typeInfo().structureHasRareData());
     494        ASSERT(m_hasRareData);
    495495        return static_cast<StructureRareData*>(m_previousOrRareData.get());
    496496    }
    … …  
    550550    unsigned m_didTransition : 1;
    551551    unsigned m_staticFunctionReified : 1;
     552    bool m_hasRareData : 1;
    552553};
    553554
  • trunk/Source/JavaScriptCore/runtime/StructureInlines.h

    r169823 r169903  
    155155{
    156156    ASSERT(!isDictionary());
    157     if (!typeInfo().structureHasRareData())
     157    if (!m_hasRareData)
    158158        allocateRareData(vm);
    159159    rareData()->setEnumerationCache(vm, this, enumerationCache);
    … …  
    162162inline JSPropertyNameIterator* Structure::enumerationCache()
    163163{
    164     if (!typeInfo().structureHasRareData())
     164    if (!m_hasRareData)
    165165        return 0;
    166166    return rareData()->enumerationCache();
Note: See TracChangeset for help on using the changeset viewer.