Bug 1257445 - #ifdef on __GLIBC__ for sched_getcpu, which is a glibc feature. r=jimb
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 22 Mar 2016 09:08:06 +0900
changeset 289788 5540673db52dd68889859af1a66de157219bb8ce
parent 289787 fad8fe6c7c9005466b61bc6e306b0fe718acaf15
child 289789 a5494b3c4fadda039ec6240b64be2d481e6f851d
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimb
bugs1257445
milestone48.0a1
Bug 1257445 - #ifdef on __GLIBC__ for sched_getcpu, which is a glibc feature. r=jimb XP_LINUX means the kernel is Linux, which can mean glibc, bionic (Android), etc. Only the former supports sched_getcpu. "Fortunately", XP_LINUX was never set for js/src, so this wasn't a problem... until we do set it, which we do in this bug.
js/src/vm/Stopwatch.cpp
--- a/js/src/vm/Stopwatch.cpp
+++ b/js/src/vm/Stopwatch.cpp
@@ -412,29 +412,29 @@ cpuid_t inline
 AutoStopwatch::getCPU() const
 {
 #if defined(XP_WIN) && WINVER >= _WIN32_WINNT_VISTA
     PROCESSOR_NUMBER proc;
     GetCurrentProcessorNumberEx(&proc);
 
     cpuid_t result(proc.Group, proc.Number);
     return result;
-#elif defined(XP_LINUX)
+#elif defined(__GLIBC__)
     return sched_getcpu();
 #else
     return {};
-#endif // defined(XP_WIN) || defined(XP_LINUX)
+#endif // defined(XP_WIN) || defined(__GLIBC__)
 }
 
 bool inline
 AutoStopwatch::isSameCPU(const cpuid_t& a, const cpuid_t& b) const
 {
 #if defined(XP_WIN)  && WINVER >= _WIN32_WINNT_VISTA
     return a.group_ == b.group_ && a.number_ == b.number_;
-#elif defined(XP_LINUX)
+#elif defined(__GLIBC__)
     return a == b;
 #else
     return true;
 #endif
 }
 
 PerformanceGroup::PerformanceGroup()
     : recentCycles_(0)