Changeset 66665 in webkit
- Timestamp:
- Sep 2, 2010 5:57:58 AM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r66616 r66665 1 2010-09-02 Alexey Proskuryakov <ap@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=43230 6 <rdar://problem/8254215> REGRESSION: Memory leak within JSParser::JSParser 7 8 One can't delete a ThreadSpecific object that has data in it. It's not even possible to 9 enumerate data objects in all threads, much less destroy them from a thread that's destroying 10 the ThreadSpecific. 11 12 * parser/JSParser.cpp: 13 (JSC::JSParser::JSParser): 14 * runtime/JSGlobalData.h: 15 * wtf/WTFThreadData.cpp: 16 (WTF::WTFThreadData::WTFThreadData): 17 * wtf/WTFThreadData.h: 18 (WTF::WTFThreadData::approximatedStackStart): 19 Moved stack guard tracking from JSGlobalData to WTFThreadData. 20 21 * wtf/ThreadSpecific.h: Made destructor unimplemented. It's dangerous, and we probably won't 22 ever face a situation where we'd want to delete a ThreadSpecific object. 23 1 24 2010-09-01 Gavin Barraclough <barraclough@apple.com> 2 25 -
trunk/JavaScriptCore/parser/JSParser.cpp
r65104 r66665 34 34 #include "ASTBuilder.h" 35 35 #include <wtf/HashFunctions.h> 36 #include <wtf/WTFThreadData.h> 36 37 #include <utility> 37 38 … … 221 222 , m_syntaxAlreadyValidated(provider->isValid()) 222 223 { 223 m_endAddress = *(globalData->stackGuards); 224 if (!m_endAddress) { 225 char sample = 0; 226 m_endAddress = &sample - kMaxParserStackUsage; 227 *(globalData->stackGuards) = m_endAddress; 228 } 224 m_endAddress = wtfThreadData().approximatedStackStart() - kMaxParserStackUsage; 229 225 next(); 230 226 m_lexer->setLastLineNumber(tokenLine()); -
trunk/JavaScriptCore/runtime/JSGlobalData.h
r65947 r66665 228 228 229 229 CachedTranscendentalFunction<sin> cachedSin; 230 WTF::ThreadSpecific<char*> stackGuards;231 230 232 231 void resetDateCache(); -
trunk/JavaScriptCore/wtf/ThreadSpecific.h
r61732 r66665 68 68 operator T*(); 69 69 T& operator*(); 70 ~ThreadSpecific();71 70 72 71 private: … … 74 73 friend void ThreadSpecificThreadExit(); 75 74 #endif 75 76 // Not implemented. It's technically possible to destroy a thread specific key, but one would need 77 // to make sure that all values have been destroyed already (usually, that all threads that used it 78 // have exited). It's unlikely that any user of this call will be in that situation - and having 79 // a destructor defined can be confusing, given that it has such strong pre-requisites to work correctly. 80 ~ThreadSpecific(); 76 81 77 82 T* get(); … … 117 122 118 123 template<typename T> 119 inline ThreadSpecific<T>::~ThreadSpecific()120 {121 }122 123 template<typename T>124 124 inline T* ThreadSpecific<T>::get() 125 125 { … … 144 144 145 145 template<typename T> 146 inline ThreadSpecific<T>::~ThreadSpecific()147 {148 pthread_key_delete(m_key); // Does not invoke destructor functions.149 }150 151 template<typename T>152 146 inline T* ThreadSpecific<T>::get() 153 147 { … … 171 165 172 166 template<typename T> 173 inline ThreadSpecific<T>::~ThreadSpecific()174 {175 // Does not invoke destructor functions. QThreadStorage will do it176 }177 178 template<typename T>179 167 inline T* ThreadSpecific<T>::get() 180 168 { … … 197 185 { 198 186 g_static_private_init(&m_key); 199 }200 201 template<typename T>202 inline ThreadSpecific<T>::~ThreadSpecific()203 {204 g_static_private_free(&m_key);205 187 } 206 188 -
trunk/JavaScriptCore/wtf/WTFThreadData.cpp
r65021 r66665 44 44 #endif 45 45 { 46 char sample = 0; 47 m_approximatedStackStart = &sample; 46 48 } 47 49 -
trunk/JavaScriptCore/wtf/WTFThreadData.h
r65021 r66665 113 113 #endif 114 114 115 char* approximatedStackStart() const 116 { 117 return m_approximatedStackStart; 118 } 119 115 120 private: 116 121 AtomicStringTable* m_atomicStringTable; … … 129 134 friend WTFThreadData& wtfThreadData(); 130 135 friend class AtomicStringTable; 136 137 char* m_approximatedStackStart; 131 138 }; 132 139
Note: See TracChangeset
for help on using the changeset viewer.