2008-10-16 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Oct 2008 11:11:24 +0000 (11:11 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Oct 2008 11:11:24 +0000 (11:11 +0000)
        Reviewed by Cameron Zwarich.

        - fix for: REGRESSION: over 100 StructureIDs leak loading about:blank (result of fix for bug 21633)

        Apparent slight progression (< 0.5%) on v8 benchmarks and SunSpider.

        * kjs/StructureID.cpp:
        (JSC::StructureID::~StructureID): Don't deref this object's parent's pointer to
        itself from the destructor; that doesn't even make sense.
        (JSC::StructureID::addPropertyTransition): Don't refer the single transition;
        the rule is that parent StructureIDs are ref'd but child ones are not. Refing
        the child creates a cycle.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@37632 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/StructureID.cpp

index 040e37afe5f2b896c7fb1ec0fdebec8383018bcb..3a9c4028571aed5952ce29597b330d6bd6d1e7a5 100644 (file)
@@ -1,3 +1,18 @@
+2008-10-16  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Cameron Zwarich.
+        
+        - fix for: REGRESSION: over 100 StructureIDs leak loading about:blank (result of fix for bug 21633)
+        
+        Apparent slight progression (< 0.5%) on v8 benchmarks and SunSpider.
+
+        * kjs/StructureID.cpp:
+        (JSC::StructureID::~StructureID): Don't deref this object's parent's pointer to
+        itself from the destructor; that doesn't even make sense.
+        (JSC::StructureID::addPropertyTransition): Don't refer the single transition;
+        the rule is that parent StructureIDs are ref'd but child ones are not. Refing
+        the child creates a cycle.
+
 2008-10-15  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Darin Adler.
index b2db9b9176b890d169fd73d50c4621d7a1b0be7f..f72fdd2e17a7e0b74493bbff9c0898fbcf751445 100644 (file)
@@ -108,7 +108,6 @@ StructureID::~StructureID()
 {
     if (m_previous) {
         if (m_previous->m_usingSingleTransitionSlot) {
-            m_previous->m_transitions.singleTransition->deref();
             m_previous->m_transitions.singleTransition = 0;
         } else {
             ASSERT(m_previous->m_transitions.table->contains(make_pair(m_nameInPrevious, m_attributesInPrevious)));
@@ -119,10 +118,7 @@ StructureID::~StructureID()
     if (m_cachedPropertyNameArrayData)
         m_cachedPropertyNameArrayData->setCachedStructureID(0);
 
-    if (m_usingSingleTransitionSlot) {
-        if (m_transitions.singleTransition)
-            m_transitions.singleTransition->deref();
-    } else
+    if (!m_usingSingleTransitionSlot)
         delete m_transitions.table;
 
 #ifndef NDEBUG
@@ -265,7 +261,6 @@ PassRefPtr<StructureID> StructureID::addPropertyTransition(StructureID* structur
     if (structureID->m_usingSingleTransitionSlot) {
         if (!structureID->m_transitions.singleTransition) {
             structureID->m_transitions.singleTransition = transition.get();
-            transition->ref();
             return transition.release();
         }
 
@@ -274,7 +269,6 @@ PassRefPtr<StructureID> StructureID::addPropertyTransition(StructureID* structur
         TransitionTable* transitionTable = new TransitionTable;
         structureID->m_transitions.table = transitionTable;
         transitionTable->add(make_pair(existingTransition->m_nameInPrevious, existingTransition->m_attributesInPrevious), existingTransition);
-        existingTransition->deref();
     }
     structureID->m_transitions.table->add(make_pair(propertyName.ustring().rep(), attributes), transition.get());
     return transition.release();