Changeset 39956 in webkit for trunk/JavaScriptCore/runtime


Ignore:
Timestamp:
Jan 15, 2009, 4:53:41 PM (16 years ago)
Author:
[email protected]
Message:

2009-01-15 Sam Weinig <[email protected]>

Reviewed by Geoffrey Garen.

<rdar://problem/6045018>
REGRESSION (r34838): JavaScript objects appear to be leaked after loading google.com

Subtract the number of JSStrings cached in SmallStrings when calculating the
number of live JSObjects.

  • runtime/Collector.cpp: (JSC::Heap::objectCount):
  • runtime/SmallStrings.cpp: (JSC::SmallStrings::count):
  • runtime/SmallStrings.h:
Location:
trunk/JavaScriptCore/runtime
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Collector.cpp

    r39954 r39956  
    10061006size_t Heap::objectCount()
    10071007{
    1008     return primaryHeap.numLiveObjects + numberHeap.numLiveObjects;
     1008    return primaryHeap.numLiveObjects + numberHeap.numLiveObjects - m_globalData->smallStrings.count();
    10091009}
    10101010
  • trunk/JavaScriptCore/runtime/SmallStrings.cpp

    r39815 r39956  
    100100    }
    101101}
    102    
     102
     103unsigned SmallStrings::count() const
     104{
     105    unsigned count = 0;
     106    if (m_emptyString)
     107        ++count;
     108    for (unsigned i = 0; i < numCharactersToStore; ++i) {
     109        if (m_singleCharacterStrings[i])
     110            ++count;
     111    }
     112    return count;
     113}
     114
    103115void SmallStrings::createEmptyString(JSGlobalData* globalData)
    104116{
  • trunk/JavaScriptCore/runtime/SmallStrings.h

    r39815 r39956  
    5959        void mark();
    6060
     61        unsigned count() const;
     62
    6163    private:
    6264        void createEmptyString(JSGlobalData*);
Note: See TracChangeset for help on using the changeset viewer.