- Revision
- 145505
- Author
- rga...@webkit.org
- Date
- 2013-03-12 02:41:37 -0700 (Tue, 12 Mar 2013)
Log Message
Making more sophisticated cache flush on ARM Linux platform
https://bugs.webkit.org/show_bug.cgi?id=111854
Reviewed by Zoltan Herczeg.
The cache flush on ARM Linux invalidates whole pages
instead of just the required area.
* assembler/ARMAssembler.h:
(ARMAssembler):
(JSC::ARMAssembler::linuxPageFlush):
(JSC::ARMAssembler::cacheFlush):
* assembler/ARMv7Assembler.h:
(ARMv7Assembler):
(JSC::ARMv7Assembler::linuxPageFlush):
(JSC::ARMv7Assembler::cacheFlush):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (145504 => 145505)
--- trunk/Source/_javascript_Core/ChangeLog 2013-03-12 09:30:33 UTC (rev 145504)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-03-12 09:41:37 UTC (rev 145505)
@@ -1,5 +1,24 @@
2013-03-12 Gabor Rapcsanyi <rga...@webkit.org>
+ Making more sophisticated cache flush on ARM Linux platform
+ https://bugs.webkit.org/show_bug.cgi?id=111854
+
+ Reviewed by Zoltan Herczeg.
+
+ The cache flush on ARM Linux invalidates whole pages
+ instead of just the required area.
+
+ * assembler/ARMAssembler.h:
+ (ARMAssembler):
+ (JSC::ARMAssembler::linuxPageFlush):
+ (JSC::ARMAssembler::cacheFlush):
+ * assembler/ARMv7Assembler.h:
+ (ARMv7Assembler):
+ (JSC::ARMv7Assembler::linuxPageFlush):
+ (JSC::ARMv7Assembler::cacheFlush):
+
+2013-03-12 Gabor Rapcsanyi <rga...@webkit.org>
+
Renaming the armv7.rb LLINT backend to arm.rb
https://bugs.webkit.org/show_bug.cgi?id=110565
Modified: trunk/Source/_javascript_Core/assembler/ARMAssembler.h (145504 => 145505)
--- trunk/Source/_javascript_Core/assembler/ARMAssembler.h 2013-03-12 09:30:33 UTC (rev 145504)
+++ trunk/Source/_javascript_Core/assembler/ARMAssembler.h 2013-03-12 09:41:37 UTC (rev 145505)
@@ -1022,29 +1022,46 @@
return AL | B | (offset & BranchOffsetMask);
}
+#if OS(LINUX) && COMPILER(GCC)
+ static inline void linuxPageFlush(uintptr_t begin, uintptr_t end)
+ {
+ asm volatile(
+ "push {r7}\n"
+ "mov r0, %0\n"
+ "mov r1, %1\n"
+ "mov r7, #0xf0000\n"
+ "add r7, r7, #0x2\n"
+ "mov r2, #0x0\n"
+ "svc 0x0\n"
+ "pop {r7}\n"
+ :
+ : "r" (begin), "r" (end)
+ : "r0", "r1", "r2");
+ }
+#endif
+
#if OS(LINUX) && COMPILER(RVCT)
static __asm void cacheFlush(void* code, size_t);
#else
static void cacheFlush(void* code, size_t size)
{
#if OS(LINUX) && COMPILER(GCC)
- uintptr_t currentPage = reinterpret_cast<uintptr_t>(code) & ~(pageSize() - 1);
- uintptr_t lastPage = (reinterpret_cast<uintptr_t>(code) + size) & ~(pageSize() - 1);
- do {
- asm volatile(
- "push {r7}\n"
- "mov r0, %0\n"
- "mov r1, %1\n"
- "mov r7, #0xf0000\n"
- "add r7, r7, #0x2\n"
- "mov r2, #0x0\n"
- "svc 0x0\n"
- "pop {r7}\n"
- :
- : "r" (currentPage), "r" (currentPage + pageSize())
- : "r0", "r1", "r2");
- currentPage += pageSize();
- } while (lastPage >= currentPage);
+ size_t page = pageSize();
+ uintptr_t current = reinterpret_cast<uintptr_t>(code);
+ uintptr_t end = current + size;
+ uintptr_t firstPageEnd = (current & ~(page - 1)) + page;
+
+ if (end <= firstPageEnd) {
+ linuxPageFlush(current, end);
+ return;
+ }
+
+ linuxPageFlush(current, firstPageEnd);
+
+ for (current = firstPageEnd; current + page < end; current += page)
+ linuxPageFlush(current, current + page);
+
+ linuxPageFlush(current, end);
#elif OS(WINCE)
CacheRangeFlush(code, size, CACHE_SYNC_ALL);
#elif OS(QNX) && ENABLE(ASSEMBLER_WX_EXCLUSIVE)
Modified: trunk/Source/_javascript_Core/assembler/ARMv7Assembler.h (145504 => 145505)
--- trunk/Source/_javascript_Core/assembler/ARMv7Assembler.h 2013-03-12 09:30:33 UTC (rev 145504)
+++ trunk/Source/_javascript_Core/assembler/ARMv7Assembler.h 2013-03-12 09:41:37 UTC (rev 145505)
@@ -2213,28 +2213,45 @@
unsigned debugOffset() { return m_formatter.debugOffset(); }
+#if OS(LINUX)
+ static inline void linuxPageFlush(uintptr_t begin, uintptr_t end)
+ {
+ asm volatile(
+ "push {r7}\n"
+ "mov r0, %0\n"
+ "mov r1, %1\n"
+ "movw r7, #0x2\n"
+ "movt r7, #0xf\n"
+ "movs r2, #0x0\n"
+ "svc 0x0\n"
+ "pop {r7}\n"
+ :
+ : "r" (begin), "r" (end)
+ : "r0", "r1", "r2");
+ }
+#endif
+
static void cacheFlush(void* code, size_t size)
{
#if OS(IOS)
sys_cache_control(kCacheFunctionPrepareForExecution, code, size);
#elif OS(LINUX)
- uintptr_t currentPage = reinterpret_cast<uintptr_t>(code) & ~(pageSize() - 1);
- uintptr_t lastPage = (reinterpret_cast<uintptr_t>(code) + size) & ~(pageSize() - 1);
- do {
- asm volatile(
- "push {r7}\n"
- "mov r0, %0\n"
- "mov r1, %1\n"
- "movw r7, #0x2\n"
- "movt r7, #0xf\n"
- "movs r2, #0x0\n"
- "svc 0x0\n"
- "pop {r7}\n"
- :
- : "r" (currentPage), "r" (currentPage + pageSize())
- : "r0", "r1", "r2");
- currentPage += pageSize();
- } while (lastPage >= currentPage);
+ size_t page = pageSize();
+ uintptr_t current = reinterpret_cast<uintptr_t>(code);
+ uintptr_t end = current + size;
+ uintptr_t firstPageEnd = (current & ~(page - 1)) + page;
+
+ if (end <= firstPageEnd) {
+ linuxPageFlush(current, end);
+ return;
+ }
+
+ linuxPageFlush(current, firstPageEnd);
+
+ for (current = firstPageEnd; current + page < end; current += page)
+ linuxPageFlush(current, current + page);
+
+ linuxPageFlush(current, end);
#elif OS(WINCE)
CacheRangeFlush(code, size, CACHE_SYNC_ALL);
#elif OS(QNX)