Title: [148490] trunk/Source/WTF
- Revision
- 148490
- Author
- [email protected]
- Date
- 2013-04-15 20:41:29 -0700 (Mon, 15 Apr 2013)
Log Message
Unreviewed, rolling out r148488.
http://trac.webkit.org/changeset/148488
https://bugs.webkit.org/show_bug.cgi?id=114660
Roll back in r148462 since it was a false positive. (Requested
by rniwa on #webkit).
* wtf/FastMalloc.cpp:
(WTF):
(WTF::setThreadHeap):
(WTF::TCMalloc_ThreadCache::GetThreadHeap):
(WTF::TCMalloc_ThreadCache::InitTSD):
* wtf/ThreadSpecificWin.cpp:
(WTF::destructorsList):
(WTF::destructorsMutex):
(WTF::threadSpecificKeyCreate):
(WTF::threadSpecificKeyDelete):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (148489 => 148490)
--- trunk/Source/WTF/ChangeLog 2013-04-16 03:37:15 UTC (rev 148489)
+++ trunk/Source/WTF/ChangeLog 2013-04-16 03:41:29 UTC (rev 148490)
@@ -1,5 +1,25 @@
2013-04-15 Commit Queue <[email protected]>
+ Unreviewed, rolling out r148488.
+ http://trac.webkit.org/changeset/148488
+ https://bugs.webkit.org/show_bug.cgi?id=114660
+
+ Roll back in r148462 since it was a false positive. (Requested
+ by rniwa on #webkit).
+
+ * wtf/FastMalloc.cpp:
+ (WTF):
+ (WTF::setThreadHeap):
+ (WTF::TCMalloc_ThreadCache::GetThreadHeap):
+ (WTF::TCMalloc_ThreadCache::InitTSD):
+ * wtf/ThreadSpecificWin.cpp:
+ (WTF::destructorsList):
+ (WTF::destructorsMutex):
+ (WTF::threadSpecificKeyCreate):
+ (WTF::threadSpecificKeyDelete):
+
+2013-04-15 Commit Queue <[email protected]>
+
Unreviewed, rolling out r148462.
http://trac.webkit.org/changeset/148462
https://bugs.webkit.org/show_bug.cgi?id=114658
Modified: trunk/Source/WTF/wtf/FastMalloc.cpp (148489 => 148490)
--- trunk/Source/WTF/wtf/FastMalloc.cpp 2013-04-16 03:37:15 UTC (rev 148489)
+++ trunk/Source/WTF/wtf/FastMalloc.cpp 2013-04-16 03:41:29 UTC (rev 148490)
@@ -428,6 +428,7 @@
#include "TCPageMap.h"
#include "TCSpinLock.h"
#include "TCSystemAlloc.h"
+#include "ThreadSpecific.h"
#include <algorithm>
#include <pthread.h>
#include <stdarg.h>
@@ -2841,11 +2842,8 @@
#if USE(PTHREAD_GETSPECIFIC_DIRECT)
static const pthread_key_t heap_key = __PTK_FRAMEWORK_JAVASCRIPTCORE_KEY0;
#else
-static pthread_key_t heap_key;
+static ThreadSpecificKey heap_key;
#endif
-#if OS(WINDOWS)
-DWORD tlsIndex = TLS_OUT_OF_INDEXES;
-#endif
static ALWAYS_INLINE void setThreadHeap(TCMalloc_ThreadCache* heap)
{
@@ -2856,12 +2854,12 @@
CRASH();
#endif
+#if OS(DARWIN)
// Still do pthread_setspecific even if there's an alternate form
// of thread-local storage in use, to benefit from the delete callback.
pthread_setspecific(heap_key, heap);
-
-#if OS(WINDOWS)
- TlsSetValue(tlsIndex, heap);
+#else
+ threadSpecificSet(heap_key, heap);
#endif
}
@@ -3407,10 +3405,10 @@
// __thread is faster, but only when the kernel supports it
if (KernelSupportsTLS())
return threadlocal_heap;
-#elif OS(WINDOWS)
- return static_cast<TCMalloc_ThreadCache*>(TlsGetValue(tlsIndex));
-#else
+#elif OS(DARWIN)
return static_cast<TCMalloc_ThreadCache*>(pthread_getspecific(heap_key));
+#else
+ return static_cast<TCMalloc_ThreadCache*>(threadSpecificGet(heap_key));
#endif
}
@@ -3439,11 +3437,8 @@
#if USE(PTHREAD_GETSPECIFIC_DIRECT)
pthread_key_init_np(heap_key, DestroyThreadCache);
#else
- pthread_key_create(&heap_key, DestroyThreadCache);
+ threadSpecificKeyCreate(&heap_key, DestroyThreadCache);
#endif
-#if OS(WINDOWS)
- tlsIndex = TlsAlloc();
-#endif
tsd_inited = true;
#if !OS(WINDOWS)
Modified: trunk/Source/WTF/wtf/ThreadSpecificWin.cpp (148489 => 148490)
--- trunk/Source/WTF/wtf/ThreadSpecificWin.cpp 2013-04-16 03:37:15 UTC (rev 148489)
+++ trunk/Source/WTF/wtf/ThreadSpecificWin.cpp 2013-04-16 03:41:29 UTC (rev 148490)
@@ -34,13 +34,13 @@
static DoublyLinkedList<PlatformThreadSpecificKey>& destructorsList()
{
- DEFINE_STATIC_LOCAL(DoublyLinkedList<PlatformThreadSpecificKey>, staticList, ());
+ static DoublyLinkedList<PlatformThreadSpecificKey> staticList;
return staticList;
}
static Mutex& destructorsMutex()
{
- DEFINE_STATIC_LOCAL(Mutex, staticMutex, ());
+ static Mutex staticMutex;
return staticMutex;
}
@@ -91,7 +91,9 @@
void threadSpecificKeyCreate(ThreadSpecificKey* key, void (*destructor)(void *))
{
- *key = new PlatformThreadSpecificKey(destructor);
+ // Use the original malloc() instead of fastMalloc() to use this function in FastMalloc code.
+ *key = static_cast<PlatformThreadSpecificKey*>(::malloc(sizeof(PlatformThreadSpecificKey)));
+ new (*key) PlatformThreadSpecificKey(destructor);
MutexLocker locker(destructorsMutex());
destructorsList().push(*key);
@@ -101,7 +103,8 @@
{
MutexLocker locker(destructorsMutex());
destructorsList().remove(key);
- delete key;
+ key->~PlatformThreadSpecificKey();
+ ::free(key);
}
void threadSpecificSet(ThreadSpecificKey key, void* data)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes