Merge.
authorAndreas Gal <gal@mozilla.com>
Thu, 10 Jul 2008 09:24:59 -0700
changeset 17575 d6b5b13e1168f0cd53c20689ad1649cc1f2455d2
parent 17574 bd182cf976cc7171c97853ab8caba0b38148ef77 (current diff)
parent 17573 9af4862e055d5c7ace8e09dedf8d91e0a84ae03a (diff)
child 17576 ae78505d5548754ebd79733f9557314d592548be
push id1452
push usershaver@mozilla.com
push dateFri, 22 Aug 2008 00:08:22 +0000
treeherdermozilla-central@d13bb0868596 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone1.9.1a1pre
Merge.
js/src/builtins.tbl
js/src/jstracer.cpp
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -120,16 +120,22 @@ CPPSRCS		= \
 		jsscope.cpp \
 		jsscript.cpp \
 		jsstr.cpp \
 		jstracer.cpp \
 		jsutil.cpp \
 		jsxdrapi.cpp \
 		jsxml.cpp \
 		prmjtime.cpp \
+		nanojit/Assembler.cpp  \
+		nanojit/Fragmento.cpp  \
+		nanojit/LIR.cpp        \
+		nanojit/RegAlloc.cpp   \
+		nanojit/avmplus.cpp    \
+		jsbuiltins.cpp         \
 		$(NULL)
 
 ifdef HAVE_DTRACE
 CSRCS 		+= \
 		jsdtracef.c
 endif
 
 EXPORTS		= \
@@ -177,18 +183,39 @@ EXPORTS		= \
 		jsstddef.h \
 		jsstr.h \
 		jstracer.h \
 		jstracerinlines.h \
 		jstypes.h \
 		jsutil.h \
 		jsxdrapi.h \
 		jsxml.h \
+		nanojit/Assembler.h     \
+		nanojit/LIR.h		\
+		nanojit/avmplus.h	\
+		nanojit/vm_fops.h	\
+		nanojit/Fragmento.h	\
+		nanojit/Native.h	\
+		nanojit/RegAlloc.h	\
+		nanojit/nanojit.h	\
+		builtins.tbl \
 		$(NULL)
 
+ifdef DEBUG
+EXPORTS += nanojit/TraceTreeDrawer.h
+CPPSRCS += nanojit/TraceTreeDrawer.cpp nanojit/Tests.cpp
+endif
+
+DEFINES += -DFEATURE_NANOJIT
+ifeq (86,$(findstring 86,$(OS_TEST)))
+DEFINES += -DAVMPLUS_IA32
+CPPSRCS += nanojit/Nativei386.cpp
+EXPORTS += nanojit/Nativei386.h
+endif
+
 ifdef HAVE_DTRACE
 EXPORTS 	+= \
 		jsdtracef.h \
 		javascript-trace.h \
 		$(NULL)
 endif
 
 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
@@ -259,16 +286,20 @@ ifdef HAVE_DTRACE
 ifneq ($(OS_ARCH),Darwin)
 DTRACE_PROBE_OBJ = $(LIBRARY_NAME)-dtrace.$(OBJ_SUFFIX)
 endif
 MOZILLA_DTRACE_SRC = $(srcdir)/javascript-trace.d
 endif
 
 include $(topsrcdir)/config/rules.mk
 
+# our build system doesn't handle subdir srcs very gracefully today
+export::
+	mkdir -p nanojit
+
 DEFINES		+= -DEXPORT_JS_API 
 
 INCLUDES	+= -I$(srcdir)
 
 # MSVC '-Gy' cc flag and '/OPT:REF' linker flag cause JS_GetArgument and
 # JS_GetLocalVariable to be folded to the same address by the linker, 
 # leading to a crash on startup. See bug 151066. So, in optimized builds,
 # add the /OPT:NOICF flag, which turns off 'identical COMDAT folding'.
--- a/js/src/Makefile.ref
+++ b/js/src/Makefile.ref
@@ -50,16 +50,19 @@
 
 DEPTH = .
 
 include config.mk
 
 #NS_USE_NATIVE = 1
 
 DEFINES += -DJS_TRACER
+ifndef NANOJIT_ARCH
+$(error NANOJIT_ARCH not defined in config/$(OS_CONFIG).mk, can't build with JIT) #'
+endif
 
 ifdef NARCISSUS
 DEFINES += -DNARCISSUS
 endif
 
 # Look in OBJDIR to find jsautocfg.h and jsautokw.h
 INCLUDES   += -I. -Inanojit -I$(OBJDIR)
 
@@ -76,17 +79,17 @@ endif
 ifdef JS_NO_THIN_LOCKS
 DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
 endif
 
 ifdef JS_HAS_FILE_OBJECT
 DEFINES += -DJS_HAS_FILE_OBJECT
 endif
 
-DEFINES += -DFEATURE_NANOJIT -DAVMPLUS_IA32 -DTRACEMONKEY
+DEFINES += -DFEATURE_NANOJIT
 
 #
 # XCFLAGS may be set in the environment or on the gmake command line
 #
 #CFLAGS += -DDEBUG -DDEBUG_brendan -DJS_ARENAMETER -DJS_HASHMETER -DJS_DUMP_PROPTREE_STATS -DJS_DUMP_SCOPE_METERS -DJS_SCOPE_DEPTH_METER -DJS_BASIC_STATS
 CFLAGS          += $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS)
 INTERP_CFLAGS   += $(INTERP_OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) $(INTERP_XCFLAGS)
 BUILTINS_CFLAGS += $(BUILTINS_OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) $(BUILTINS_XCFLAGS)
@@ -181,23 +184,21 @@ JS_HFILES =		\
 	jsscan.h	\
 	jsscope.h	\
 	jsscript.h	\
 	jsstr.h		\
 	jsxdrapi.h	\
 	jsxml.h		\
 	nanojit/Assembler.h     \
 	nanojit/LIR.h		\
-	nanojit/NativeARM.h	\
-	nanojit/Nativei386.h	\
+	nanojit/Native$(NANOJIT_ARCH).h	\
 	nanojit/avmplus.h	\
 	nanojit/vm_fops.h	\
 	nanojit/Fragmento.h	\
 	nanojit/Native.h	\
-	nanojit/NativeThumb.h	\
 	nanojit/RegAlloc.h	\
 	nanojit/nanojit.h	\
 	nanojit/TraceTreeDrawer.h \
 	$(NULL)
 
 API_HFILES =		\
 	jsapi.h		\
 	jsdbgapi.h	\
@@ -263,23 +264,25 @@ JS_CPPFILES =		\
 	jstracer.cpp	\
 	jsutil.cpp	\
 	jsxdrapi.cpp	\
 	jsxml.cpp	\
 	prmjtime.cpp	\
 	nanojit/Assembler.cpp  \
 	nanojit/Fragmento.cpp  \
 	nanojit/LIR.cpp        \
-	nanojit/Nativei386.cpp \
+	nanojit/Native$(NANOJIT_ARCH).cpp \
 	nanojit/RegAlloc.cpp   \
 	nanojit/avmplus.cpp    \
-	nanojit/Tests.cpp      \
-	nanojit/TraceTreeDrawer.cpp \
 	$(NULL)
 
+ifdef DEBUG
+JS_CPPFILES += nanojit/TraceTreeDrawer.cpp
+endif
+
 ifdef JS_LIVECONNECT
 DIRS      += liveconnect
 endif
 
 ifdef JS_HAS_FILE_OBJECT
 JS_CPPFILES += jsfile.cpp
 JS_HFILES += jsfile.h
 endif
--- a/js/src/config.mk
+++ b/js/src/config.mk
@@ -179,19 +179,19 @@ ifeq ($(OS_ARCH),WINNT)
 HOST_BIN_SUFFIX = .exe
 else
 HOST_BIN_SUFFIX =
 endif
 endif
 
 # Name of the binary code directories
 ifdef BUILD_IDG
-OBJDIR          = $(OS_CONFIG)$(OBJDIR_TAG).OBJD
+OBJDIR          = $(OS_CONFIG)$(OBJDIR_TAG)$(XOBJDIR_TAG).OBJD
 else
-OBJDIR          = $(OS_CONFIG)$(OBJDIR_TAG).OBJ
+OBJDIR          = $(OS_CONFIG)$(OBJDIR_TAG)$(XOBJDIR_TAG).OBJ
 endif
 VPATH           = $(OBJDIR)
 
 LCJAR = js15lc30.jar
 
 # Library name
 LIBDIR := lib
 ifeq ($(CPU_ARCH), x86_64)
--- a/js/src/config/Darwin.mk
+++ b/js/src/config/Darwin.mk
@@ -55,16 +55,18 @@ SO_SUFFIX = dylib
 
 #.c.o:
 #      $(CC) -c -MD $*.d $(CFLAGS) $<
 
 CPU_ARCH = $(shell uname -m)
 ifeq (86,$(findstring 86,$(CPU_ARCH)))
 CPU_ARCH = x86
 OS_CFLAGS+= -DX86_LINUX
+OS_CFLAGS += -DAVMPLUS_IA32
+NANOJIT_ARCH = i386
 endif
 GFX_ARCH = x
 
 OS_LIBS = -lc -framework System
 
 ASFLAGS += -x assembler-with-cpp
 
 ifeq ($(CPU_ARCH),alpha)
--- a/js/src/config/Linux_All.mk
+++ b/js/src/config/Linux_All.mk
@@ -53,16 +53,18 @@ MKSHLIB = $(LD) -shared $(XMKSHLIBOPTS)
 #      $(CC) -c -MD $*.d $(CFLAGS) $<
 
 CPU_ARCH = $(shell uname -m)
 # don't filter in x86-64 architecture
 ifneq (x86_64,$(CPU_ARCH))
 ifeq (86,$(findstring 86,$(CPU_ARCH)))
 CPU_ARCH = x86
 OS_CFLAGS+= -DX86_LINUX
+OS_CFLAGS += -DAVMPLUS_IA32
+NANOJIT_ARCH = i386
 
 ifeq (gcc, $(CC))
 # if using gcc on x86, check version for opt bug 
 # (http://bugzilla.mozilla.org/show_bug.cgi?id=24892)
 GCC_VERSION := $(shell gcc -v 2>&1 | grep version | awk '{ print $$3 }')
 GCC_LIST:=$(sort 2.91.66 $(GCC_VERSION) )
 
 ifeq (2.91.66, $(firstword $(GCC_LIST)))
--- a/js/src/jsbuiltins.cpp
+++ b/js/src/jsbuiltins.cpp
@@ -34,23 +34,23 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include <math.h>
 
-#include "nanojit/avmplus.h"
-#include "nanojit/nanojit.h"
-#include "jstracer.h"
 #include "jsapi.h"
 #include "jsnum.h"
 #include "jsgc.h"
 #include "jscntxt.h"
+#include "nanojit/avmplus.h"
+#include "nanojit/nanojit.h"
+#include "jstracer.h"
 
 using namespace nanojit;
 
 FASTCALL jsdouble builtin_dmod(jsdouble a, jsdouble b)
 {
     if (b == 0.0) {
         jsdpun u;
         u.s.hi = JSDOUBLE_HI32_EXPMASK | JSDOUBLE_HI32_MANTMASK;
--- a/js/src/jslock.h
+++ b/js/src/jslock.h
@@ -34,29 +34,26 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #ifndef jslock_h__
 #define jslock_h__
 
-#include "jspubtd.h"    /* for jsword, JSRuntime, etc. */
-
 #ifdef JS_THREADSAFE
 
 #include "jstypes.h"
 #include "pratom.h"
 #include "prlock.h"
 #include "prcvar.h"
 #include "prthread.h"
 
-#ifdef JS_DEBUG_TITLE_LOCKS
 #include "jsprvtd.h"    /* for JSScope, etc. */
-#endif
+#include "jspubtd.h"    /* for JSRuntime, etc. */
 
 JS_BEGIN_EXTERN_C
 
 #define Thin_GetWait(W) ((jsword)(W) & 0x1)
 #define Thin_SetWait(W) ((jsword)(W) | 0x1)
 #define Thin_RemoveWait(W) ((jsword)(W) & ~0x1)
 
 typedef struct JSFatLock JSFatLock;
@@ -92,17 +89,17 @@ struct JSTitle {
     union {                             /* union lockful and lock-free state: */
         jsrefcount  count;              /* lock entry count for reentrancy */
         JSTitle     *link;              /* next link in rt->titleSharingTodo */
     } u;
 #ifdef JS_DEBUG_TITLE_LOCKS
     const char      *file[4];           /* file where lock was (re-)taken */
     unsigned int    line[4];            /* line where lock was (re-)taken */
 #endif
-};
+};    
 
 /*
  * Title structures must be immediately preceded by JSObjectMap structures for
  * maps that use titles for threadsafety.  This is enforced by assertion in
  * jsscope.h; see bug 408416 for future remedies to this somewhat fragile
  * architecture.
  */
 
@@ -111,121 +108,16 @@ struct JSTitle {
 
 /*
  * Atomic increment and decrement for a reference counter, given jsrefcount *p.
  * NB: jsrefcount is int32, aka PRInt32, so that pratom.h functions work.
  */
 #define JS_ATOMIC_INCREMENT(p)      PR_AtomicIncrement((PRInt32 *)(p))
 #define JS_ATOMIC_DECREMENT(p)      PR_AtomicDecrement((PRInt32 *)(p))
 #define JS_ATOMIC_ADD(p,v)          PR_AtomicAdd((PRInt32 *)(p), (PRInt32)(v))
-#define JS_ATOMIC_SET(p,v)          PR_AtomicSet((PRInt32 *)(p), (PRInt32)(v))
-
-/*
- * Compare-And-Swap (CAS) inline function, ifdef'ed for different platforms.
- */
-
-/* Exclude Alpha NT. */
-#if defined(_WIN32) && defined(_M_IX86)
-#pragma warning( disable : 4035 )
-JS_BEGIN_EXTERN_C
-extern long __cdecl
-_InterlockedCompareExchange(long *volatile dest, long exchange, long comp);
-JS_END_EXTERN_C
-#pragma intrinsic(_InterlockedCompareExchange)
-
-static JS_INLINE int
-js_CompareAndSwapHelper(jsword *w, jsword ov, jsword nv)
-{
-    _InterlockedCompareExchange(w, nv, ov);
-    __asm {
-        sete al
-    }
-}
-
-static JS_INLINE int
-js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
-{
-    return (js_CompareAndSwapHelper(w, ov, nv) & 1);
-}
-
-#elif defined(XP_MACOSX) || defined(DARWIN)
-
-#include <libkern/OSAtomic.h>
-
-static JS_INLINE int
-js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
-{
-    /* Details on these functions available in the manpage for atomic */
-#if JS_BYTES_PER_WORD == 8 && JS_BYTES_PER_LONG != 8
-    return OSAtomicCompareAndSwap64Barrier(ov, nv, (int64_t*) w);
-#else
-    return OSAtomicCompareAndSwap32Barrier(ov, nv, (int32_t*) w);
-#endif
-}
-
-#elif defined(__GNUC__) && defined(__i386__)
-
-/* Note: This fails on 386 cpus, cmpxchgl is a >= 486 instruction */
-static JS_INLINE int
-js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
-{
-    unsigned int res;
-
-    __asm__ __volatile__ (
-                          "lock\n"
-                          "cmpxchgl %2, (%1)\n"
-                          "sete %%al\n"
-                          "andl $1, %%eax\n"
-                          : "=a" (res)
-                          : "r" (w), "r" (nv), "a" (ov)
-                          : "cc", "memory");
-    return (int)res;
-}
-
-#elif defined(SOLARIS) && defined(sparc) && defined(ULTRA_SPARC)
-
-static JS_INLINE int
-js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
-{
-#if defined(__GNUC__)
-    unsigned int res;
-    JS_ASSERT(ov != nv);
-    asm volatile ("\
-stbar\n\
-cas [%1],%2,%3\n\
-cmp %2,%3\n\
-be,a 1f\n\
-mov 1,%0\n\
-mov 0,%0\n\
-1:"
-                  : "=r" (res)
-                  : "r" (w), "r" (ov), "r" (nv));
-    return (int)res;
-#else /* !__GNUC__ */
-    extern int compare_and_swap(jsword*, jsword, jsword);
-    JS_ASSERT(ov != nv);
-    return compare_and_swap(w, ov, nv);
-#endif
-}
-
-#elif defined(AIX)
-
-#include <sys/atomic_op.h>
-
-static JS_INLINE int
-js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
-{
-    return !_check_lock((atomic_p)w, ov, nv);
-}
-
-#else
-
-#error "Your platform lacks a compare-and-swap instruction."
-
-#endif /* arch-tests */
 
 #define js_CurrentThreadId()        (jsword)PR_GetCurrentThread()
 #define JS_NEW_LOCK()               PR_NewLock()
 #define JS_DESTROY_LOCK(l)          PR_DestroyLock(l)
 #define JS_ACQUIRE_LOCK(l)          PR_Lock(l)
 #define JS_RELEASE_LOCK(l)          PR_Unlock(l)
 #define JS_LOCK0(P,M)               js_Lock(P,M)
 #define JS_UNLOCK0(P,M)             js_Unlock(P,M)
@@ -351,37 +243,19 @@ extern void js_Lock(JSThinLock *tl, jswo
 extern void js_Unlock(JSThinLock *tl, jsword me);
 
 #endif /* arch-tests */
 
 #else  /* !JS_THREADSAFE */
 
 JS_BEGIN_EXTERN_C
 
-static inline int32
-js_AtomicAdd(int32* p, int32 v)
-{
-    int32 r = *p;
-    *p = v;
-    return r;
-}
-
 #define JS_ATOMIC_INCREMENT(p)      (++*(p))
 #define JS_ATOMIC_DECREMENT(p)      (--*(p))
 #define JS_ATOMIC_ADD(p,v)          (*(p) += (v))
-#define JS_ATOMIC_SET(p,v)          (js_AtomicAdd((int32*)p, (int32)v))
-
-static inline int
-js_CompareAndSwap(jsword *w, jsword ov, jsword nv)
-{
-    if (*w != ov)
-        return 0;
-    *w = nv;
-    return 1;
-}
 
 #define JS_CurrentThreadId() 0
 #define JS_NEW_LOCK()               NULL
 #define JS_DESTROY_LOCK(l)          ((void)0)
 #define JS_ACQUIRE_LOCK(l)          ((void)0)
 #define JS_RELEASE_LOCK(l)          ((void)0)
 #define JS_LOCK0(P,M)               ((void)0)
 #define JS_UNLOCK0(P,M)             ((void)0)
@@ -421,17 +295,17 @@ js_CompareAndSwap(jsword *w, jsword ov, 
 #define JS_AWAIT_GC_DONE(rt)        JS_WAIT_CONDVAR((rt)->gcDone, JS_NO_TIMEOUT)
 #define JS_NOTIFY_GC_DONE(rt)       JS_NOTIFY_ALL_CONDVAR((rt)->gcDone)
 #define JS_AWAIT_REQUEST_DONE(rt)   JS_WAIT_CONDVAR((rt)->requestDone,        \
                                                     JS_NO_TIMEOUT)
 #define JS_NOTIFY_REQUEST_DONE(rt)  JS_NOTIFY_CONDVAR((rt)->requestDone)
 
 #define JS_LOCK(P,CX)               JS_LOCK0(P, CX_THINLOCK_ID(CX))
 #define JS_UNLOCK(P,CX)             JS_UNLOCK0(P, CX_THINLOCK_ID(CX))
-
+ 
 #ifndef SET_OBJ_INFO
 #define SET_OBJ_INFO(obj,f,l)       ((void)0)
 #endif
 #ifndef SET_TITLE_INFO
 #define SET_TITLE_INFO(title,f,l)   ((void)0)
 #endif
 
 JS_END_EXTERN_C
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -999,27 +999,28 @@ js_DeleteRecorder(JSContext* cx)
 #define HOTLOOP2 13
 #define HOTLOOP3 37
 
 bool
 js_LoopEdge(JSContext* cx)
 {
     JSTraceMonitor* tm = &JS_TRACE_MONITOR(cx);
 
+    /* is the recorder currently active? */
+    if (tm->recorder) {
 #ifdef JS_THREADSAFE
-    if (GET_SCOPE(varobj)->title.owner_cx != cx) {
+        /* XXX should this test not be earlier, to avoid even recording? */
+        if (OBJ_SCOPE(tm->recorder->getGlobalFrame()->varobj)->title.ownercx != cx) {
 #ifdef DEBUG
-        printf("Global object not owned by this context.\n");
+            printf("Global object not owned by this context.\n");
 #endif
-        return false; /* we stay away from shared global objects */
-    }
+            return false; /* we stay away from shared global objects */
+        }
 #endif
 
-    /* is the recorder currently active? */
-    if (tm->recorder) {
         if (tm->recorder->loopEdge())
             return true; /* keep recording */
         js_DeleteRecorder(cx);
         return false; /* done recording */
     }
 
     Fragment* f = tm->fragmento->getLoop(cx->fp->regs->pc);
     if (!f->code()) {
--- a/js/src/jstracer.h
+++ b/js/src/jstracer.h
@@ -66,17 +66,17 @@
  * Tracker is used to keep track of values being manipulated by the interpreter
  * during trace recording.
  */
 template <typename T>
 class Tracker {
     struct Page {
         struct Page*    next;
         jsuword         base;
-        T               map[0];
+        T               map[1];
     };
     struct Page* pagelist;
 
     jsuword         getPageBase(const void* v) const;
     struct Page*    findPage(const void* v) const;
     struct Page*    addPage(const void* v);
 public:
     Tracker();
@@ -86,17 +86,17 @@ public:
     void            set(const void* v, T ins);
     void            clear();
 };
 
 struct VMFragmentInfo {
     unsigned                entryNativeFrameSlots;
     unsigned                maxNativeFrameSlots;
     size_t                  nativeStackBase;
-    uint8                   typeMap[0];
+    uint8                   typeMap[1];
 };
 
 extern struct nanojit::CallInfo builtins[];
 
 #define TYPEMAP_GET_TYPE(x)         ((x) & JSVAL_TAGMASK)
 #define TYPEMAP_SET_TYPE(x, t)      (x = (x & 0xf0) | t)
 #define TYPEMAP_GET_FLAG(x, flag)   ((x) & flag)
 #define TYPEMAP_SET_FLAG(x, flag)   do { (x) |= flag; } while (0)
--- a/js/src/nanojit/avmplus.h
+++ b/js/src/nanojit/avmplus.h
@@ -31,16 +31,17 @@
  ***** END LICENSE BLOCK ***** */
 
 #ifndef avm_h___
 #define avm_h___
 
 #include <assert.h>
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include "jstypes.h"
 
 #ifdef _MSC_VER
 #define __msvc_only(x)  x
 #else
 #define __msvc_only(x)
 #endif
 
@@ -52,20 +53,29 @@
 #define NJ_PROFILE
 #include <stdarg.h>
 #endif
 
 #define AvmAssert(x) assert(x)
 #define AvmAssertMsg(x, y) 
 #define AvmDebugLog(x) printf x
 
+#ifdef _MSC_VER
+/*
+ * Can we just take a moment to think about what it means that MSVC doesn't have stdint.h in 2008?
+ * Thanks for your time.
+ */
 typedef JSUint8 uint8_t;
 typedef JSUint16 uint16_t;
 typedef JSUint32 uint32_t;
 typedef JSUint64 uint64_t;
+#else
+#include <stdint.h>
+#endif
+
 
 #if defined(__i386__)
 
 static __inline__ unsigned long long rdtsc(void)
 {
   unsigned long long int x;
      __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));
      return x;