Bug 676585 - fix JS compilation for Darwin/ARM. r=edwsmith.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 07 Sep 2011 21:31:33 -0700
changeset 76709 6974e199548d67e057f84c104edd2043fdaf45c3
parent 76708 e76839f98b187d0cd364e593cc18864ae0228e7a
child 76710 ea4291bb1c1574be796efe8780408c147e02cb43
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersedwsmith
bugs676585
milestone9.0a1
Bug 676585 - fix JS compilation for Darwin/ARM. r=edwsmith.
js/src/nanojit/CodeAlloc.cpp
js/src/nanojit/njcpudetect.h
--- a/js/src/nanojit/CodeAlloc.cpp
+++ b/js/src/nanojit/CodeAlloc.cpp
@@ -253,19 +253,23 @@ namespace nanojit
     }
 
     void CodeAlloc::flushICache(CodeList* &blocks) {
         for (CodeList *b = blocks; b != 0; b = b->next)
             flushICache(b->start(), b->size());
     }
 
 #if defined(AVMPLUS_UNIX) && defined(NANOJIT_ARM)
+#if defined(__APPLE__)
+#include <libkern/OSCacheControl.h>
+#else
 #include <asm/unistd.h>
 extern "C" void __clear_cache(char *BEG, char *END);
 #endif
+#endif
 
 #if defined(AVMPLUS_UNIX) && defined(NANOJIT_MIPS)
 #include <asm/cachectl.h>
 extern  "C" int cacheflush(char *addr, int nbytes, int cache);
 #endif
 
 #ifdef AVMPLUS_SPARC
 // Note: the linux #define provided by the compiler.
@@ -345,16 +349,20 @@ extern  "C" void sync_instruction_memory
         cacheflush((char *)start, len, BCACHE);
     }
 
 #elif defined AVMPLUS_UNIX
     #ifdef ANDROID
     void CodeAlloc::flushICache(void *start, size_t len) {
         cacheflush((int)start, (int)start + len, 0);
     }
+    #elif defined(AVMPLUS_ARM) && defined(__APPLE__)
+    void CodeAlloc::flushICache(void *start, size_t len) {
+        sys_dcache_flush(start, len);
+    }
     #else
     // fixme: __clear_cache is a libgcc feature, test for libgcc or gcc
     void CodeAlloc::flushICache(void *start, size_t len) {
         __clear_cache((char*)start, (char*)start + len);
     }
     #endif
 #endif // AVMPLUS_MAC && NANOJIT_PPC
 
--- a/js/src/nanojit/njcpudetect.h
+++ b/js/src/nanojit/njcpudetect.h
@@ -71,16 +71,17 @@
         defined(__ARM_ARCH_7M__) || \
         defined(__ARM_ARCH_7R__) || \
         defined(_ARM_ARCH_7)
 
     #define NJ_COMPILER_ARM_ARCH 7
 
 #elif   defined(__ARM_ARCH_6__) || \
         defined(__ARM_ARCH_6J__) || \
+        defined(__ARM_ARCH_6K__) || \
         defined(__ARM_ARCH_6T2__) || \
         defined(__ARM_ARCH_6Z__) || \
         defined(__ARM_ARCH_6ZK__) || \
         defined(__ARM_ARCH_6M__) || \
         defined(_ARM_ARCH_6)
 
     #define NJ_COMPILER_ARM_ARCH 6