Ignore:
Timestamp:
Oct 9, 2008, 6:21:09 PM (17 years ago)
Author:
[email protected]
Message:

2008-10-09 Sam Weinig <[email protected]>

Reviewed by Maciej Stachowiak.

Add leaks checking to StructureID.

  • kjs/StructureID.cpp: (JSC::StructureID::StructureID): (JSC::StructureID::~StructureID):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/StructureID.cpp

    r37400 r37458  
    2727#include "StructureID.h"
    2828
    29 #include "identifier.h"
    3029#include "JSObject.h"
    3130#include "PropertyNameArray.h"
     31#include "identifier.h"
    3232#include "lookup.h"
     33#include <wtf/RefCountedLeakCounter.h>
    3334#include <wtf/RefPtr.h>
    3435
     
    3637
    3738namespace JSC {
     39
     40#ifndef NDEBUG   
     41static WTF::RefCountedLeakCounter structureIDCounter("StructureID");
     42#endif
    3843
    3944StructureID::StructureID(JSValue* prototype, const TypeInfo& typeInfo)
     
    5156    ASSERT(m_prototype);
    5257    ASSERT(m_prototype->isObject() || m_prototype->isNull());
     58
     59#ifndef NDEBUG
     60    structureIDCounter.increment();
     61#endif
     62}
     63
     64StructureID::~StructureID()
     65{
     66    if (m_previous) {
     67        ASSERT(m_previous->m_transitionTable.contains(make_pair(m_nameInPrevious, m_attributesInPrevious)));
     68        m_previous->m_transitionTable.remove(make_pair(m_nameInPrevious, m_attributesInPrevious));
     69    }
     70
     71    if (m_cachedPropertyNameArrayData)
     72        m_cachedPropertyNameArrayData->setCachedStructureID(0);
     73
     74#ifndef NDEBUG
     75    structureIDCounter.decrement();
     76#endif
    5377}
    5478
     
    195219}
    196220
    197 StructureID::~StructureID()
    198 {
    199     if (m_previous) {
    200         ASSERT(m_previous->m_transitionTable.contains(make_pair(m_nameInPrevious, m_attributesInPrevious)));
    201         m_previous->m_transitionTable.remove(make_pair(m_nameInPrevious, m_attributesInPrevious));
    202     }
    203 
    204     if (m_cachedPropertyNameArrayData)
    205         m_cachedPropertyNameArrayData->setCachedStructureID(0);
    206 }
    207 
    208221StructureIDChain* StructureID::createCachedPrototypeChain()
    209222{
Note: See TracChangeset for help on using the changeset viewer.