Группа :: Система/Библиотеки
Пакет: libwebkitgtk2
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: webkitgtk-loongarch64.patch
Скачать
Скачать
diff --git a/Source/WTF/wtf/Atomics.h b/Source/WTF/wtf/Atomics.h
index 4f7152a4..9e54e587 100644
--- a/Source/WTF/wtf/Atomics.h
+++ b/Source/WTF/wtf/Atomics.h
@@ -153,6 +153,18 @@ inline bool weakCompareAndSwap(volatile unsigned* location, unsigned expected, u
: "=A"(*location), "=&r"(result), "=&r"(tmp)
: "r"(expected), "r"(newValue)
: "memory");
+#elif CPU(LOONGARCH64)
+ unsigned tmp;
+ unsigned result;
+ asm volatile(
+ "ll.w %2, %0 \n\t"
+ "bne %2, %3, 0f \n\t"
+ "or %1, $r0,%4 \n\t"
+ "sc.w %1, %0 \n\t"
+ "0:"
+ : "=ZC"(*location), "=&r"(result), "=&r"(tmp)
+ : "r"(expected), "r"(newValue)
+ : "memory");
#else
#error "Bad architecture for compare and swap."
#endif
@@ -222,6 +234,21 @@ inline bool weakCompareAndSwap(void*volatile* location, void* expected, void* ne
: "r"(expected), "r"(newValue)
: "t0", "t1", "memory");
return !result;
+#elif CPU(LOONGARCH64)
+ bool result;
+ void* tmp;
+ asm volatile(
+ "ld.w $t0, %3 \n\t"
+ "ld.w $t1, %4 \n\t"
+ "ll.w %2, %0 \n\t"
+ "bne %2, $t0, 0f \n\t"
+ "or %1, $r0, $t1 \n\t"
+ "sc.w %1, %0 \n\t"
+ "0:"
+ : "=ZC"(*location), "=&r"(result), "=&r"(tmp)
+ : "ZC"(expected), "ZC"(newValue)
+ : "t0", "t1", "memory");
+ return !result;
#else
return weakCompareAndSwap(bitwise_cast<unsigned*>(location), bitwise_cast<unsigned>(expected), bitwise_cast<unsigned>(newValue));
#endif
diff --git a/Source/WTF/wtf/FastMalloc.cpp b/Source/WTF/wtf/FastMalloc.cpp
index 18e91ead..ce23d39c 100644
--- a/Source/WTF/wtf/FastMalloc.cpp
+++ b/Source/WTF/wtf/FastMalloc.cpp
@@ -1658,7 +1658,7 @@ template <int BITS> class MapSelector {
};
#if defined(WTF_CHANGES)
-#if CPU(X86_64) || CPU(ARM64) || CPU(RISCV64)
+#if CPU(X86_64) || CPU(ARM64) || CPU(RISCV64) || CPU(LOONGARCH64)
// On all known X86-64 platforms, the upper 16 bits are always unused and therefore
// can be excluded from the PageMap key.
// See http://en.wikipedia.org/wiki/X86-64#Virtual_address_space_details
diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h
index 0f3270dd..877dae8c 100644
--- a/Source/WTF/wtf/Platform.h
+++ b/Source/WTF/wtf/Platform.h
@@ -103,6 +103,11 @@
#define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1
#endif /* MIPS */
+/* CPU(LOONGARCH64) - LoongArch, lp64d ABI */
+#if defined(__loongarch64)
+#define WTF_CPU_LOONGARCH64 1
+#endif
+
/* CPU(RISCV64) - RISCV64 */
#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
#define WTF_CPU_RISCV64 1
@@ -664,6 +669,7 @@
|| CPU(MIPS64) \
|| CPU(PPC64) \
|| CPU(PPC64LE) \
+ || CPU(LOONGARCH64) \
|| CPU(RISCV64)
#define WTF_USE_JSVALUE64 1
#else
@@ -689,6 +695,7 @@
&& (OS(DARWIN) || !COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 1, 0)) \
&& !OS(WINCE) \
&& !(OS(WINDOWS) && CPU(X86_64)) \
+ && !CPU(LOONGARCH64) \
&& !CPU(RISCV64)
#define ENABLE_JIT 1
#endif
@@ -832,7 +839,11 @@
/* Yet Another Regex Runtime - turned on by default for JIT enabled ports. */
#if !defined(ENABLE_YARR_JIT) && (ENABLE(JIT) || ENABLE(LLINT_C_LOOP))
+#if CPU(LOONGARCH64)
+#define ENABLE_YARR_JIT 0
+#else
#define ENABLE_YARR_JIT 1
+#endif
/* Setting this flag compares JIT results with interpreter results. */
#define ENABLE_YARR_JIT_DEBUG 0
@@ -963,7 +974,7 @@
#define WTF_USE_IMLANG_FONT_LINK2 1
#endif
-#if !defined(ENABLE_COMPARE_AND_SWAP) && (OS(WINDOWS) || (COMPILER(GCC) && (CPU(X86) || CPU(X86_64) || CPU(ARM_THUMB2) || CPU(ARM64))) || CPU(RISCV64))
+#if !defined(ENABLE_COMPARE_AND_SWAP) && (OS(WINDOWS) || (COMPILER(GCC) && (CPU(X86) || CPU(X86_64) || CPU(ARM_THUMB2) || CPU(ARM64))) || CPU(RISCV64) || CPU(LOONGARCH64))
#define ENABLE_COMPARE_AND_SWAP 1
#endif
diff --git a/Source/WTF/wtf/dtoa.cpp b/Source/WTF/wtf/dtoa.cpp
index 99ff73c2..03a0d23f 100644
--- a/Source/WTF/wtf/dtoa.cpp
+++ b/Source/WTF/wtf/dtoa.cpp
@@ -46,7 +46,7 @@
#pragma warning(disable: 4554)
#endif
-#if CPU(PPC64) || CPU(X86_64) || CPU(ARM64) || CPU(RISCV64)
+#if CPU(PPC64) || CPU(X86_64) || CPU(ARM64) || CPU(RISCV64) || CPU(LOONGARCH64)
// FIXME: should we enable this on all 64-bit CPUs?
// 64-bit emulation provided by the compiler is likely to be slower than dtoa own code on 32-bit hardware.
#define USE_LONG_LONG
diff --git a/Source/WTF/wtf/dtoa/utils.h b/Source/WTF/wtf/dtoa/utils.h
index c37c7b47..b5fbb552 100644
--- a/Source/WTF/wtf/dtoa/utils.h
+++ b/Source/WTF/wtf/dtoa/utils.h
@@ -49,7 +49,7 @@
defined(__ARMEL__) || \
defined(_MIPS_ARCH_MIPS32R2)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
-#elif CPU(MIPS) || CPU(MIPS64) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || OS(WINCE) || CPU(SH4) || CPU(S390) || CPU(S390X) || CPU(IA64) || CPU(ALPHA) || CPU(ARM64) || CPU(HPPA) || CPU(RISCV64)
+#elif CPU(MIPS) || CPU(MIPS64) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || OS(WINCE) || CPU(SH4) || CPU(S390) || CPU(S390X) || CPU(IA64) || CPU(ALPHA) || CPU(ARM64) || CPU(HPPA) || CPU(RISCV64) || CPU(LOONGARCH64)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(_M_IX86) || defined(__i386__)
#if defined(_WIN32)
diff --git a/Source/WTF/wtf/text/StringImpl.h b/Source/WTF/wtf/text/StringImpl.h
index 1e200984..c163e387 100644
--- a/Source/WTF/wtf/text/StringImpl.h
+++ b/Source/WTF/wtf/text/StringImpl.h
@@ -878,7 +878,7 @@ inline bool equal(const char* a, StringImpl* b) { return equal(b, reinterpret_ca
WTF_EXPORT_STRING_API bool equalNonNull(const StringImpl* a, const StringImpl* b);
// Do comparisons 8 or 4 bytes-at-a-time on architectures where it's safe.
-#if CPU(X86_64) || CPU(ARM64) || CPU(RISCV64)
+#if CPU(X86_64) || CPU(ARM64) || CPU(RISCV64) || CPU(LOONGARCH64)
ALWAYS_INLINE bool equal(const LChar* a, const LChar* b, unsigned length)
{
unsigned dwordLength = length >> 3;