Changes for the build to work on Solaris

Potentially suitable to send upstream

diff --git a/Source/WTF/wtf/CurrentTime.cpp b/Source/WTF/wtf/CurrentTime.cpp
index d7fb93f..aa9c14d 100644
--- a/Source/WTF/wtf/CurrentTime.cpp
+++ b/Source/WTF/wtf/CurrentTime.cpp
@@ -273,7 +273,7 @@ MonotonicTime MonotonicTime::now()
     return fromMachAbsoluteTime(mach_absolute_time());
 #elif OS(FUCHSIA)
     return fromRawSeconds(zx_clock_get_monotonic() / static_cast<double>(ZX_SEC(1)));
-#elif OS(LINUX) || OS(FREEBSD) || OS(OPENBSD) || OS(NETBSD)
+#elif OS(LINUX) || OS(FREEBSD) || OS(OPENBSD) || OS(SOLARIS) || OS(NETBSD)
     struct timespec ts { };
     clock_gettime(CLOCK_MONOTONIC, &ts);
     return fromRawSeconds(static_cast<double>(ts.tv_sec) + ts.tv_nsec / 1.0e9);
diff --git a/Source/WTF/wtf/NumberOfCores.cpp b/Source/WTF/wtf/NumberOfCores.cpp
index 7636865..59fd2f7 100644
--- a/Source/WTF/wtf/NumberOfCores.cpp
+++ b/Source/WTF/wtf/NumberOfCores.cpp
@@ -30,7 +30,7 @@
 
 #if OS(DARWIN)
 #include <sys/sysctl.h>
-#elif OS(LINUX) || OS(AIX) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD)
+#elif OS(LINUX) || OS(AIX) || OS(SOLARIS) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD)
 #include <unistd.h>
 #elif OS(WINDOWS)
 #include <windows.h>
@@ -65,7 +65,7 @@ int numberOfProcessorCores()
     int sysctlResult = sysctl(name, sizeof(name) / sizeof(int), &result, &length, 0, 0);
 
     s_numberOfCores = sysctlResult < 0 ? defaultIfUnavailable : result;
-#elif OS(LINUX) || OS(AIX) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD)
+#elif OS(LINUX) || OS(AIX) || OS(SOLARIS) || OS(OPENBSD) || OS(NETBSD) || OS(FREEBSD)
     long sysconfResult = sysconf(_SC_NPROCESSORS_ONLN);
 
     s_numberOfCores = sysconfResult < 0 ? defaultIfUnavailable : static_cast<int>(sysconfResult);
diff --git a/Source/WTF/wtf/PageBlock.h b/Source/WTF/wtf/PageBlock.h
index c655a50..be6f1a4 100644
--- a/Source/WTF/wtf/PageBlock.h
+++ b/Source/WTF/wtf/PageBlock.h
@@ -49,7 +49,7 @@ namespace WTF {
 // Use 64 KiB for any unknown CPUs to be conservative.
 #if OS(DARWIN) || PLATFORM(PLAYSTATION)
 constexpr size_t CeilingOnPageSize = 16 * KB;
-#elif USE(64KB_PAGE_BLOCK) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(UNKNOWN)
+#elif USE(64KB_PAGE_BLOCK) || CPU(PPC) || CPU(PPC64) || CPU(PPC64LE) || CPU(SPARC) || CPU(UNKNOWN)
 constexpr size_t CeilingOnPageSize = 64 * KB;
 #elif OS(WINDOWS) || CPU(MIPS) || CPU(MIPS64) || CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64)
 constexpr size_t CeilingOnPageSize = 4 * KB;
 
diff --git a/Source/WTF/wtf/PlatformHave.h b/Source/WTF/wtf/PlatformHave.h
index 41afbb4..9e5d453 100644
--- a/Source/WTF/wtf/PlatformHave.h
+++ b/Source/WTF/wtf/PlatformHave.h
@@ -229,16 +229,16 @@
 #define HAVE_HOSTED_CORE_ANIMATION 1
 #endif
 
-#if OS(DARWIN) || OS(FUCHSIA) || ((OS(FREEBSD) || OS(NETBSD) || OS(OPENBSD) || OS(LINUX)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS) || CPU(RISCV64)))
+#if OS(DARWIN) || OS(FUCHSIA) || OS(SOLARIS) || ((OS(FREEBSD) || OS(NETBSD) || OS(OPENBSD) || OS(LINUX)) && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(ARM64) || CPU(MIPS) || CPU(RISCV64)))
 #define HAVE_MACHINE_CONTEXT 1
 #endif
 
-#if OS(DARWIN) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__) && !CPU(MIPS))
+#if OS(DARWIN) || OS(SOLARIS) || (OS(LINUX) && defined(__GLIBC__) && !defined(__UCLIBC__) && !CPU(MIPS))
 #define HAVE_BACKTRACE 1
 #define HAVE_BACKTRACE_SYMBOLS 1
 #endif
 
-#if OS(DARWIN) || OS(LINUX)
+#if OS(DARWIN) || OS(LINUX) || OS(SOLARIS)
 #define HAVE_DLADDR 1
 #endif
 
@@ -376,7 +376,7 @@
 #define HAVE_URL_FORMATTING 1
 #endif
 
-#if !OS(WINDOWS)
+#if !OS(WINDOWS) && !OS(SOLARIS)
 #define HAVE_STACK_BOUNDS_FOR_NEW_THREAD 1
 #endif
 
diff --git a/Source/WTF/wtf/PlatformOS.h b/Source/WTF/wtf/PlatformOS.h
index be27911..a5216ba 100644
--- a/Source/WTF/wtf/PlatformOS.h
+++ b/Source/WTF/wtf/PlatformOS.h
@@ -114,6 +114,11 @@
 #define WTF_OS_OPENBSD 1
 #endif
 
+/* OS(SOLARIS) - Solaris */
+#if defined(sun) || defined(__sun)
+#define WTF_OS_SOLARIS 1
+#endif
+
 /* OS(WINDOWS) - Any version of Windows */
 #if defined(WIN32) || defined(_WIN32)
 #define WTF_OS_WINDOWS 1
@@ -129,6 +134,7 @@
     || OS(LINUX)            \
     || OS(NETBSD)           \
     || OS(OPENBSD)          \
+    || OS(SOLARIS)          \
     || defined(unix)        \
     || defined(__unix)      \
     || defined(__unix__)
diff --git a/Source/WTF/wtf/StackBounds.cpp b/Source/WTF/wtf/StackBounds.cpp
index e6f7095..8fb3955 100644
--- a/Source/WTF/wtf/StackBounds.cpp
+++ b/Source/WTF/wtf/StackBounds.cpp
@@ -29,6 +29,10 @@
 
 #include <windows.h>
 
+#elif OS(SOLARIS)
+
+#include <thread.h>
+
 #elif OS(UNIX)
 
 #include <pthread.h>
@@ -65,6 +69,17 @@ StackBounds StackBounds::currentThreadStackBoundsInternal()
     return newThreadStackBounds(pthread_self());
 }
 
+#elif OS(SOLARIS)
+
+StackBounds StackBounds::currentThreadStackBoundsInternal()
+{
+    stack_t s;
+    thr_stksegment(&s);
+    void* origin = s.ss_sp;
+    void* bound = static_cast<char*>(origin) - s.ss_size;
+    return StackBounds { origin, bound };
+}
+
 #elif OS(UNIX)
 
 #if OS(OPENBSD)
diff --git a/Source/WebCore/inspector/InspectorFrontendHost.cpp b/Source/WebCore/inspector/InspectorFrontendHost.cpp
index 6577423..b882b9e 100644
--- a/Source/WebCore/inspector/InspectorFrontendHost.cpp
+++ b/Source/WebCore/inspector/InspectorFrontendHost.cpp
@@ -386,6 +386,8 @@ String InspectorFrontendHost::platform() const
     return "freebsd"_s;
 #elif OS(OPENBSD)
     return "openbsd"_s;
+#elif OS(SOLARIS)
+    return "solaris"_s;
 #else
     return "unknown"_s;
 #endif
--- webkitgtk-2.42.5/Source/JavaScriptCore/runtime/MachineContext.h.~1~	2023-09-19 04:27:45.475782200 -0400
+++ webkitgtk-2.42.5/Source/JavaScriptCore/runtime/MachineContext.h	2024-02-18 01:24:47.690986457 -0500
@@ -33,6 +33,7 @@
 #include <wtf/PlatformRegisters.h>
 #include <wtf/PointerPreparations.h>
 #include <wtf/StdLibExtras.h>
+#include <sys/regset.h>
 
 namespace JSC {
 namespace MachineContext {
@@ -193,7 +194,7 @@
 #error Unknown Architecture
 #endif
 
-#elif OS(FUCHSIA) || OS(LINUX)
+#elif OS(FUCHSIA) || OS(LINUX) || OS(SOLARIS)
 
 #if CPU(X86)
     return reinterpret_cast<void*&>((uintptr_t&) machineContext.gregs[REG_ESP]);
@@ -338,7 +339,7 @@
 #error Unknown Architecture
 #endif
 
-#elif OS(FUCHSIA) || OS(LINUX)
+#elif OS(FUCHSIA) || OS(LINUX) || OS(SOLARIS)
 
 // The following sequence depends on glibc's sys/ucontext.h.
 #if CPU(X86)
@@ -496,7 +497,7 @@
 #error Unknown Architecture
 #endif
 
-#elif OS(FUCHSIA) || OS(LINUX)
+#elif OS(FUCHSIA) || OS(LINUX) || OS(SOLARIS)
 
 // The following sequence depends on glibc's sys/ucontext.h.
 #if CPU(X86)
@@ -652,7 +653,7 @@
 #error Unknown Architecture
 #endif
 
-#elif OS(FUCHSIA) || OS(LINUX)
+#elif OS(FUCHSIA) || OS(LINUX) || OS(SOLARIS)
 
 // The following sequence depends on glibc's sys/ucontext.h.
 #if CPU(X86)
@@ -787,7 +788,7 @@
 #error Unknown Architecture
 #endif
 
-#elif OS(FUCHSIA) || OS(LINUX)
+#elif OS(FUCHSIA) || OS(LINUX) || OS(SOLARIS)
 
 // The following sequence depends on glibc's sys/ucontext.h.
 #if CPU(X86)