Bug 1413475 - Inline _CRT_SPINCOUNT in mozjemalloc.cpp. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 01 Nov 2017 16:06:28 +0900
changeset 689988 12f61a4786c1838664ae3be32f1d39798bea4a28
parent 689987 ff86d7bb8edf7df63fde615cd4c9ddc6effec084
child 689989 774f3208a86d4fd4c1b94a6f8be8e5ff8db1041b
child 690335 ea2f3f7f1bb01471a3ed2f41a1d54a42d624e712
push id87159
push userbmo:mh+mozilla@glandium.org
push dateWed, 01 Nov 2017 08:24:56 +0000
reviewersnjn
bugs1413475
milestone58.0a1
Bug 1413475 - Inline _CRT_SPINCOUNT in mozjemalloc.cpp. r?njn It is only used once.
memory/build/mozjemalloc.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -153,18 +153,16 @@
 #include <stdio.h>
 #include <string.h>
 #include <algorithm>
 
 using namespace mozilla;
 
 #ifdef XP_WIN
 
-// Some defines from the CRT internal headers that we need here.
-#define _CRT_SPINCOUNT 5000
 #include <io.h>
 #include <windows.h>
 #include <intrin.h>
 
 #define STDERR_FILENO 2
 
 // Implement getenv without using malloc.
 static char mozillaMallocOptionsBuf[64];
@@ -1299,17 +1297,17 @@ pthread_atfork(void (*)(void), void (*)(
 // cases. We also can't use constructors, because for statics, they would fire
 // after the first use of malloc, resetting the locks.
 
 // Initializes a mutex. Returns whether initialization succeeded.
 bool
 Mutex::Init()
 {
 #if defined(XP_WIN)
-  if (!InitializeCriticalSectionAndSpinCount(&mMutex, _CRT_SPINCOUNT)) {
+  if (!InitializeCriticalSectionAndSpinCount(&mMutex, 5000)) {
     return false;
   }
 #elif defined(XP_DARWIN)
   mMutex = OS_SPINLOCK_INIT;
 #elif defined(XP_LINUX) && !defined(ANDROID)
   pthread_mutexattr_t attr;
   if (pthread_mutexattr_init(&attr) != 0) {
     return false;