2008-11-03 Sam Weinig <sam@webkit.org>
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Nov 2008 22:43:00 +0000 (22:43 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 3 Nov 2008 22:43:00 +0000 (22:43 +0000)
        Reviewed by Mark Rowe.

        Move #define to turn on dumping StructureID statistics to StructureID.cpp so that
        turning it on does not require a full rebuild.

        * runtime/StructureID.cpp:
        (JSC::StructureID::dumpStatistics):
        * runtime/StructureID.h:

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

JavaScriptCore/ChangeLog
JavaScriptCore/runtime/StructureID.cpp
JavaScriptCore/runtime/StructureID.h

index ed24cf4..0700942 100644 (file)
@@ -1,3 +1,14 @@
+2008-11-03  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Mark Rowe.
+
+        Move #define to turn on dumping StructureID statistics to StructureID.cpp so that
+        turning it on does not require a full rebuild. 
+
+        * runtime/StructureID.cpp:
+        (JSC::StructureID::dumpStatistics):
+        * runtime/StructureID.h:
+
 2008-11-03  Alp Toker  <alp@nuanti.com>
 
         Reviewed by Geoffrey Garen.
index 0bed4a7..8333595 100644 (file)
@@ -38,6 +38,8 @@
 #include <wtf/Threading.h>
 #endif
 
+#define DUMP_STRUCTURE_ID_STATISTICS 0
+
 #ifndef NDEBUG
 #define DO_PROPERTYMAP_CONSTENCY_CHECK 0
 #else
@@ -70,9 +72,11 @@ static HashSet<StructureID*> ignoreSet;
 
 #if DUMP_STRUCTURE_ID_STATISTICS
 static HashSet<StructureID*> liveStructureIDSet;
+#endif
 
 void StructureID::dumpStatistics()
 {
+#if DUMP_STRUCTURE_ID_STATISTICS
     unsigned numberLeaf = 0;
     unsigned numberUsingSingleSlot = 0;
     unsigned numberSingletons = 0;
@@ -92,7 +96,7 @@ void StructureID::dumpStatistics()
         }
 
         if (structureID->m_propertyTable)
-            totalPropertyMapsSize += PropertyMapHashTable::allocationSize(m_propertyTable->size);;
+            totalPropertyMapsSize += PropertyMapHashTable::allocationSize(structureID->m_propertyTable->size);
     }
 
     printf("Number of live StructureIDs: %d\n", liveStructureIDSet.size());
@@ -103,8 +107,10 @@ void StructureID::dumpStatistics()
     printf("Size of a single StructureIDs: %d\n", static_cast<unsigned>(sizeof(StructureID)));
     printf("Size of sum of all property maps: %d\n", totalPropertyMapsSize);
     printf("Size of average of all property maps: %f\n", static_cast<double>(totalPropertyMapsSize) / static_cast<double>(liveStructureIDSet.size()));
-}
+#else
+    printf("Dumping StructureID statistics is not enabled.\n");
 #endif
+}
 
 StructureID::StructureID(JSValue* prototype, const TypeInfo& typeInfo)
     : m_typeInfo(typeInfo)
index 3b3e87e..4f45dac 100644 (file)
@@ -40,8 +40,6 @@
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
 
-#define DUMP_STRUCTURE_ID_STATISTICS 0
-
 #ifndef NDEBUG
 #define DUMP_PROPERTYMAP_STATS 0
 #else
@@ -64,9 +62,7 @@ namespace JSC {
         static void startIgnoringLeaks();
         static void stopIgnoringLeaks();
 
-#if DUMP_STRUCTURE_ID_STATISTICS
         static void dumpStatistics();
-#endif
 
         static PassRefPtr<StructureID> changePrototypeTransition(StructureID*, JSValue* prototype);
         static PassRefPtr<StructureID> addPropertyTransition(StructureID*, const Identifier& propertyName, unsigned attributes, size_t& offset);