File webkitgtk-aarch64.patch of Package webkitgtk
Index: webkitgtk-2.4.9/Source/JavaScriptCore/assembler/ARM64Assembler.h
===================================================================
--- webkitgtk-2.4.9.orig/Source/JavaScriptCore/assembler/ARM64Assembler.h
+++ webkitgtk-2.4.9/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.9/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
===================================================================
--- webkitgtk-2.4.9.orig/Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
+++ webkitgtk-2.4.9/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.9/Source/JavaScriptCore/offlineasm/arm64.rb
===================================================================
--- webkitgtk-2.4.9.orig/Source/JavaScriptCore/offlineasm/arm64.rb
+++ webkitgtk-2.4.9/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.9/Source/WTF/wtf/Atomics.h
===================================================================
--- webkitgtk-2.4.9.orig/Source/WTF/wtf/Atomics.h
+++ webkitgtk-2.4.9/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;
Index: webkitgtk-2.4.9/Source/WTF/wtf/Platform.h
===================================================================
--- webkitgtk-2.4.9.orig/Source/WTF/wtf/Platform.h
+++ webkitgtk-2.4.9/Source/WTF/wtf/Platform.h
@@ -169,7 +169,7 @@
#endif
/* CPU(ARM64) - Apple */
-#if defined(__arm64__) && defined(__APPLE__)
+#if (defined(__arm64__) && defined(__APPLE__)) || defined(__aarch64__)
#define WTF_CPU_ARM64 1
#endif
Index: webkitgtk-2.4.9/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
===================================================================
--- webkitgtk-2.4.9.orig/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
+++ webkitgtk-2.4.9/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp
@@ -1040,61 +1040,61 @@ TransformationMatrix& TransformationMatr
const double* rightMatrix = &(mat.m_matrix[0][0]);
asm volatile (
// First, load the leftMatrix completely in memory. The leftMatrix is in v16-v23.
- "mov x4, %[leftMatrix]\n\t"
- "ld1.2d {v16, v17, v18, v19}, [%[leftMatrix]], #64\n\t"
- "ld1.2d {v20, v21, v22, v23}, [%[leftMatrix]]\n\t"
+ "mov x4, %[leftMatrix]\n\t"
+ "ld1 {v16.2d, v17.2d, v18.2d, v19.2d}, [%[leftMatrix]], #64\n\t"
+ "ld1 {v20.2d, v21.2d, v22.2d, v23.2d}, [%[leftMatrix]]\n\t"
// First row.
- "ld4r.2d {v24, v25, v26, v27}, [%[rightMatrix]], #32\n\t"
- "fmul.2d v28, v24, v16\n\t"
- "fmul.2d v29, v24, v17\n\t"
- "fmla.2d v28, v25, v18\n\t"
- "fmla.2d v29, v25, v19\n\t"
- "fmla.2d v28, v26, v20\n\t"
- "fmla.2d v29, v26, v21\n\t"
- "fmla.2d v28, v27, v22\n\t"
- "fmla.2d v29, v27, v23\n\t"
+ "ld4r {v24.2d, v25.2d, v26.2d, v27.2d}, [%[rightMatrix]], #32\n\t"
+ "fmul v28.2d, v24.2d, v16.2d\n\t"
+ "fmul v29.2d, v24.2d, v17.2d\n\t"
+ "fmla v28.2d, v25.2d, v18.2d\n\t"
+ "fmla v29.2d, v25.2d, v19.2d\n\t"
+ "fmla v28.2d, v26.2d, v20.2d\n\t"
+ "fmla v29.2d, v26.2d, v21.2d\n\t"
+ "fmla v28.2d, v27.2d, v22.2d\n\t"
+ "fmla v29.2d, v27.2d, v23.2d\n\t"
- "ld4r.2d {v0, v1, v2, v3}, [%[rightMatrix]], #32\n\t"
- "st1.2d {v28, v29}, [x4], #32\n\t"
+ "ld4r {v0.2d, v1.2d, v2.2d, v3.2d}, [%[rightMatrix]], #32\n\t"
+ "st1 {v28.2d, v29.2d}, [x4], #32\n\t"
// Second row.
- "fmul.2d v30, v0, v16\n\t"
- "fmul.2d v31, v0, v17\n\t"
- "fmla.2d v30, v1, v18\n\t"
- "fmla.2d v31, v1, v19\n\t"
- "fmla.2d v30, v2, v20\n\t"
- "fmla.2d v31, v2, v21\n\t"
- "fmla.2d v30, v3, v22\n\t"
- "fmla.2d v31, v3, v23\n\t"
+ "fmul v30.2d, v0.2d, v16.2d\n\t"
+ "fmul v31.2d, v0.2d, v17.2d\n\t"
+ "fmla v30.2d, v1.2d, v18.2d\n\t"
+ "fmla v31.2d, v1.2d, v19.2d\n\t"
+ "fmla v30.2d, v2.2d, v20.2d\n\t"
+ "fmla v31.2d, v2.2d, v21.2d\n\t"
+ "fmla v30.2d, v3.2d, v22.2d\n\t"
+ "fmla v31.2d, v3.2d, v23.2d\n\t"
- "ld4r.2d {v24, v25, v26, v27}, [%[rightMatrix]], #32\n\t"
- "st1.2d {v30, v31}, [x4], #32\n\t"
+ "ld4r {v24.2d, v25.2d, v26.2d, v27.2d}, [%[rightMatrix]], #32\n\t"
+ "st1 {v30.2d, v31.2d}, [x4], #32\n\t"
// Third row.
- "fmul.2d v28, v24, v16\n\t"
- "fmul.2d v29, v24, v17\n\t"
- "fmla.2d v28, v25, v18\n\t"
- "fmla.2d v29, v25, v19\n\t"
- "fmla.2d v28, v26, v20\n\t"
- "fmla.2d v29, v26, v21\n\t"
- "fmla.2d v28, v27, v22\n\t"
- "fmla.2d v29, v27, v23\n\t"
+ "fmul v28.2d, v24.2d, v16.2d\n\t"
+ "fmul v29.2d, v24.2d, v17.2d\n\t"
+ "fmla v28.2d, v25.2d, v18.2d\n\t"
+ "fmla v29.2d, v25.2d, v19.2d\n\t"
+ "fmla v28.2d, v26.2d, v20.2d\n\t"
+ "fmla v29.2d, v26.2d, v21.2d\n\t"
+ "fmla v28.2d, v27.2d, v22.2d\n\t"
+ "fmla v29.2d, v27.2d, v23.2d\n\t"
- "ld4r.2d {v0, v1, v2, v3}, [%[rightMatrix]], #32\n\t"
- "st1.2d {v28, v29}, [x4], #32\n\t"
+ "ld4r {v0.2d, v1.2d, v2.2d, v3.2d}, [%[rightMatrix]], #32\n\t"
+ "st1 {v28.2d, v29.2d}, [x4], #32\n\t"
// Fourth row.
- "fmul.2d v30, v0, v16\n\t"
- "fmul.2d v31, v0, v17\n\t"
- "fmla.2d v30, v1, v18\n\t"
- "fmla.2d v31, v1, v19\n\t"
- "fmla.2d v30, v2, v20\n\t"
- "fmla.2d v31, v2, v21\n\t"
- "fmla.2d v30, v3, v22\n\t"
- "fmla.2d v31, v3, v23\n\t"
+ "fmul v30.2d, v0.2d, v16.2d\n\t"
+ "fmul v31.2d, v0.2d, v17.2d\n\t"
+ "fmla v30.2d, v1.2d, v18.2d\n\t"
+ "fmla v31.2d, v1.2d, v19.2d\n\t"
+ "fmla v30.2d, v2.2d, v20.2d\n\t"
+ "fmla v31.2d, v2.2d, v21.2d\n\t"
+ "fmla v30.2d, v3.2d, v22.2d\n\t"
+ "fmla v31.2d, v3.2d, v23.2d\n\t"
- "st1.2d {v30, v31}, [x4]\n\t"
+ "st1 {v30.2d, v31.2d}, [x4]\n\t"
: [leftMatrix]"+r"(leftMatrix), [rightMatrix]"+r"(rightMatrix)
: