Update SpiderMonkey to ESR 140.1

This commit is contained in:
Itms 2025-09-03 12:03:19 +02:00
parent 865ca4cd55
commit 3d5c59f2c9
No known key found for this signature in database
GPG key ID: C7E52BD14CE14E09
10 changed files with 7707 additions and 122 deletions

View file

@ -51,12 +51,12 @@ RUN apt-get -qqy update \
zlib1g-dev \ zlib1g-dev \
&& apt-get clean && apt-get clean
# Install rust and Cargo via rustup, available in Debian12 1.63, need 1.76 # Install rust and Cargo via rustup, available in Debian12 1.63, need 1.82
ENV RUSTUP_HOME=/usr/local/rust ENV RUSTUP_HOME=/usr/local/rust
ENV CARGO_HOME=/usr/local/rust ENV CARGO_HOME=/usr/local/rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.76.0 -y RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain 1.82.0 -y
# Install cbindgen for building SpiderMonkey # Install cbindgen for building SpiderMonkey
RUN /usr/local/rust/bin/cargo install --locked cbindgen@0.29.0 RUN /usr/local/rust/bin/cargo install --locked cbindgen@0.29.4
ENV PATH="${RUSTUP_HOME}/bin:${PATH}" ENV PATH="${RUSTUP_HOME}/bin:${PATH}"
ENV SHELL=/bin/bash ENV SHELL=/bin/bash

View file

@ -660,7 +660,7 @@ extern_lib_defs = {
if _OPTIONS["with-system-mozjs"] then if _OPTIONS["with-system-mozjs"] then
if not _OPTIONS["android"] then if not _OPTIONS["android"] then
pkgconfig.add_includes_after("mozjs-128") pkgconfig.add_includes_after("mozjs-140")
end end
else else
filter "Debug" filter "Debug"
@ -674,17 +674,17 @@ extern_lib_defs = {
link_settings = function() link_settings = function()
if _OPTIONS["with-system-mozjs"] then if _OPTIONS["with-system-mozjs"] then
if _OPTIONS["android"] then if _OPTIONS["android"] then
links { "mozjs-128" } links { "mozjs-140" }
else else
pkgconfig.add_links("mozjs-128") pkgconfig.add_links("mozjs-140")
end end
else else
filter { "Debug" } filter { "Debug" }
links { "mozjs128-debug" } links { "mozjs-140-debug" }
filter { "Release" } filter { "Release" }
links { "mozjs128-release" } links { "mozjs-140-release" }
filter { } filter { }
links { "mozjs128-rust" } links { "mozjs-140-rust" }
add_source_lib_paths("spidermonkey") add_source_lib_paths("spidermonkey")
end end
end, end,

View file

@ -51,7 +51,7 @@ newoption { category = "Pyrogenesis", trigger = "strip-binaries", description =
newoption { category = "Pyrogenesis", trigger = "with-system-cpp-httplib", description = "Search standard paths for cpp-httplib, instead of using bundled copy" } newoption { category = "Pyrogenesis", trigger = "with-system-cpp-httplib", description = "Search standard paths for cpp-httplib, instead of using bundled copy" }
newoption { category = "Pyrogenesis", trigger = "with-system-cxxtest", description = "Search standard paths for cxxtest, instead of using bundled copy" } newoption { category = "Pyrogenesis", trigger = "with-system-cxxtest", description = "Search standard paths for cxxtest, instead of using bundled copy" }
newoption { category = "Pyrogenesis", trigger = "with-lto", description = "Enable Link Time Optimization (LTO)" } newoption { category = "Pyrogenesis", trigger = "with-lto", description = "Enable Link Time Optimization (LTO)" }
newoption { category = "Pyrogenesis", trigger = "with-system-mozjs", description = "Search standard paths for libmozjs128, instead of using bundled copy" } newoption { category = "Pyrogenesis", trigger = "with-system-mozjs", description = "Search standard paths for libmozjs140, instead of using bundled copy" }
newoption { category = "Pyrogenesis", trigger = "with-system-nvtt", description = "Search standard paths for nvidia-texture-tools library, instead of using bundled copy" } newoption { category = "Pyrogenesis", trigger = "with-system-nvtt", description = "Search standard paths for nvidia-texture-tools library, instead of using bundled copy" }
newoption { category = "Pyrogenesis", trigger = "with-valgrind", description = "Enable Valgrind support (non-Windows only)" } newoption { category = "Pyrogenesis", trigger = "with-valgrind", description = "Enable Valgrind support (non-Windows only)" }
newoption { category = "Pyrogenesis", trigger = "without-audio", description = "Disable use of OpenAL/Ogg/Vorbis APIs" } newoption { category = "Pyrogenesis", trigger = "without-audio", description = "Disable use of OpenAL/Ogg/Vorbis APIs" }
@ -170,7 +170,7 @@ end
-- The pc file doesn't specify the required -DDEBUG needed in that case -- The pc file doesn't specify the required -DDEBUG needed in that case
local mozjs_is_debug_build = false local mozjs_is_debug_build = false
if _OPTIONS["with-system-mozjs"] then if _OPTIONS["with-system-mozjs"] then
local _, errorCode = os.outputof(cc .. " $(pkg-config mozjs-128 --cflags) ./tests/mozdebug.c -o /dev/null") local _, errorCode = os.outputof(cc .. " $(pkg-config mozjs-140 --cflags) ./tests/mozdebug.c -o /dev/null")
if errorCode ~= 0 then if errorCode ~= 0 then
mozjs_is_debug_build = true mozjs_is_debug_build = true
end end

View file

@ -6,11 +6,11 @@ set -e
cd "$(dirname "$0")" cd "$(dirname "$0")"
# This should match the version in config/milestone.txt # This should match the version in config/milestone.txt
PV=128.13.0 PV=140.13.0
FOLDER="mozjs-${PV}" FOLDER="mozjs-${PV}"
# If same-version changes are needed, increment this. # If same-version changes are needed, increment this.
LIB_VERSION="${PV}+wfg5" LIB_VERSION="${PV}+wfg0"
LIB_NAME="mozjs128" LIB_NAME="mozjs-140"
build_archive() build_archive()
{ {
@ -196,6 +196,20 @@ else
fi fi
fi fi
# Bug #1987410
# SpiderMonkey vendors a patched fmtlib, and it copies it to include dirs, so we have to rename it
# to not have it conflicting with the regular fmtlib
(
cd "${FOLDER}"/build-debug/dist/include
mv fmt/ mozfmt/
patch -p1 <../../../../patches/StashVendoredLibfmt-FixIncludes.patch
)
(
cd "${FOLDER}"/build-release/dist/include
mv fmt/ mozfmt/
patch -p1 <../../../../patches/StashVendoredLibfmt-FixIncludes.patch
)
if [ "${OS}" = "Windows_NT" ]; then if [ "${OS}" = "Windows_NT" ]; then
# Bug #776126 # Bug #776126
# SpiderMonkey uses a tweaked zlib when building, and it wrongly copies its own files to include dirs # SpiderMonkey uses a tweaked zlib when building, and it wrongly copies its own files to include dirs

View file

@ -1,38 +0,0 @@
# HG changeset patch
# User Itms <itms@wildfiregames.com>
# Date 1754863729 0
# Node ID 45a4336df6a83fbb6a448fe5ec14b703b38313d9
# Parent 1ecdcb55f42515c6542d4f9d4580899d55a6a790
Bug 1982134 - Choose specific callback in removeBlackRootsTracer. a=RyanVM
This fixes a regression introduced in the refactoring at Bug 1846835 / D185307
Original Revision: https://phabricator.services.mozilla.com/D260541
Differential Revision: https://phabricator.services.mozilla.com/D260608
diff --git a/js/src/gc/GC.cpp b/js/src/gc/GC.cpp
--- a/js/src/gc/GC.cpp
+++ b/js/src/gc/GC.cpp
@@ -1559,17 +1559,17 @@ static bool EraseCallback(CallbackVector
bool GCRuntime::addBlackRootsTracer(JSTraceDataOp traceOp, void* data) {
AssertHeapIsIdle();
return blackRootTracers.ref().append(Callback<JSTraceDataOp>(traceOp, data));
}
void GCRuntime::removeBlackRootsTracer(JSTraceDataOp traceOp, void* data) {
// Can be called from finalizers
- MOZ_ALWAYS_TRUE(EraseCallback(blackRootTracers.ref(), traceOp));
+ MOZ_ALWAYS_TRUE(EraseCallback(blackRootTracers.ref(), traceOp, data));
}
void GCRuntime::setGrayRootsTracer(JSGrayRootsTracer traceOp, void* data) {
AssertHeapIsIdle();
grayRootTracer.ref() = {traceOp, data};
}
void GCRuntime::clearBlackAndGrayRootTracers() {

View file

@ -1,16 +1,18 @@
--- a/js/src/old-configure --- a/js/moz.configure
+++ b/js/src/old-configure +++ b/js/moz.configure
@@ -2595,10 +2595,10 @@ @@ -1425,10 +1425,13 @@
fi
# JavaScript shell
# ==============================================================
-if test -n "$JS_STANDALONE"; then -@depends(milestone.symbolversion, js_standalone)
-JS_LIBRARY_NAME="mozjs-$MOZILLA_SYMBOLVERSION" -def js_library_name(symbolversion, js_standalone):
+if test -n "$MOZ_DEBUG"; then +@depends(milestone.symbolversion, js_standalone, moz_debug)
+JS_LIBRARY_NAME="mozjs$MOZILLA_SYMBOLVERSION-debug" +def js_library_name(symbolversion, js_standalone, moz_debug):
else if js_standalone:
-JS_LIBRARY_NAME="mozjs" - return f"mozjs-{symbolversion}"
+JS_LIBRARY_NAME="mozjs$MOZILLA_SYMBOLVERSION-release" + if moz_debug:
fi + return f"mozjs-{symbolversion}-debug"
JS_CONFIG_LIBS="$NSPR_LIBS $LIBS" + else:
if test "$CC_TYPE" != clang-cl ; then + return f"mozjs-{symbolversion}-release"
else:
return "mozjs"

View file

@ -0,0 +1,26 @@
diff --git a/js/experimental/LoggingInterface.h b/js/experimental/LoggingInterface.h
index 6774755..f1039c1 100644
--- a/js/experimental/LoggingInterface.h
+++ b/js/experimental/LoggingInterface.h
@@ -13,7 +13,7 @@
#include "mozilla/LoggingCore.h"
#include "jstypes.h"
-#include "fmt/format.h"
+#include "mozfmt/format.h"
#include "js/GCAPI.h"
struct JSContext;
diff --git a/mozilla/Casting.h b/mozilla/Casting.h
index e6b1206..d07d2a8 100644
--- a/mozilla/Casting.h
+++ b/mozilla/Casting.h
@@ -12,7 +12,7 @@
#include "mozilla/Assertions.h"
#include "mozilla/Sprintf.h"
-#include "fmt/format.h"
+#include "mozfmt/format.h"
#include <cinttypes>
#include <cstring>

File diff suppressed because it is too large Load diff

View file

@ -1,46 +0,0 @@
# HG changeset patch
# User Steve Fink <sfink@mozilla.com>
# Date 1746227785 0
# Node ID 5c04f022856284273c3f1a0367a599431798bab3
# Parent 0a9b2997cbcf9652ce9440ba74cbbb3bf513a937
Bug 1953622 - Suppress -Wdangling-pointer warning when storing a Rooted address r=spidermonkey-reviewers,jonco
Differential Revision: https://phabricator.services.mozilla.com/D241310
diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h
--- a/js/public/RootingAPI.h
+++ b/js/public/RootingAPI.h
@@ -1140,21 +1140,30 @@ using RootedTraits =
* function that requires a handle, e.g. Foo(Root<T>(cx, x)).
*
* If you want to add additional methods to Rooted for a specific
* specialization, define a RootedOperations<T> specialization containing them.
*/
template <typename T>
class MOZ_RAII Rooted : public detail::RootedTraits<T>::StackBase,
public js::RootedOperations<T, Rooted<T>> {
+
+ // Intentionally store a pointer into the stack.
+#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 12)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdangling-pointer"
+#endif
inline void registerWithRootLists(RootedListHeads& roots) {
this->stack = &roots[JS::MapTypeToRootKind<T>::kind];
this->prev = *this->stack;
*this->stack = this;
}
+#if defined(__clang__) || (defined(__GNUC__) && __GNUC__ >= 12)
+#pragma GCC diagnostic pop
+#endif
inline RootedListHeads& rootLists(RootingContext* cx) {
return cx->stackRoots_;
}
inline RootedListHeads& rootLists(JSContext* cx) {
return rootLists(RootingContext::get(cx));
}

View file

@ -18,10 +18,6 @@ patch -p1 <"${PATCHES}"/FixLibNames.diff
# https://bugzilla.mozilla.org/show_bug.cgi?id=1935346 # https://bugzilla.mozilla.org/show_bug.cgi?id=1935346
patch -p1 <"${PATCHES}"/FixPkgConfigDebug.diff patch -p1 <"${PATCHES}"/FixPkgConfigDebug.diff
# Fix a regression in GC tracing, which creates segfaults during GCs
# https://bugzilla.mozilla.org/show_bug.cgi?id=1982134
patch -p1 <"${PATCHES}"/FixExtraGCTracing.diff
# There is an issue on 32-bit linux builds sometimes. # There is an issue on 32-bit linux builds sometimes.
# NB: the patch here is Comment 21 modified by Comment 25 # NB: the patch here is Comment 21 modified by Comment 25
# but that seems to imperfectly fix the issue with GCC. # but that seems to imperfectly fix the issue with GCC.
@ -41,12 +37,17 @@ if [ "${OS}" = "Darwin" ]; then
patch -p1 <"${PATCHES}"/FixMacOSBuild.diff patch -p1 <"${PATCHES}"/FixMacOSBuild.diff
fi fi
# Supress warning on newer GCC compilers.
# https://bugzilla.mozilla.org/show_bug.cgi?id=1953622
patch -p1 <"${PATCHES}"/SuppressDanglingPointerWarning.patch
# Fix building with python 3.14 # Fix building with python 3.14
patch -p1 <"${PATCHES}"/FixPython3_14.diff patch -p1 <"${PATCHES}"/FixPython3_14.diff
# Fix conflicts between vendored fmtlib in SM and our own use of fmtlib.
# This is not upstreamable and can be dropped when we use std::format (can be done in R30 when
# we move to ESR153 which requires C++20 anyway).
# Note: after building SM, it is still needed to rename the fmt include directory so that our
# compiler doesn't mix up the vendored fmtlib headers and the actual ones. The -FixIncludes patch
# is applied to dist/include after building.
# https://bugzilla.mozilla.org/show_bug.cgi?id=1987410
patch -p1 <"${PATCHES}"/StashVendoredLibfmt.patch
# Cherry-pick an upstream commit to allow passing custom flags to ar # Cherry-pick an upstream commit to allow passing custom flags to ar
patch -p1 <"${PATCHES}"/UpstreamCustomARFlags.patch patch -p1 <"${PATCHES}"/UpstreamCustomARFlags.patch