Changeset 37300 in webkit


Ignore:
Timestamp:
Oct 4, 2008 2:57:26 PM (16 years ago)
Author:
weinig@apple.com
Message:

2008-10-04 Sam Weinig <sam@webkit.org>

Reviewed by Oliver Hunt.

Fix https://bugs.webkit.org/show_bug.cgi?id=21320
leaks of PropertyNameArrayData seen on buildbot

  • Fix RefPtr cycle by making PropertyNameArrayData's pointer back to the StructureID a weak pointer.
  • kjs/PropertyNameArray.h: (JSC::PropertyNameArrayData::setCachedStructureID): (JSC::PropertyNameArrayData::cachedStructureID):
  • kjs/StructureID.cpp: (JSC::StructureID::getEnumerablePropertyNames): (JSC::StructureID::clearEnumerationCache): (JSC::StructureID::~StructureID):
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r37297 r37300  
     12008-10-04  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Fix https://bugs.webkit.org/show_bug.cgi?id=21320
     6        leaks of PropertyNameArrayData seen on buildbot
     7
     8        - Fix RefPtr cycle by making PropertyNameArrayData's pointer back
     9          to the StructureID a weak pointer.
     10
     11        * kjs/PropertyNameArray.h:
     12        (JSC::PropertyNameArrayData::setCachedStructureID):
     13        (JSC::PropertyNameArrayData::cachedStructureID):
     14        * kjs/StructureID.cpp:
     15        (JSC::StructureID::getEnumerablePropertyNames):
     16        (JSC::StructureID::clearEnumerationCache):
     17        (JSC::StructureID::~StructureID):
     18
    1192008-10-04  Darin Adler  <darin@apple.com>
    220
  • trunk/JavaScriptCore/kjs/PropertyNameArray.h

    r36789 r37300  
    4242        PropertyNameVector& propertyNameVector() { return m_propertyNameVector; }
    4343
    44         void setCachedStructureID(PassRefPtr<StructureID> structureID) { m_cachedStructureID = structureID; }
    45         StructureID* cachedStructureID() const { return m_cachedStructureID.get(); }
     44        void setCachedStructureID(StructureID* structureID) { m_cachedStructureID = structureID; }
     45        StructureID* cachedStructureID() const { return m_cachedStructureID; }
    4646
    4747        void setCachedPrototypeChain(PassRefPtr<StructureIDChain> cachedPrototypeChain) { m_cachedPrototypeChain = cachedPrototypeChain; }
     
    5050    private:
    5151        PropertyNameArrayData()
     52            : m_cachedStructureID(0)
    5253        {
    5354        }
    5455
    5556        PropertyNameVector m_propertyNameVector;
    56         RefPtr<StructureID> m_cachedStructureID;
     57        StructureID* m_cachedStructureID;
    5758        RefPtr<StructureIDChain> m_cachedPrototypeChain;
    5859    };
  • trunk/JavaScriptCore/kjs/StructureID.cpp

    r36977 r37300  
    8282
    8383    if (shouldCache) {
     84        if (m_cachedPropertyNameArrayData)
     85            m_cachedPropertyNameArrayData->setCachedStructureID(0);
     86
    8487        m_cachedPropertyNameArrayData = propertyNames.data();
    8588
     
    9497void StructureID::clearEnumerationCache()
    9598{
     99    if (m_cachedPropertyNameArrayData)
     100        m_cachedPropertyNameArrayData->setCachedStructureID(0);
    96101    m_cachedPropertyNameArrayData.clear();
    97102}
     
    183188        m_previous->m_transitionTable.remove(make_pair(m_nameInPrevious, m_attributesInPrevious));
    184189    }
     190
     191    if (m_cachedPropertyNameArrayData)
     192        m_cachedPropertyNameArrayData->setCachedStructureID(0);
    185193}
    186194
Note: See TracChangeset for help on using the changeset viewer.