Changeset 36631 in webkit for trunk/JavaScriptCore
- Timestamp:
- Sep 18, 2008, 4:30:23 PM (17 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r36630 r36631 1 2008-09-18 Darin Adler <[email protected]> 2 3 Reviewed by Sam Weinig. 4 5 - fix https://bugs.webkit.org/show_bug.cgi?id=20925 6 LEAK messages appear every time I quit 7 8 * JavaScriptCore.exp: Updated, and also added an export 9 needed for future WebCore use of JSC::StructureID. 10 11 * wtf/RefCountedLeakCounter.cpp: 12 (WTF::RefCountedLeakCounter::suppressMessages): Added. 13 (WTF::RefCountedLeakCounter::cancelMessageSuppression): Added. 14 (WTF::RefCountedLeakCounter::RefCountedLeakCounter): Tweaked a bit. 15 (WTF::RefCountedLeakCounter::~RefCountedLeakCounter): Added code to 16 log the reason there was no leak checking done. 17 (WTF::RefCountedLeakCounter::increment): Tweaked a bit. 18 (WTF::RefCountedLeakCounter::decrement): Ditto. 19 20 * wtf/RefCountedLeakCounter.h: Replaced setLogLeakMessages with two 21 new functions, suppressMessages and cancelMessageSuppression. Also 22 added m_ prefixes to the data member names. 23 1 24 2008-09-18 Holger Hans Peter Freyther <[email protected]> 2 25 -
trunk/JavaScriptCore/JavaScriptCore.exp
r36417 r36631 111 111 __ZN3JSC11StructureID24fromDictionaryTransitionEPS0_ 112 112 __ZN3JSC11StructureID25changePrototypeTransitionEPS0_PNS_7JSValueE 113 __ZN3JSC11StructureIDC1EPNS_7JSValueENS_6JSTypeE 113 114 __ZN3JSC11StructureIDD1Ev 114 115 __ZN3JSC12DateInstance4infoE … … 262 263 __ZN3WTF16callOnMainThreadEPFvPvES0_ 263 264 __ZN3WTF16fastZeroedMallocEm 264 __ZN3WTF18setLogLeakMessagesEb265 265 __ZN3WTF19initializeThreadingEv 266 __ZN3WTF21RefCountedLeakCounter16suppressMessagesEPKc 267 __ZN3WTF21RefCountedLeakCounter24cancelMessageSuppressionEPKc 266 268 __ZN3WTF21RefCountedLeakCounter9decrementEv 267 269 __ZN3WTF21RefCountedLeakCounter9incrementEv -
trunk/JavaScriptCore/wtf/RefCountedLeakCounter.cpp
r35476 r36631 20 20 21 21 #include "config.h" 22 #include "RefCountedLeakCounter.h" 22 23 23 #include "RefCountedLeakCounter.h" 24 #include "UnusedParam.h" 24 #include <wtf/HashCountedSet.h> 25 25 26 26 namespace WTF { 27 27 28 #ifndef NDEBUG 29 static bool logLeakMessages = true; 30 #endif 31 32 void setLogLeakMessages(bool _logLeakMessages ) 33 { 34 UNUSED_PARAM(_logLeakMessages); 35 #ifndef NDEBUG 36 logLeakMessages = _logLeakMessages; 37 #endif 38 } 39 40 41 #ifndef NDEBUG 42 #define LOG_CHANNEL_PREFIX Log 43 static WTFLogChannel LogRefCountedLeaks = { 0x00000000, "", WTFLogChannelOn }; 44 #endif 28 #ifdef NDEBUG 45 29 46 RefCountedLeakCounter::~RefCountedLeakCounter() 47 { 48 #ifndef NDEBUG 49 if (count && logLeakMessages) 50 LOG(RefCountedLeaks, "LEAK: %u %s\n", count, description); 51 #endif 52 } 30 static void RefCountedLeakCounter::suppressMessages(const char*) { } 31 static void RefCountedLeakCounter::cancelMessageSuppression(const char*) { } 53 32 54 RefCountedLeakCounter::RefCountedLeakCounter(const char* desc) 55 { 56 UNUSED_PARAM(desc); 57 #ifndef NDEBUG 58 description = desc; 59 #endif 60 } 33 RefCountedLeakCounter::RefCountedLeakCounter(const char*) { } 34 RefCountedLeakCounter::~RefCountedLeakCounter() { } 61 35 62 #if ENABLE(JSC_MULTIPLE_THREADS) 63 64 void RefCountedLeakCounter::increment() 65 { 66 #ifndef NDEBUG 67 atomicIncrement(&count); 68 #endif 69 } 70 71 void RefCountedLeakCounter::decrement() 72 { 73 #ifndef NDEBUG 74 atomicDecrement(&count); 75 #endif 76 } 36 void RefCountedLeakCounter::increment() { } 37 void RefCountedLeakCounter::decrement() { } 77 38 78 39 #else 79 40 80 void RefCountedLeakCounter::increment() 81 { 82 #ifndef NDEBUG 83 ++count; 41 #define LOG_CHANNEL_PREFIX Log 42 static WTFLogChannel LogRefCountedLeaks = { 0x00000000, "", WTFLogChannelOn }; 43 44 typedef HashCountedSet<const char*, PtrHash<const char*> > ReasonSet; 45 static ReasonSet* leakMessageSuppressionReasons; 46 47 void RefCountedLeakCounter::suppressMessages(const char* reason) 48 { 49 if (!leakMessageSuppressionReasons) 50 leakMessageSuppressionReasons = new ReasonSet; 51 leakMessageSuppressionReasons->add(reason); 52 } 53 54 void RefCountedLeakCounter::cancelMessageSuppression(const char* reason) 55 { 56 ASSERT(leakMessageSuppressionReasons); 57 ASSERT(leakMessageSuppressionReasons->contains(reason)); 58 leakMessageSuppressionReasons->remove(reason); 59 } 60 61 RefCountedLeakCounter::RefCountedLeakCounter(const char* description) 62 : m_description(description) 63 { 64 } 65 66 RefCountedLeakCounter::~RefCountedLeakCounter() 67 { 68 static bool loggedSuppressionReason; 69 if (m_count) { 70 if (!leakMessageSuppressionReasons || leakMessageSuppressionReasons->isEmpty()) 71 LOG(RefCountedLeaks, "LEAK: %u %s", m_count, m_description); 72 else if (!loggedSuppressionReason) { 73 // This logs only one reason. Later we could change it so we log all the reasons. 74 LOG(RefCountedLeaks, "No leak checking done: %s", leakMessageSuppressionReasons->begin()->first); 75 loggedSuppressionReason = true; 76 } 77 } 78 } 79 80 void RefCountedLeakCounter::increment() 81 { 82 #if ENABLE(JSC_MULTIPLE_THREADS) 83 atomicIncrement(&m_count); 84 #else 85 ++m_count; 84 86 #endif 85 87 } 86 88 87 void RefCountedLeakCounter::decrement() 88 { 89 #ifndef NDEBUG 90 --count; 89 void RefCountedLeakCounter::decrement() 90 { 91 #if ENABLE(JSC_MULTIPLE_THREADS) 92 atomicDecrement(&m_count); 93 #else 94 --m_count; 91 95 #endif 92 96 } 93 97 94 98 #endif 95 99 96 } // Namespace WTF100 } // namespace WTF -
trunk/JavaScriptCore/wtf/RefCountedLeakCounter.h
r35148 r36631 19 19 */ 20 20 21 #ifndef R EF_COUNTED_LEAK_COUNTER_H_22 #define R EF_COUNTED_LEAK_COUNTER_H_21 #ifndef RefCountedLeakCounter_h 22 #define RefCountedLeakCounter_h 23 23 24 24 #include "Assertions.h" … … 26 26 27 27 namespace WTF { 28 29 void setLogLeakMessages(bool _logLeakMessages);30 28 31 29 struct RefCountedLeakCounter { 32 RefCountedLeakCounter(const char* desc); 30 static void suppressMessages(const char*); 31 static void cancelMessageSuppression(const char*); 32 33 explicit RefCountedLeakCounter(const char* description); 33 34 ~RefCountedLeakCounter(); 34 35 35 36 void increment(); 36 37 void decrement(); 37 38 39 #ifndef NDEBUG 38 40 private: 39 #ifndef NDEBUG 40 volatile int count; 41 const char* description; 41 volatile int m_count; 42 const char* m_description; 42 43 #endif 43 44 }; 44 45 45 46 } // namespace WTF 46 47
Note:
See TracChangeset
for help on using the changeset viewer.