Skip to content
Permalink
Browse files
2008-10-09 Sam Weinig <sam@webkit.org>
        Reviewed by Maciej Stachowiak.

        Add leaks checking to StructureID.

        * kjs/StructureID.cpp:
        (JSC::StructureID::StructureID):
        (JSC::StructureID::~StructureID):



Canonical link: https://commits.webkit.org/29703@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@37458 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
weinig committed Oct 10, 2008
1 parent 9a3a8bc commit 5f73b62031bc3dd15bcdb098539e39ab85869f1f
Showing 2 changed files with 35 additions and 12 deletions.
@@ -1,3 +1,13 @@
2008-10-09 Sam Weinig <sam@webkit.org>

Reviewed by Maciej Stachowiak.

Add leaks checking to StructureID.

* kjs/StructureID.cpp:
(JSC::StructureID::StructureID):
(JSC::StructureID::~StructureID):

2008-10-09 Alp Toker <alp@nuanti.com>

Reviewed by Mark Rowe.
@@ -26,16 +26,21 @@
#include "config.h"
#include "StructureID.h"

#include "identifier.h"
#include "JSObject.h"
#include "PropertyNameArray.h"
#include "identifier.h"
#include "lookup.h"
#include <wtf/RefCountedLeakCounter.h>
#include <wtf/RefPtr.h>

using namespace std;

namespace JSC {

#ifndef NDEBUG
static WTF::RefCountedLeakCounter structureIDCounter("StructureID");
#endif

StructureID::StructureID(JSValue* prototype, const TypeInfo& typeInfo)
: m_typeInfo(typeInfo)
, m_isDictionary(false)
@@ -50,6 +55,25 @@ StructureID::StructureID(JSValue* prototype, const TypeInfo& typeInfo)
{
ASSERT(m_prototype);
ASSERT(m_prototype->isObject() || m_prototype->isNull());

#ifndef NDEBUG
structureIDCounter.increment();
#endif
}

StructureID::~StructureID()
{
if (m_previous) {
ASSERT(m_previous->m_transitionTable.contains(make_pair(m_nameInPrevious, m_attributesInPrevious)));
m_previous->m_transitionTable.remove(make_pair(m_nameInPrevious, m_attributesInPrevious));
}

if (m_cachedPropertyNameArrayData)
m_cachedPropertyNameArrayData->setCachedStructureID(0);

#ifndef NDEBUG
structureIDCounter.decrement();
#endif
}

void StructureID::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject)
@@ -194,17 +218,6 @@ PassRefPtr<StructureID> StructureID::getterSetterTransition(StructureID* structu
return transition.release();
}

StructureID::~StructureID()
{
if (m_previous) {
ASSERT(m_previous->m_transitionTable.contains(make_pair(m_nameInPrevious, m_attributesInPrevious)));
m_previous->m_transitionTable.remove(make_pair(m_nameInPrevious, m_attributesInPrevious));
}

if (m_cachedPropertyNameArrayData)
m_cachedPropertyNameArrayData->setCachedStructureID(0);
}

StructureIDChain* StructureID::createCachedPrototypeChain()
{
ASSERT(typeInfo().type() == ObjectType);

0 comments on commit 5f73b62

Please sign in to comment.