File webkitgtk-aarch64.patch of Package webkitgtk
Index: webkitgtk-2.4.10/Source/JavaScriptCore/assembler/ARM64Assembler.h
===================================================================
--- webkitgtk-2.4.10.orig/Source/JavaScriptCore/assembler/ARM64Assembler.h
+++ webkitgtk-2.4.10/Source/JavaScriptCore/assembler/ARM64Assembler.h
@@ -29,6 +29,7 @@
#if ENABLE(ASSEMBLER) && CPU(ARM64)
#include "AssemblerBuffer.h"
+#include <limits.h>
#include <wtf/Assertions.h>
#include <wtf/Vector.h>
#include <stdint.h>
@@ -583,9 +584,9 @@ public:
JumpType m_type : 8;
JumpLinkType m_linkType : 8;
Condition m_condition : 4;
- bool m_is64Bit : 1;
unsigned m_bitNumber : 6;
- RegisterID m_compareRegister : 5;
+ RegisterID m_compareRegister : 6;
+ bool m_is64Bit : 1;
} realTypes;
struct CopyTypes {
uint64_t content[3];
@@ -2752,10 +2753,34 @@ public:
unsigned debugOffset() { return m_buffer.debugOffset(); }
+#if OS(LINUX) && COMPILER(GCC)
+ static inline void linuxPageFlush(uintptr_t begin, uintptr_t end)
+ {
+ __builtin___clear_cache(reinterpret_cast<void*>(begin), reinterpret_cast<void*>(end));
+ }
+#endif
+
static void cacheFlush(void* code, size_t size)
{
#if OS(IOS)
sys_cache_control(kCacheFunctionPrepareForExecution, code, size);
+#elif OS(LINUX)
+ 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);
#else
#error "The cacheFlush support is missing on this platform."
#endif
Index: webkitgtk-2.4.10/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
===================================================================
--- webkitgtk-2.4.10.orig/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
+++ webkitgtk-2.4.10/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
@@ -130,7 +130,6 @@ public:
// FIXME: Get reasonable implementations for these
static bool shouldBlindForSpecificArch(uint32_t value) { return value >= 0x00ffffff; }
static bool shouldBlindForSpecificArch(uint64_t value) { return value >= 0x00ffffff; }
- static bool shouldBlindForSpecificArch(uintptr_t value) { return value >= 0x00ffffff; }
// Integer operations:
Index: webkitgtk-2.4.10/Source/JavaScriptCore/offlineasm/arm64.rb
===================================================================
--- webkitgtk-2.4.10.orig/Source/JavaScriptCore/offlineasm/arm64.rb
+++ webkitgtk-2.4.10/Source/JavaScriptCore/offlineasm/arm64.rb
@@ -127,7 +127,7 @@ class RegisterID
when 'sp'
'sp'
when 'lr'
- 'lr'
+ 'x30'
else
raise "Bad register name #{@name} at #{codeOriginString}"
end
@@ -585,9 +585,9 @@ class Instruction
$asm.puts "stp #{ops[0].arm64Operand(:ptr)}, #{ops[1].arm64Operand(:ptr)}, [sp, #-16]!"
}
when "popLRAndFP"
- $asm.puts "ldp fp, lr, [sp], #16"
+ $asm.puts "ldp x29, x30, [sp], #16"
when "pushLRAndFP"
- $asm.puts "stp fp, lr, [sp, #-16]!"
+ $asm.puts "stp x29, x30, [sp, #-16]!"
when "popCalleeSaves"
$asm.puts "ldp x28, x27, [sp], #16"
$asm.puts "ldp x26, x25, [sp], #16"
@@ -607,13 +607,13 @@ class Instruction
emitARM64("mov", operands, :ptr)
end
when "sxi2p"
- emitARM64("sxtw", operands, :ptr)
+ emitARM64("sxtw", operands, [:int, :ptr])
when "sxi2q"
- emitARM64("sxtw", operands, :ptr)
+ emitARM64("sxtw", operands, [:int, :ptr])
when "zxi2p"
- emitARM64("uxtw", operands, :ptr)
+ emitARM64("uxtw", operands, [:int, :ptr])
when "zxi2q"
- emitARM64("uxtw", operands, :ptr)
+ emitARM64("uxtw", operands, [:int, :ptr])
when "nop"
$asm.puts "nop"
when "bieq", "bbeq"
Index: webkitgtk-2.4.10/Source/WTF/wtf/Atomics.h
===================================================================
--- webkitgtk-2.4.10.orig/Source/WTF/wtf/Atomics.h
+++ webkitgtk-2.4.10/Source/WTF/wtf/Atomics.h
@@ -123,7 +123,7 @@ inline bool weakCompareAndSwap(volatile
"b.ne 0f\n\t"
"stxr %w1, %w4, %0\n\t"
"0:"
- : "+m"(*location), "=&r"(result), "=&r"(tmp)
+ : "+Q"(*location), "=&r"(result), "=&r"(tmp)
: "r"(expected), "r"(newValue)
: "memory");
result = !result;
@@ -163,7 +163,7 @@ inline bool weakCompareAndSwap(void*vola
"b.ne 0f\n\t"
"stxr %w1, %x4, %0\n\t"
"0:"
- : "+m"(*location), "=&r"(result), "=&r"(tmp)
+ : "+Q"(*location), "=&r"(result), "=&r"(tmp)
: "r"(expected), "r"(newValue)
: "memory");
return !result;