Bug 1480595 - make TimeStamp compilable for AArch64 Windows; r=glandium
authorNathan Froyd <froydnj@mozilla.com>
Thu, 23 Aug 2018 12:54:29 -0400
changeset 488184 a8facd78c24282a792310cb154aae29c531a116a
parent 488183 3ad8c54c6dc8978a3317544bea487cef8860db50
child 488185 7a308e5f78c2792c423ec0b5d7e6d6bbafdf230a
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1480595
milestone63.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 1480595 - make TimeStamp compilable for AArch64 Windows; r=glandium We don't have to check whether AArch64 systems have a stable counter; they are all specified to do so in the architecture reference manual.
mozglue/misc/TimeStamp_windows.cpp
--- a/mozglue/misc/TimeStamp_windows.cpp
+++ b/mozglue/misc/TimeStamp_windows.cpp
@@ -423,16 +423,22 @@ MFBT_API int64_t
 BaseTimeDurationPlatformUtils::ResolutionInTicks()
 {
   return static_cast<int64_t>(sResolution);
 }
 
 static bool
 HasStableTSC()
 {
+#if defined(_M_ARM64)
+  // AArch64 defines that its system counter run at a constant rate
+  // regardless of the current clock frequency of the system.  See "The
+  // Generic Timer", section D7, in the ARMARM for ARMv8.
+  return true;
+#else
   union
   {
     int regs[4];
     struct
     {
       int nIds;
       char cpuString[12];
     };
@@ -458,16 +464,17 @@ HasStableTSC()
     // no way how TSC can run out of sync among cores.
     return false;
   }
 
   __cpuid(regs, 0x80000007);
   // if bit 8 is set than TSC will run at a constant rate
   // in all ACPI P-states, C-states and T-states
   return regs[3] & (1 << 8);
+#endif
 }
 
 static bool gInitialized = false;
 
 MFBT_API void
 TimeStamp::Startup()
 {
   if (gInitialized) {