webkit2gtk: update to 2.28.2

This commit is contained in:
q66 2020-04-29 02:31:07 +02:00
parent 94c9ef894b
commit b8cc761d3f
4 changed files with 135 additions and 78 deletions

View file

@ -0,0 +1,64 @@
From ed5a63c21c4faa0f5a17ebd7a0ccd135b8a880a2 Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Thu, 7 May 2020 19:39:34 +0200
Subject: [PATCH] Fix gcSafeMemcpy on non-x86_64/aarch64 64-bit architectures
The problem at hand here is that the control flow is wrong. As
it was, we'd do something like:
```
if (bytes <= smallCutoff) {
slow path
} else if (aarch64 || bytes <= mediumCutoff) {
either x86_64 path, aarch64 path or slow path
} else {
assert(x86_64)
do x86_64 path, or nothing on other archs
}
```
That means everything on non-x86_64/aarch64 that tried to memcpy
more than mediumCutoff would end up doing nothing.
Fix the code so that slow path is taken automatically always
if running non-x86_64/aarch64 architectures. Remove the #else
in the mediumCutoff branch as that is now never taken.
---
Source/JavaScriptCore/ChangeLog | 16 ++++++++++++++++
Source/JavaScriptCore/heap/GCMemoryOperations.h | 6 ++----
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/Source/JavaScriptCore/heap/GCMemoryOperations.h b/Source/JavaScriptCore/heap/GCMemoryOperations.h
index f2b9e385bc9..ff66071db20 100644
--- Source/JavaScriptCore/heap/GCMemoryOperations.h
+++ Source/JavaScriptCore/heap/GCMemoryOperations.h
@@ -53,7 +53,7 @@ ALWAYS_INLINE void gcSafeMemcpy(T* dst, T* src, size_t bytes)
bitwise_cast<volatile uint64_t*>(dst)[i] = bitwise_cast<volatile uint64_t*>(src)[i];
};
-#if COMPILER(GCC_COMPATIBLE) && USE(JSVALUE64)
+#if COMPILER(GCC_COMPATIBLE) && (CPU(X86_64) || CPU(ARM64))
if (bytes <= smallCutoff)
slowPathForwardMemcpy();
else if (isARM64() || bytes <= mediumCutoff) {
@@ -121,8 +121,6 @@ ALWAYS_INLINE void gcSafeMemcpy(T* dst, T* src, size_t bytes)
:
: "d0", "d1", "memory"
);
-#else
- slowPathForwardMemcpy();
#endif // CPU(X86_64)
} else {
RELEASE_ASSERT(isX86_64());
@@ -139,7 +137,7 @@ ALWAYS_INLINE void gcSafeMemcpy(T* dst, T* src, size_t bytes)
}
#else
slowPathForwardMemcpy();
-#endif // COMPILER(GCC_COMPATIBLE)
+#endif // COMPILER(GCC_COMPATIBLE) && (CPU(X86_64) || CPU(ARM64))
#else
memcpy(dst, src, bytes);
#endif // USE(JSVALUE64)
--
2.26.2

View file

@ -6,7 +6,7 @@ Updated for latest webkit2gtk.
--- Source/JavaScriptCore/runtime/MachineContext.h
+++ Source/JavaScriptCore/runtime/MachineContext.h
@@ -188,7 +188,7 @@ static inline void*& stackPointerImpl(mcontext_t& machineContext)
@@ -196,7 +196,7 @@ static inline void*& stackPointerImpl(mcontext_t& machineContext)
#error Unknown Architecture
#endif
@ -15,7 +15,7 @@ Updated for latest webkit2gtk.
#if CPU(X86)
return reinterpret_cast<void*&>((uintptr_t&) machineContext.gregs[REG_ESP]);
@@ -335,7 +335,7 @@ static inline void*& framePointerImpl(mcontext_t& machineContext)
@@ -347,7 +347,7 @@ static inline void*& framePointerImpl(mcontext_t& machineContext)
#error Unknown Architecture
#endif
@ -24,7 +24,7 @@ Updated for latest webkit2gtk.
// The following sequence depends on glibc's sys/ucontext.h.
#if CPU(X86)
@@ -482,7 +482,7 @@ static inline void*& instructionPointerImpl(mcontext_t& machineContext)
@@ -498,7 +498,7 @@ static inline void*& instructionPointerImpl(mcontext_t& machineContext)
#error Unknown Architecture
#endif
@ -33,7 +33,7 @@ Updated for latest webkit2gtk.
// The following sequence depends on glibc's sys/ucontext.h.
#if CPU(X86)
@@ -639,7 +639,7 @@ inline void*& argumentPointer<1>(mcontext_t& machineContext)
@@ -656,7 +656,7 @@ inline void*& argumentPointer<1>(mcontext_t& machineContext)
#error Unknown Architecture
#endif
@ -42,7 +42,7 @@ Updated for latest webkit2gtk.
// The following sequence depends on glibc's sys/ucontext.h.
#if CPU(X86)
@@ -756,7 +756,7 @@ inline void*& llintInstructionPointer(mcontext_t& machineContext)
@@ -773,7 +773,7 @@ inline void*& llintInstructionPointer(mcontext_t& machineContext)
#error Unknown Architecture
#endif
@ -51,14 +51,14 @@ Updated for latest webkit2gtk.
// The following sequence depends on glibc's sys/ucontext.h.
#if CPU(X86)
--- Source/JavaScriptCore/runtime/Options.h
+++ Source/JavaScriptCore/runtime/Options.h
@@ -112,6 +112,16 @@ constexpr bool enableWebAssemblyStreamingApi = true;
--- Source/JavaScriptCore/runtime/OptionsList.h
+++ Source/JavaScriptCore/runtime/OptionsList.h
@@ -43,6 +43,16 @@ constexpr bool enableWebAssemblyStreamingApi = true;
constexpr bool enableWebAssemblyStreamingApi = false;
#endif
+#if defined(__GLIBC__)
+constexpr unsigned jscMaxPerThreadStack = 4 * MB;
+constexpr unsigned jscMaxPerThreadStack = 5 * MB;
+constexpr unsigned jscSoftReservedZoneSize = 128 * KB;
+constexpr unsigned jscReservedZoneSize = 64 * KB;
+#else
@ -67,56 +67,25 @@ Updated for latest webkit2gtk.
+constexpr unsigned jscReservedZoneSize = 16 * KB;
+#endif
+
#define JSC_OPTIONS(v) \
v(bool, validateOptions, false, Normal, "crashes if mis-typed JSC options were passed to the VM") \
v(unsigned, dumpOptions, 0, Normal, "dumps JSC options (0 = None, 1 = Overridden only, 2 = All, 3 = Verbose)") \
@@ -126,9 +136,9 @@ constexpr bool enableWebAssemblyStreamingApi = false;
// How do JSC VM options work?
// ===========================
// The FOR_EACH_JSC_OPTION() macro below defines a list of all JSC options in use,
@@ -90,9 +100,9 @@ constexpr bool enableWebAssemblyStreamingApi = false;
\
v(bool, reportMustSucceedExecutableAllocations, false, Normal, nullptr) \
v(Bool, reportMustSucceedExecutableAllocations, false, Normal, nullptr) \
\
- v(unsigned, maxPerThreadStackUsage, 4 * MB, Normal, "Max allowed stack usage by the VM") \
- v(unsigned, softReservedZoneSize, 128 * KB, Normal, "A buffer greater than reservedZoneSize that reserves space for stringifying exceptions.") \
- v(unsigned, reservedZoneSize, 64 * KB, Normal, "The amount of stack space we guarantee to our clients (and to interal VM code that does not call out to clients).") \
+ v(unsigned, maxPerThreadStackUsage, jscMaxPerThreadStack, Normal, "Max allowed stack usage by the VM") \
+ v(unsigned, softReservedZoneSize, jscSoftReservedZoneSize, Normal, "A buffer greater than reservedZoneSize that reserves space for stringifying exceptions.") \
+ v(unsigned, reservedZoneSize, jscReservedZoneSize, Normal, "The amount of stack space we guarantee to our clients (and to interal VM code that does not call out to clients).") \
- v(Unsigned, maxPerThreadStackUsage, 5 * MB, Normal, "Max allowed stack usage by the VM") \
- v(Unsigned, softReservedZoneSize, 128 * KB, Normal, "A buffer greater than reservedZoneSize that reserves space for stringifying exceptions.") \
- v(Unsigned, reservedZoneSize, 64 * KB, Normal, "The amount of stack space we guarantee to our clients (and to interal VM code that does not call out to clients).") \
+ v(Unsigned, maxPerThreadStackUsage, jscMaxPerThreadStack, Normal, "Max allowed stack usage by the VM") \
+ v(Unsigned, softReservedZoneSize, jscSoftReservedZoneSize, Normal, "A buffer greater than reservedZoneSize that reserves space for stringifying exceptions.") \
+ v(Unsigned, reservedZoneSize, jscReservedZoneSize, Normal, "The amount of stack space we guarantee to our clients (and to interal VM code that does not call out to clients).") \
\
v(bool, crashIfCantAllocateJITMemory, false, Normal, nullptr) \
v(unsigned, jitMemoryReservationSize, 0, Normal, "Set this number to change the executable allocation size in ExecutableAllocatorFixedVMPool. (In bytes.)") \
--- Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
+++ Source/ThirdParty/ANGLE/src/compiler/preprocessor/ExpressionParser.cpp
@@ -728,7 +728,7 @@ int yydebug;
#if YYERROR_VERBOSE
# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
+# if defined __linux__ && defined _STRING_H
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
@@ -743,7 +743,7 @@ static YYSIZE_T yystrlen(const char *yystr)
# endif
# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# if defined __linux__ && defined _STRING_H && defined _GNU_SOURCE
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
--- Source/WTF/wtf/Platform.h
+++ Source/WTF/wtf/Platform.h
@@ -707,7 +707,7 @@
#endif /* OS(DARWIN) */
-#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || defined(__GLIBC__) || defined(__BIONIC__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))
+#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || defined(__linux__)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS)))
#define HAVE_MACHINE_CONTEXT 1
#endif
v(Bool, crashIfCantAllocateJITMemory, false, Normal, nullptr) \
v(Unsigned, jitMemoryReservationSize, 0, Normal, "Set this number to change the executable allocation size in ExecutableAllocatorFixedVMPool. (In bytes.)") \
--- Source/WebCore/xml/XPathGrammar.cpp
+++ Source/WebCore/xml/XPathGrammar.cpp
@@ -966,7 +966,7 @@
@@ -966,7 +966,7 @@ int yydebug;
#if YYERROR_VERBOSE
# ifndef yystrlen
@ -125,7 +94,7 @@ Updated for latest webkit2gtk.
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
@@ -989,7 +989,7 @@
@@ -989,7 +989,7 @@ yystrlen (yystr)
# endif
# ifndef yystpcpy

View file

@ -1,41 +1,58 @@
This fixes JavaScriptCore on big endian systems (mainly ppc).
This fixes JavaScriptCore on 32-bit big endian systems (mainly ppc).
Without the patch, attempting to run any JS results in
a crash as the generated code was endian specific.
Without the patch, attempting to run any JS results in a crash.
Upstream status: https://bugs.webkit.org/show_bug.cgi?id=211592
--- Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
+++ Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
@@ -1435,13 +1435,13 @@ llintOpWithMetadata(op_put_by_id, OpPutById, macro (size, get, dispatch, metadat
@@ -1480,13 +1480,21 @@ llintOpWithMetadata(op_put_by_id, OpPutById, macro (size, get, dispatch, metadat
loadp StructureChain::m_vector[t3], t3
assert(macro (ok) btpnz t3, ok end)
- loadp Structure::m_prototype[t2], t2
+ loadp Structure::m_prototype + PayloadOffset[t2], t2
+ if JSVALUE64
+ loadp Structure::m_prototype[t2], t2
+ else
+ loadp Structure::m_prototype + PayloadOffset[t2], t2
+ end
btpz t2, .opPutByIdTransitionChainDone
.opPutByIdTransitionChainLoop:
loadp [t3], t1
bineq t1, JSCell::m_structureID[t2], .opPutByIdSlow
addp 4, t3
- loadp Structure::m_prototype[t1], t2
+ loadp Structure::m_prototype + PayloadOffset[t1], t2
+ if JSVALUE64
+ loadp Structure::m_prototype[t1], t2
+ else
+ loadp Structure::m_prototype + PayloadOffset[t1], t2
+ end
btpnz t2, .opPutByIdTransitionChainLoop
.opPutByIdTransitionChainDone:
@@ -1952,7 +1952,7 @@ end)
@@ -2068,7 +2076,11 @@ end)
op(llint_throw_from_slow_path_trampoline, macro()
- loadp Callee[cfr], t1
+ loadp Callee + PayloadOffset[cfr], t1
andp MarkedBlockMask, t1
loadp MarkedBlockFooterOffset + MarkedBlock::Footer::m_vm[t1], t1
+ if JSVALUE64
+ loadp Callee[cfr], t1
+ else
+ loadp Callee + PayloadOffset[cfr], t1
+ end
convertCalleeToVM(t1)
copyCalleeSavesToVMEntryFrameCalleeSavesBuffer(t1, t2)
@@ -1962,7 +1962,7 @@ op(llint_throw_from_slow_path_trampoline, macro()
@@ -2077,7 +2089,11 @@ op(llint_throw_from_slow_path_trampoline, macro()
# When throwing from the interpreter (i.e. throwing from LLIntSlowPaths), so
# the throw target is not necessarily interpreted code, we come to here.
# This essentially emulates the JIT's throwing protocol.
- loadp Callee[cfr], t1
+ loadp Callee + PayloadOffset[cfr], t1
andp MarkedBlockMask, t1
loadp MarkedBlockFooterOffset + MarkedBlock::Footer::m_vm[t1], t1
+ if JSVALUE64
+ loadp Callee[cfr], t1
+ else
+ loadp Callee + PayloadOffset[cfr], t1
+ end
convertCalleeToVM(t1)
jmp VM::targetMachinePCForThrow[t1]
end)

View file

@ -1,6 +1,6 @@
# Template file for 'webkit2gtk'
pkgname=webkit2gtk
version=2.26.4
version=2.28.2
revision=1
wrksrc="webkitgtk-${version}"
build_style=cmake
@ -13,9 +13,9 @@ configure_args="-DPORT=GTK -DUSE_LD_GOLD=OFF
-DCMAKE_C_FLAGS_DEBUG=-DNDEBUG
-DCMAKE_C_FLAGS_RELWITHDEBINFO=-DNDEBUG
-DCMAKE_LINKER=${XBPS_CROSS_TRIPLET}-gcc
-DRUBY_VERSION=2.6
-DRUBY_CONFIG_INCLUDE_DIR=${XBPS_CROSS_BASE}/usr/include/ruby-2.6.0
-DRUBY_VERSION=2.7
-DENABLE_GTKDOC=OFF -DUSE_GSTREAMER_GL=OFF -DUSE_WPE_RENDERER=OFF
-DENABLE_MINIBROWSER=$(vopt_if minibrowser ON OFF)
-DENABLE_JIT=$(vopt_if jit ON OFF)
-DENABLE_C_LOOP=$(vopt_if jit OFF ON)
-DENABLE_INTROSPECTION=$(vopt_if gir ON OFF)
@ -38,14 +38,15 @@ maintainer="Enno Boland <gottox@voidlinux.org>"
license="LGPL-2.1-or-later, BSD-2-Clause"
homepage="https://webkitgtk.org/"
distfiles="${homepage}/releases/webkitgtk-${version}.tar.xz"
checksum=4386900713dfadf9741177210b32623cab22562a79ffd0d446b66569934b113f
checksum=b9d23525cfd8d22c37b5d964a9fe9a8ce7583042a2f8d3922e71e6bbc68c30bd
build_options="gir wayland x11 bubblewrap jit sampling_profiler"
build_options_default="gir wayland x11 bubblewrap"
build_options="gir wayland x11 bubblewrap jit sampling_profiler minibrowser"
build_options_default="gir wayland x11 bubblewrap minibrowser"
desc_option_bubblewrap="Enable bubblewrap sandbox"
desc_option_jit="JavaScript JIT (Only some architectures)"
desc_option_sampling_profiler="Sampling profiler support (JIT + glibc only)"
desc_option_minibrowser="Build the minibrowser"
# detection + runtime
if [ "$build_option_bubblewrap" ]; then
@ -54,6 +55,11 @@ if [ "$build_option_bubblewrap" ]; then
depends+=" bubblewrap xdg-dbus-proxy"
fi
# https://bugs.webkit.org/show_bug.cgi?id=197192
case "$XBPS_TARGET_MACHINE" in
aarch64*) configure_args+=" -DWTF_CPU_ARM64_CORTEXA53=OFF";;
esac
# only a few platform support JIT
case "$XBPS_TARGET_MACHINE" in
aarch64*|x86_64*)
@ -84,10 +90,11 @@ if [ "$build_option_sampling_profiler" -a -z "$build_option_jit" ]; then
fi
pre_configure() {
# work around large debug symbols on 32-bit hosts
# the debug builds are huge and cause problems when debugging
export CFLAGS="${CFLAGS/-g/-g1}"
export CXXFLAGS="${CXXFLAGS/-g/-g1}"
if [ "$XBPS_WORDSIZE" = "32" ]; then
export CFLAGS="${CFLAGS/-g/-g1}"
export CXXFLAGS="${CXXFLAGS/-g/-g1}"
export LDFLAGS+=" -Wl,--no-keep-memory"
fi