Bug 1314565 - Fix PerfSpewer following mutex ordering changes r=nbp
authorJon Coppeard <jcoppeard@mozilla.com>
Thu, 03 Nov 2016 11:03:51 +0000
changeset 347563 bdf1a014a11aa13de8255abf4e29f4d0a1e7cdb0
parent 347562 325acea6a61c07a698e6c738c6a8deb597795570
child 347564 7aa1f054076035584b9a470d14edefe788f574f5
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1314565
milestone52.0a1
Bug 1314565 - Fix PerfSpewer following mutex ordering changes r=nbp
js/src/jit/PerfSpewer.cpp
js/src/vm/MutexIDs.h
--- a/js/src/jit/PerfSpewer.cpp
+++ b/js/src/jit/PerfSpewer.cpp
@@ -4,27 +4,29 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "jit/PerfSpewer.h"
 
 #include "mozilla/IntegerPrintfMacros.h"
 #include "mozilla/SizePrintfMacros.h"
 
-#if defined(__linux__)
+#ifdef XP_UNIX
 # include <unistd.h>
 #endif
 
 #ifdef JS_ION_PERF
 # include "jit/JitSpewer.h"
 # include "jit/LIR.h"
 # include "jit/MIR.h"
 # include "jit/MIRGraph.h"
 #endif
 
+#include "vm/MutexIDs.h"
+
 // perf expects its data to be in a file /tmp/perf-PID.map, but for Android
 // and B2G the map files are written to /data/local/tmp/perf-PID.map
 //
 // Except that Android 4.3 no longer allows the browser to write to /data/local/tmp/
 // so also try /sdcard/.
 
 #ifndef PERF_SPEW_DIR
 # if defined(__ANDROID__)
@@ -89,17 +91,17 @@ js::jit::CheckPerf() {
             fprintf(stderr, "Use IONPERF=block to record at basic block granularity\n");
             fprintf(stderr, "\n");
             fprintf(stderr, "Be advised that using IONPERF will cause all scripts\n");
             fprintf(stderr, "to be leaked.\n");
             exit(0);
         }
 
         if (PerfMode != PERF_MODE_NONE) {
-            PerfMutex = js_new<js::Mutex>();
+            PerfMutex = js_new<js::Mutex>(mutexid::PerfSpewer);
             if (!PerfMutex)
                 MOZ_CRASH("failed to allocate PerfMutex");
 
             if (openPerfMap(PERF_SPEW_DIR)) {
                 PerfChecked = true;
                 return;
             }
 
--- a/js/src/vm/MutexIDs.h
+++ b/js/src/vm/MutexIDs.h
@@ -29,16 +29,17 @@
   _(PromiseTaskPtrVector,        500) \
   _(SPSProfilerStrings,          500) \
   _(ProtectedRegionTree,         500) \
   _(WasmSigIdSet,                500) \
   _(ShellOffThreadState,         500) \
   _(SimulatorCacheLock,          500) \
   _(Arm64SimulatorLock,          500) \
   _(IonSpewer,                   500) \
+  _(PerfSpewer,                  500) \
   _(TraceLoggerThreadState,      500) \
                                       \
   _(TraceLoggerGraphState,       600)
 
 namespace js {
 namespace mutexid {
 
 #define DEFINE_MUTEX_ID(name, order)  \