Changeset 37629 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Oct 15, 2008, 10:31:41 PM (17 years ago)
Author:
[email protected]
Message:

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

Reviewed by Goeffrey Garen.

Add function to dump statistics for StructureIDs.

  • kjs/StructureID.cpp: (JSC::StructureID::dumpStatistics): (JSC::StructureID::StructureID): (JSC::StructureID::~StructureID):
  • kjs/StructureID.h:
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r37627 r37629  
     12008-10-15  Sam Weinig  <[email protected]>
     2
     3        Reviewed by Goeffrey Garen.
     4
     5        Add function to dump statistics for StructureIDs.
     6
     7        * kjs/StructureID.cpp:
     8        (JSC::StructureID::dumpStatistics):
     9        (JSC::StructureID::StructureID):
     10        (JSC::StructureID::~StructureID):
     11        * kjs/StructureID.h:
     12
    1132008-10-15  Cameron Zwarich  <[email protected]>
    214
  • trunk/JavaScriptCore/kjs/StructureID.cpp

    r37627 r37629  
    3838namespace JSC {
    3939
    40 #ifndef NDEBUG   
     40#ifndef NDEBUG
    4141static WTF::RefCountedLeakCounter structureIDCounter("StructureID");
    4242
    4343static bool shouldIgnoreLeaks;
    4444static HashSet<StructureID*> ignoreSet;
     45#endif
     46
     47#if DUMP_STRUCTURE_ID_STATISTICS
     48static HashSet<StructureID*> liveStructureIDSet;
     49
     50void StructureID::dumpStatistics()
     51{
     52    unsigned numberUsingSingleSlot = 0;
     53
     54    HashSet<StructureID*>::const_iterator end = liveStructureIDSet.end();
     55    for (HashSet<StructureID*>::const_iterator it = liveStructureIDSet.begin(); it != end; ++it) {
     56        StructureID* structureID = *it;
     57        if (structureID->m_usingSingleTransitionSlot)
     58            ++numberUsingSingleSlot;
     59    }
     60
     61    printf("Number of live StructureIDs: %d\n", liveStructureIDSet.size());
     62    printf("Number of StructureIDs using the single item optimization for transition map: %d\n", numberUsingSingleSlot);
     63}
    4564#endif
    4665
     
    6988        structureIDCounter.increment();
    7089#endif
     90
     91#if DUMP_STRUCTURE_ID_STATISTICS
     92    liveStructureIDSet.add(this);
     93#endif
    7194}
    7295
     
    98121    else
    99122        structureIDCounter.decrement();
     123#endif
     124
     125#if DUMP_STRUCTURE_ID_STATISTICS
     126    liveStructureIDSet.remove(this);
    100127#endif
    101128}
  • trunk/JavaScriptCore/kjs/StructureID.h

    r37627 r37629  
    3838#include <wtf/PassRefPtr.h>
    3939#include <wtf/RefCounted.h>
     40
     41#define DUMP_STRUCTURE_ID_STATISTICS 0
    4042
    4143namespace JSC {
     
    8587        static void startIgnoringLeaks();
    8688        static void stopIgnoringLeaks();
     89
     90#if DUMP_STRUCTURE_ID_STATISTICS
     91        static void dumpStatistics();
     92#endif
    8793
    8894        static PassRefPtr<StructureID> changePrototypeTransition(StructureID*, JSValue* prototype);
Note: See TracChangeset for help on using the changeset viewer.