Bug 555338 - preprocessor define to tell when rdtsc is available. r=nnethercote.
authorIgnore Bukanov <igor@mir2.org>
Sun, 28 Mar 2010 15:31:53 -0700
changeset 40384 46b22e830aa97c4ffdfbaef459485c59372bde93
parent 40383 aaf6469a6edee1b23b57b7ec8e0bd8d1e674f8a9
child 40385 cb5914d2a5db3f99538e96ae76f1cfd7e19ee50b
push id12610
push userrsayre@mozilla.com
push dateMon, 05 Apr 2010 17:26:41 +0000
treeherdermozilla-central@1942c0b4e101 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnnethercote
bugs555338
milestone1.9.3a3pre
Bug 555338 - preprocessor define to tell when rdtsc is available. r=nnethercote.
js/src/nanojit/avmplus.h
--- a/js/src/nanojit/avmplus.h
+++ b/js/src/nanojit/avmplus.h
@@ -87,61 +87,79 @@
 #endif
 
 #ifdef _DEBUG
 void NanoAssertFail();
 #endif
 
 #if defined(AVMPLUS_IA32)
 #if defined(_MSC_VER)
+
+# define AVMPLUS_HAS_RDTSC 1
+
 __declspec(naked) static inline __int64 rdtsc()
 {
     __asm
     {
         rdtsc;
         ret;
     }
 }
+
 #elif defined(SOLARIS)
+
+# define AVMPLUS_HAS_RDTSC 1
+
 static inline unsigned long long rdtsc(void)
 {
     unsigned long long int x;
     asm volatile (".byte 0x0f, 0x31" : "=A" (x));
     return x;
 }
+
 #elif defined(__i386__)
+
+# define AVMPLUS_HAS_RDTSC 1
+
 static __inline__ unsigned long long rdtsc(void)
 {
   unsigned long long int x;
      __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
      return x;
 }
+
 #endif /* compilers */
 
 #elif defined(__x86_64__)
 
+# define AVMPLUS_HAS_RDTSC 1
+
 static __inline__ uint64_t rdtsc(void)
 {
   unsigned hi, lo;
   __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
   return ( (uint64_t)lo)|( ((uint64_t)hi)<<32 );
 }
 
 #elif defined(_MSC_VER) && defined(_M_AMD64)
 
+# define AVMPLUS_HAS_RDTSC 1
+
 #include <intrin.h>
 #pragma intrinsic(__rdtsc)
 
 static inline unsigned __int64 rdtsc(void)
 {
     return __rdtsc();
 }
 
 #elif defined(__powerpc__)
 
+# define AVMPLUS_HAS_RDTSC 1
+
 typedef unsigned long long int unsigned long long;
 
 static __inline__ unsigned long long rdtsc(void)
 {
   unsigned long long int result=0;
   unsigned long int upper, lower,tmp;
   __asm__ volatile(
                 "0:                  \n"
@@ -156,16 +174,20 @@ static __inline__ unsigned long long rdt
   result = result<<32;
   result = result|lower;
 
   return(result);
 }
 
 #endif /* architecture */
 
+#ifndef AVMPLUS_HAS_RDTSC
+# define AVMPLUS_HAS_RDTSC 0
+#endif
+
 struct JSContext;
 
 #ifdef PERFM
 # define PERFM_NVPROF(n,v) _nvprof(n,v)
 # define PERFM_NTPROF(n) _ntprof(n)
 # define PERFM_TPROF_END() _tprof_end()
 #else
 # define PERFM_NVPROF(n,v)