Bug 1403421 - Support mips64-linux performance. r=njn
authorqiaopengcheng <qiaopengcheng-hf@loongson.cn>
Thu, 28 Sep 2017 18:23:00 -0400
changeset 444256 9bbac53ac79278f3cd4eac584fb30aad38987490
parent 444255 0b07ff291caab66f3941443c5e52ae645fd1aa40
child 444257 3ea95e09f4b360f74ceeaeaea66535f02b977fe6
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1403421
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1403421 - Support mips64-linux performance. r=njn
toolkit/moz.configure
tools/profiler/core/PlatformMacros.h
tools/profiler/core/platform-linux-android.cpp
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -22,17 +22,17 @@ set_config('MOZ_JPROF', jprof)
 set_define('MOZ_JPROF', jprof)
 imply_option('--enable-profiling', jprof)
 
 @depends(target)
 def gecko_profiler(target):
     if target.os == 'Android':
         return target.cpu in ('aarch64', 'arm', 'x86')
     elif target.kernel == 'Linux':
-        return target.cpu in ('x86', 'x86_64')
+        return target.cpu in ('x86', 'x86_64', 'mips64')
     return target.os in ('OSX', 'WINNT')
 
 @depends(gecko_profiler)
 def gecko_profiler_define(value):
     if value:
         return True
 
 set_config('MOZ_GECKO_PROFILER', gecko_profiler_define)
--- a/tools/profiler/core/PlatformMacros.h
+++ b/tools/profiler/core/PlatformMacros.h
@@ -13,24 +13,26 @@
 //
 // Note: "GP" is short for "Gecko Profiler".
 
 #undef GP_PLAT_x86_android
 #undef GP_PLAT_arm_android
 #undef GP_PLAT_aarch64_android
 #undef GP_PLAT_x86_linux
 #undef GP_PLAT_amd64_linux
+#undef GP_PLAT_mips64_linux
 #undef GP_PLAT_amd64_darwin
 #undef GP_PLAT_x86_windows
 #undef GP_PLAT_amd64_windows
 
 #undef GP_ARCH_x86
 #undef GP_ARCH_amd64
 #undef GP_ARCH_arm
 #undef GP_ARCH_aarch64
+#undef GP_ARCH_mips64
 
 #undef GP_OS_android
 #undef GP_OS_linux
 #undef GP_OS_darwin
 #undef GP_OS_windows
 
 // We test __ANDROID__ before __linux__ because __linux__ is defined on both
 // Android and Linux, whereas GP_OS_android is not defined on vanilla Linux.
@@ -55,16 +57,21 @@
 # define GP_ARCH_x86 1
 # define GP_OS_linux 1
 
 #elif defined(__linux__) && defined(__x86_64__)
 # define GP_PLAT_amd64_linux 1
 # define GP_ARCH_amd64 1
 # define GP_OS_linux 1
 
+#elif defined(__linux__) && defined(__mips64)
+# define GP_PLAT_mips64_linux 1
+# define GP_ARCH_mips64 1
+# define GP_OS_linux 1
+
 #elif defined(__APPLE__) && defined(__x86_64__)
 # define GP_PLAT_amd64_darwin 1
 # define GP_ARCH_amd64 1
 # define GP_OS_darwin 1
 
 #elif (defined(_MSC_VER) || defined(__MINGW32__)) && \
       (defined(_M_IX86) || defined(__i386__))
 # define GP_PLAT_x86_windows 1
--- a/tools/profiler/core/platform-linux-android.cpp
+++ b/tools/profiler/core/platform-linux-android.cpp
@@ -103,16 +103,21 @@ PopulateRegsFromContext(Registers& aRegs
   aRegs.mSP = reinterpret_cast<Address>(mcontext.arm_sp);
   aRegs.mFP = reinterpret_cast<Address>(mcontext.arm_fp);
   aRegs.mLR = reinterpret_cast<Address>(mcontext.arm_lr);
 #elif defined(GP_ARCH_aarch64)
   aRegs.mPC = reinterpret_cast<Address>(mcontext.pc);
   aRegs.mSP = reinterpret_cast<Address>(mcontext.sp);
   aRegs.mFP = reinterpret_cast<Address>(mcontext.regs[29]);
   aRegs.mLR = reinterpret_cast<Address>(mcontext.regs[30]);
+#elif defined(GP_ARCH_mips64)
+  aRegs.mPC = reinterpret_cast<Address>(mcontext.pc);
+  aRegs.mSP = reinterpret_cast<Address>(mcontext.gregs[29]);
+  aRegs.mFP = reinterpret_cast<Address>(mcontext.gregs[30]);
+
 #else
 # error "bad platform"
 #endif
 }
 
 #if defined(GP_OS_android)
 # define SYS_tgkill __NR_tgkill
 #endif
@@ -361,17 +366,17 @@ Sampler::SuspendAndSampleAndResumeThread
   // finished with |sSigHandlerCoordinator|.
   while (true) {
     r = sem_wait(&sSigHandlerCoordinator->mMessage4);
     if (r == -1 && errno == EINTR) {
       continue;
     }
     MOZ_ASSERT(r == 0);
     break;
-   }
+  }
 
   // The profiler's critical section ends here.  After this point, none of the
   // critical section limitations documented above apply.
   //
   // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
 
   // This isn't strictly necessary, but doing so does help pick up anomalies
   // in which the signal handler is running when it shouldn't be.