Bug 821358 - Port the trace-malloc Windows TLS macros to DMD. r=njn, a=jlebar
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 13 Dec 2012 19:47:41 -0500
changeset 122919 1009e22289f263cf81a21e5abd8ef34d2f8a50fa
parent 122918 070bb9a35fa97d5c72dd0e57bf1a847e0e18333d
child 122920 083ea967f7979e897eb6081bc21a4fcbb6c1aa2f
push id273
push userlsblakk@mozilla.com
push dateThu, 14 Feb 2013 23:19:38 +0000
treeherdermozilla-release@c5e807a3f8b8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn, jlebar
bugs821358
milestone19.0a2
Bug 821358 - Port the trace-malloc Windows TLS macros to DMD. r=njn, a=jlebar
memory/replace/dmd/DMD.cpp
--- a/memory/replace/dmd/DMD.cpp
+++ b/memory/replace/dmd/DMD.cpp
@@ -364,17 +364,23 @@ public:
 };
 
 //---------------------------------------------------------------------------
 // Thread-local storage and blocking of intercepts
 //---------------------------------------------------------------------------
 
 #ifdef XP_WIN
 
-#error "Windows not supported yet, sorry."
+#define DMD_TLS_INDEX_TYPE              DWORD
+#define DMD_CREATE_TLS_INDEX(i_)        PR_BEGIN_MACRO                        \
+                                          (i_) = TlsAlloc();                  \
+                                        PR_END_MACRO
+#define DMD_DESTROY_TLS_INDEX(i_)       TlsFree((i_))
+#define DMD_GET_TLS_DATA(i_)            TlsGetValue((i_))
+#define DMD_SET_TLS_DATA(i_, v_)        TlsSetValue((i_), (v_))
 
 #else
 
 #include <pthread.h>
 
 #define DMD_TLS_INDEX_TYPE               pthread_key_t
 #define DMD_CREATE_TLS_INDEX(i_)         pthread_key_create(&(i_), nullptr)
 #define DMD_DESTROY_TLS_INDEX(i_)        pthread_key_delete((i_))