Title: [91444] trunk/Source/_javascript_Core
- Revision
- 91444
- Author
- [email protected]
- Date
- 2011-07-20 22:04:49 -0700 (Wed, 20 Jul 2011)
Log Message
Unreviewed, rolling out r91380.
http://trac.webkit.org/changeset/91380
https://bugs.webkit.org/show_bug.cgi?id=64924
Caused assertion failures in Chromium's IndexedDB tests
(Requested by rniwa on #webkit).
Patch by Sheriff Bot <[email protected]> on 2011-07-20
* wtf/ThreadIdentifierDataPthreads.cpp:
(WTF::ThreadIdentifierData::identifier):
(WTF::ThreadIdentifierData::initialize):
(WTF::ThreadIdentifierData::initializeKeyOnceHelper):
(WTF::ThreadIdentifierData::initializeKeyOnce):
* wtf/ThreadIdentifierDataPthreads.h:
* wtf/ThreadingPthreads.cpp:
(WTF::initializeThreading):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (91443 => 91444)
--- trunk/Source/_javascript_Core/ChangeLog 2011-07-21 03:15:33 UTC (rev 91443)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-07-21 05:04:49 UTC (rev 91444)
@@ -1,3 +1,21 @@
+2011-07-20 Sheriff Bot <[email protected]>
+
+ Unreviewed, rolling out r91380.
+ http://trac.webkit.org/changeset/91380
+ https://bugs.webkit.org/show_bug.cgi?id=64924
+
+ Caused assertion failures in Chromium's IndexedDB tests
+ (Requested by rniwa on #webkit).
+
+ * wtf/ThreadIdentifierDataPthreads.cpp:
+ (WTF::ThreadIdentifierData::identifier):
+ (WTF::ThreadIdentifierData::initialize):
+ (WTF::ThreadIdentifierData::initializeKeyOnceHelper):
+ (WTF::ThreadIdentifierData::initializeKeyOnce):
+ * wtf/ThreadIdentifierDataPthreads.h:
+ * wtf/ThreadingPthreads.cpp:
+ (WTF::initializeThreading):
+
2011-07-20 Filip Pizlo <[email protected]>
DFG non-speculative JIT does not use() the aliased GetByVal,
Modified: trunk/Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.cpp (91443 => 91444)
--- trunk/Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.cpp 2011-07-21 03:15:33 UTC (rev 91443)
+++ trunk/Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.cpp 2011-07-21 05:04:49 UTC (rev 91444)
@@ -36,11 +36,10 @@
#include "Threading.h"
-#include <limits.h>
-
namespace WTF {
-pthread_key_t ThreadIdentifierData::m_key = PTHREAD_KEYS_MAX;
+pthread_key_t ThreadIdentifierData::m_key;
+static pthread_once_t _onceControl_ = PTHREAD_ONCE_INIT;
void clearPthreadHandleForIdentifier(ThreadIdentifier);
@@ -49,15 +48,9 @@
clearPthreadHandleForIdentifier(m_identifier);
}
-void ThreadIdentifierData::initializeOnce()
-{
- if (pthread_key_create(&m_key, destruct))
- CRASH();
-}
-
ThreadIdentifier ThreadIdentifierData::identifier()
{
- ASSERT(m_key != PTHREAD_KEYS_MAX);
+ initializeKeyOnce();
ThreadIdentifierData* threadIdentifierData = static_cast<ThreadIdentifierData*>(pthread_getspecific(m_key));
return threadIdentifierData ? threadIdentifierData->m_identifier : 0;
@@ -66,6 +59,8 @@
void ThreadIdentifierData::initialize(ThreadIdentifier id)
{
ASSERT(!identifier());
+
+ initializeKeyOnce();
pthread_setspecific(m_key, new ThreadIdentifierData(id));
}
@@ -84,6 +79,18 @@
pthread_setspecific(m_key, threadIdentifierData);
}
+void ThreadIdentifierData::initializeKeyOnceHelper()
+{
+ if (pthread_key_create(&m_key, destruct))
+ CRASH();
+}
+
+void ThreadIdentifierData::initializeKeyOnce()
+{
+ if (pthread_once(&onceControl, initializeKeyOnceHelper))
+ CRASH();
+}
+
} // namespace WTF
#endif // USE(PTHREADS)
Modified: trunk/Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.h (91443 => 91444)
--- trunk/Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.h 2011-07-21 03:15:33 UTC (rev 91443)
+++ trunk/Source/_javascript_Core/wtf/ThreadIdentifierDataPthreads.h 2011-07-21 05:04:49 UTC (rev 91444)
@@ -42,10 +42,6 @@
public:
~ThreadIdentifierData();
- // One time initialization for this class as a whole.
- // This method must be called before initialize() and it is not thread-safe.
- static void initializeOnce();
-
// Creates and puts an instance of ThreadIdentifierData into thread-specific storage.
static void initialize(ThreadIdentifier identifier);
@@ -66,6 +62,9 @@
// ThreadIdentifier from the threadMap, completing the cleanup.
static void destruct(void* data);
+ static void initializeKeyOnceHelper();
+ static void initializeKeyOnce();
+
ThreadIdentifier m_identifier;
bool m_isDestroyedOnce;
static pthread_key_t m_key;
Modified: trunk/Source/_javascript_Core/wtf/ThreadingPthreads.cpp (91443 => 91444)
--- trunk/Source/_javascript_Core/wtf/ThreadingPthreads.cpp 2011-07-21 03:15:33 UTC (rev 91443)
+++ trunk/Source/_javascript_Core/wtf/ThreadingPthreads.cpp 2011-07-21 05:04:49 UTC (rev 91444)
@@ -81,7 +81,6 @@
atomicallyInitializedStaticMutex = new Mutex;
threadMapMutex();
initializeRandomNumberGenerator();
- ThreadIdentifierData::initializeOnce();
}
void lockAtomicallyInitializedStaticMutex()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes