Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
"start": "./scripts/start.sh"
},
"config": {
"webkitGTK": "2.26.4",
"chromiumICUCommit": "64e5d7d43a1ff205e3787ab6150bbc1a1837332b"
"bunWebKitRepo": "https://github.com/oven-sh/WebKit.git",
"bunWebKitCommit": "6d0f3aac0b817cc01a846b3754b21271adedac12",
"icuRelease": "release-74-2",
"icuArchive": "icu4c-74_2-src.tgz"
},
"devDependencies": {
"commander": "^12.1.0",
Expand Down
30 changes: 30 additions & 0 deletions patches/jsc_android_collator_static.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
diff --git a/webkit/Source/WTF/wtf/unicode/CollatorDefault.cpp b/webkit/Source/WTF/wtf/unicode/CollatorDefault.cpp
index 9a45990fa7..b709f02052 100644
--- a/webkit/Source/WTF/wtf/unicode/CollatorDefault.cpp
+++ b/webkit/Source/WTF/wtf/unicode/CollatorDefault.cpp
@@ -27,13 +27,15 @@
*/

#include "config.h"
+#include <wtf/text/StringView.h>
+#include <wtf/text/WTFString.h>
#include <wtf/unicode/Collator.h>

#if UCONFIG_NO_COLLATION

namespace WTF {

-int Collator::collate(StringView a, StringView b) const
+int Collator::collate(StringView a, StringView b)
{
unsigned commonLength = std::min(a.length(), b.length());
for (unsigned i = 0; i < commonLength; ++i) {
@@ -51,7 +53,7 @@ int Collator::collate(StringView a, StringView b) const
return 0;
}

-int Collator::collate(const char8_t* a, const char8_t* b) const
+int Collator::collate(const char8_t* a, const char8_t* b)
{
return collate(String::fromUTF8(byteCast<char>(a)), String::fromUTF8(byteCast<char>(b)));
}
15 changes: 15 additions & 0 deletions patches/jsc_android_define_bun_macros.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/webkit/Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp b/webkit/Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp
index 483d333b83..1612e84271 100644
--- a/webkit/Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp
+++ b/webkit/Source/WTF/wtf/posix/OSAllocatorPOSIX.cpp
@@ -63,6 +63,10 @@

#endif

+#ifndef BUN_MACOSX
+#define BUN_MACOSX 0
+#endif
+
#ifdef MADV_DONTFORK
#define BUN_MADV_DONTFORK MADV_DONTFORK
#else
36 changes: 36 additions & 0 deletions patches/jsc_android_jit_guards.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/webkit/Source/JavaScriptCore/jit/JITInlineCacheGenerator.h b/webkit/Source/JavaScriptCore/jit/JITInlineCacheGenerator.h
index 8b89733b83..9c1d93c23f 100644
--- a/webkit/Source/JavaScriptCore/jit/JITInlineCacheGenerator.h
+++ b/webkit/Source/JavaScriptCore/jit/JITInlineCacheGenerator.h
@@ -53,7 +53,11 @@ enum class AccessType : int8_t;
enum class CacheType : int8_t;
enum class JITType : uint8_t;

+#if ENABLE(DFG_JIT)
using CompileTimeStructureStubInfo = Variant<StructureStubInfo*, BaselineUnlinkedStructureStubInfo*, DFG::UnlinkedStructureStubInfo*>;
+#else
+using CompileTimeStructureStubInfo = Variant<StructureStubInfo*, BaselineUnlinkedStructureStubInfo*>;
+#endif

class JITInlineCacheGenerator {
protected:
diff --git a/webkit/Source/JavaScriptCore/jit/PCToCodeOriginMap.h b/webkit/Source/JavaScriptCore/jit/PCToCodeOriginMap.h
index 196e0516a9..572f6a4444 100644
--- a/webkit/Source/JavaScriptCore/jit/PCToCodeOriginMap.h
+++ b/webkit/Source/JavaScriptCore/jit/PCToCodeOriginMap.h
@@ -41,6 +41,7 @@ namespace B3 {
class PCToOriginMap;
}

+#if ENABLE(WEBASSEMBLY)
namespace Wasm {
class WasmOrigin {
MAKE_VALIDATED_REINTERPRET_CAST
@@ -59,6 +60,7 @@ public:
MAKE_VALIDATED_REINTERPRET_CAST_IMPL("WasmOrigin", WasmOrigin)

} // namespace Wasm
+#endif

class LinkBuffer;
class PCToCodeOriginMapBuilder;
22 changes: 22 additions & 0 deletions patches/jsc_android_jsc_wait.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
diff --git a/webkit/Source/JavaScriptCore/jsc.cpp b/webkit/Source/JavaScriptCore/jsc.cpp
index 2b3b231e54..6b861fd1fe 100644
--- a/webkit/Source/JavaScriptCore/jsc.cpp
+++ b/webkit/Source/JavaScriptCore/jsc.cpp
@@ -3649,7 +3649,7 @@ int main(int argc, char** argv)
WTF::fastDisableScavenger();
fprintf(stdout, "\njs shell waiting for input to exit\n");
fflush(stdout);
- getc(stdin);
+ (void)getc(stdin);
}

#if OS(UNIX)
@@ -3658,7 +3658,7 @@ int main(int argc, char** argv)
fprintf(stdout, "\njs shell waiting for `kill -USR2 [pid]` to exit\n");
fflush(stdout);

- waitToExit.wait();
+ (void)waitToExit.wait();

fprintf(stdout, "\njs shell exiting\n");
fflush(stdout);
29 changes: 29 additions & 0 deletions patches/jsc_android_log_version.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/webkit/Source/JavaScriptCore/API/JSBase.cpp b/webkit/Source/JavaScriptCore/API/JSBase.cpp
index f0b01ec79a..1c9869b40b 100644
--- a/webkit/Source/JavaScriptCore/API/JSBase.cpp
+++ b/webkit/Source/JavaScriptCore/API/JSBase.cpp
@@ -37,6 +37,12 @@
#include "OpaqueJSString.h"
#include "SourceCode.h"

+#if OS(ANDROID)
+#include <android/log.h>
+#ifndef JSC_VERSION
+#define JSC_VERSION "unknown"
+#endif
+#endif
#if ENABLE(REMOTE_INSPECTOR)
#include "JSGlobalObjectInspectorController.h"
#endif
@@ -220,3 +226,11 @@ JSObjectRef JSGetMemoryUsageStatistics(JSContextRef ctx)

return toRef(object);
}
+
+#if OS(ANDROID)
+__attribute__((constructor))
+static void logJSCVersion()
+{
+ __android_log_print(ANDROID_LOG_INFO, "JavaScriptCore.Version", "%s", JSC_VERSION);
+}
+#endif
78 changes: 78 additions & 0 deletions patches/jsc_android_silence_unused.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
diff --git a/webkit/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp b/webkit/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp
index 2e2203099e..9c8917096d 100644
--- a/webkit/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp
+++ b/webkit/Source/JavaScriptCore/runtime/JSModuleNamespaceObject.cpp
@@ -45,6 +45,7 @@ void JSModuleNamespaceObject::finishCreation(JSGlobalObject* globalObject, Abstr
{
VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
+ UNUSED_PARAM(shouldPreventExtensions);
Base::finishCreation(vm);
ASSERT(inherits(info()));

@@ -208,6 +209,9 @@ bool JSModuleNamespaceObject::put(JSCell* cell, JSGlobalObject* globalObject, Pr
{
VM& vm = globalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
+ UNUSED_PARAM(cell);
+ UNUSED_PARAM(propertyName);
+ UNUSED_PARAM(value);

#if USE(BUN_JSC_ADDITIONS)
auto* thisObject = jsCast<JSModuleNamespaceObject*>(cell);
diff --git a/webkit/Source/JavaScriptCore/runtime/JSModuleRecord.cpp b/webkit/Source/JavaScriptCore/runtime/JSModuleRecord.cpp
index 24cea00a3f..41ccae3c5e 100644
--- a/webkit/Source/JavaScriptCore/runtime/JSModuleRecord.cpp
+++ b/webkit/Source/JavaScriptCore/runtime/JSModuleRecord.cpp
@@ -63,18 +63,18 @@ JSModuleRecord::JSModuleRecord(VM& vm, Structure* structure, const Identifier& m
{
}

-#if USE(BUN_JSC_ADDITIONS)
size_t JSModuleRecord::estimatedSize(JSCell* cell, VM& vm)
{
- const auto& thisObject = jsCast<JSModuleRecord*>(cell);
size_t size = Base::estimatedSize(cell, vm);
+#if USE(BUN_JSC_ADDITIONS)
+ const auto& thisObject = jsCast<JSModuleRecord*>(cell);
const SourceCode& sourceCode = thisObject->sourceCode();
StringView view = sourceCode.provider() ? sourceCode.provider()->source() : StringView();
size += view.length() * (view.is8Bit() ? sizeof(Latin1Character) : sizeof(UChar));
size += sourceCode.memoryCost();
+#endif
return size;
}
-#endif
void JSModuleRecord::destroy(JSCell* cell)
{
JSModuleRecord* thisObject = static_cast<JSModuleRecord*>(cell);
diff --git a/webkit/Source/JavaScriptCore/runtime/JSPromise.cpp b/webkit/Source/JavaScriptCore/runtime/JSPromise.cpp
index 09b051775b..a0a4a6b10f 100644
--- a/webkit/Source/JavaScriptCore/runtime/JSPromise.cpp
+++ b/webkit/Source/JavaScriptCore/runtime/JSPromise.cpp
@@ -219,6 +219,7 @@ void JSPromise::fulfillWithNonPromise(JSGlobalObject* lexicalGlobalObject, JSVal
{
VM& vm = lexicalGlobalObject->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
+ UNUSED_PARAM(scope);
uint32_t flags = this->flags();
ASSERT_WITH_MESSAGE(!value.inherits<Exception>(), "Promise fulfilled with exception");
ASSERT_WITH_MESSAGE(!value.inherits<JSPromise>(), "Promise fulfilled with another promise");
diff --git a/webkit/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp b/webkit/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp
index be5602f0b7..2f26538268 100644
--- a/webkit/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp
+++ b/webkit/Source/JavaScriptCore/runtime/ModuleProgramExecutable.cpp
@@ -37,10 +37,11 @@ ModuleProgramExecutable::ModuleProgramExecutable(JSGlobalObject* globalObject, c
{
SourceProviderSourceType sourceType = source.provider()->sourceType();
ASSERT(sourceType == SourceProviderSourceType::Module
- #if USE(BUN_JSC_ADDITIONS)
+#if USE(BUN_JSC_ADDITIONS)
|| sourceType == SourceProviderSourceType::BunTranspiledModule
- #endif
+#endif
);
+ UNUSED_PARAM(sourceType);
VM& vm = globalObject->vm();
if (vm.typeProfiler() || vm.controlFlowProfiler())
vm.functionHasExecutedCache()->insertUnexecutedRange(sourceID(), typeProfilingStartOffset(), typeProfilingEndOffset());
48 changes: 48 additions & 0 deletions patches/jsc_android_timezone_validate.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
diff --git a/webkit/Source/JavaScriptCore/runtime/JSDateMath.cpp b/webkit/Source/JavaScriptCore/runtime/JSDateMath.cpp
index cbd32cefe0..16df1ec5a0 100644
--- a/webkit/Source/JavaScriptCore/runtime/JSDateMath.cpp
+++ b/webkit/Source/JavaScriptCore/runtime/JSDateMath.cpp
@@ -502,6 +502,12 @@ static std::tuple<String, Vector<char16_t, 32>> retrieveTimeZoneInformation()
getTimeZoneOverride(timeZoneID);
String canonical;
UErrorCode status = U_ZERO_ERROR;
+#if (defined(UCONFIG_NO_FORMATTING) && UCONFIG_NO_FORMATTING) || !defined(ucal_getCanonicalTimeZoneID)
+ if (!timeZoneID.isEmpty())
+ canonical = String(timeZoneID.span());
+ else
+ canonical = "UTC"_s;
+#else
if (timeZoneID.isEmpty()) {
status = callBufferProducingFunction(ucal_getHostTimeZone, timeZoneID);
ASSERT_UNUSED(status, U_SUCCESS(status));
@@ -514,6 +520,7 @@ static std::tuple<String, Vector<char16_t, 32>> retrieveTimeZoneInformation()
}
if (canonical.isNull() || isUTCEquivalent(canonical))
canonical = "UTC"_s;
+#endif

globalCache.get() = std::tuple { canonical.isolatedCopy(), WTFMove(timeZoneID), currentID };
}
diff --git a/webkit/Source/WTF/wtf/DateMath.cpp b/webkit/Source/WTF/wtf/DateMath.cpp
index d4551c78ef..37b2ef6fc2 100644
--- a/webkit/Source/WTF/wtf/DateMath.cpp
+++ b/webkit/Source/WTF/wtf/DateMath.cpp
@@ -1008,6 +1008,10 @@ String makeRFC2822DateString(unsigned dayOfWeek, unsigned day, unsigned month, u

static std::optional<Vector<char16_t, 32>> validateTimeZone(StringView timeZone)
{
+#if defined(UCONFIG_NO_FORMATTING) && UCONFIG_NO_FORMATTING
+ UNUSED_PARAM(timeZone);
+ return std::nullopt;
+#else
auto buffer = timeZone.upconvertedCharacters();
const char16_t* characters = buffer;
Vector<char16_t, 32> canonicalBuffer;
@@ -1015,6 +1019,7 @@ static std::optional<Vector<char16_t, 32>> validateTimeZone(StringView timeZone)
if (!U_SUCCESS(status))
return std::nullopt;
return canonicalBuffer;
+#endif
}

bool isTimeZoneValid(StringView timeZone)
16 changes: 16 additions & 0 deletions patches/jsc_android_uv_pri64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/webkit/Source/bmalloc/bmalloc/uv_get_constrained_memory.cpp b/webkit/Source/bmalloc/bmalloc/uv_get_constrained_memory.cpp
index e39afda511..48f46d76fc 100644
--- a/webkit/Source/bmalloc/bmalloc/uv_get_constrained_memory.cpp
+++ b/webkit/Source/bmalloc/bmalloc/uv_get_constrained_memory.cpp
@@ -21,11 +21,12 @@

#include "BPlatform.h"
#include <cstdint>
+#include <inttypes.h>

#if BOS(LINUX)

#ifndef PRIu64
-#define PRIu64 "lu"
+#define PRIu64 "llu"
#endif
45 changes: 45 additions & 0 deletions patches/jsc_android_wtf_sources.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
diff --git a/webkit/Source/WTF/wtf/PlatformJSCOnly.cmake b/webkit/Source/WTF/wtf/PlatformJSCOnly.cmake
index 0ab58fe2a2..4b94606617 100644
--- a/webkit/Source/WTF/wtf/PlatformJSCOnly.cmake
+++ b/webkit/Source/WTF/wtf/PlatformJSCOnly.cmake
@@ -36,8 +36,16 @@ else ()
text/unix/TextBreakIteratorInternalICUUnix.cpp

unix/LanguageUnix.cpp
- unix/LoggingUnix.cpp
)
+ if (CMAKE_SYSTEM_NAME MATCHES "Android")
+ list(APPEND WTF_SOURCES
+ android/LoggingAndroid.cpp
+ )
+ else ()
+ list(APPEND WTF_SOURCES
+ unix/LoggingUnix.cpp
+ )
+ endif ()
if (WTF_OS_FUCHSIA)
list(APPEND WTF_SOURCES
fuchsia/CPUTimeFuchsia.cpp
@@ -97,6 +105,22 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")

unix/MemoryPressureHandlerUnix.cpp
)
+ list(APPEND WTF_PUBLIC_HEADERS
+ linux/CurrentProcessMemoryStatus.h
+ linux/ProcessMemoryFootprint.h
+ )
+elseif (CMAKE_SYSTEM_NAME MATCHES "Android")
+ list(APPEND WTF_SOURCES
+ linux/CurrentProcessMemoryStatus.cpp
+ linux/MemoryFootprintLinux.cpp
+ linux/RealTimeThreads.cpp
+
+ unix/MemoryPressureHandlerUnix.cpp
+ )
+ list(APPEND WTF_PUBLIC_HEADERS
+ linux/CurrentProcessMemoryStatus.h
+ linux/ProcessMemoryFootprint.h
+ )
elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
list(APPEND WTF_SOURCES
generic/MemoryFootprintGeneric.cpp
16 changes: 16 additions & 0 deletions patches/jsc_async_frame_guard.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/webkit/Source/JavaScriptCore/runtime/StackFrame.h b/webkit/Source/JavaScriptCore/runtime/StackFrame.h
index b689e68d58..5578051a6b 100644
--- a/webkit/Source/JavaScriptCore/runtime/StackFrame.h
+++ b/webkit/Source/JavaScriptCore/runtime/StackFrame.h
@@ -100,7 +100,11 @@ public:

bool isAsyncFrameWithoutCodeBlock() const
{
+#if USE(BUN_JSC_ADDITIONS)
return isAsyncFrame() && !codeBlock();
+#else
+ return false;
+#endif
}

#if USE(BUN_JSC_ADDITIONS)
16 changes: 16 additions & 0 deletions patches/jsc_disable_api_tests.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/webkit/Source/cmake/OptionsJSCOnly.cmake b/webkit/Source/cmake/OptionsJSCOnly.cmake
index f00830dd41..f9e131cfa3 100644
--- a/webkit/Source/cmake/OptionsJSCOnly.cmake
+++ b/webkit/Source/cmake/OptionsJSCOnly.cmake
@@ -101,10 +101,8 @@ else ()
endif ()
WEBKIT_OPTION_END()

-if (WIN32)
+if (NOT DEFINED ENABLE_API_TESTS)
set(ENABLE_API_TESTS OFF)
-else ()
- set(ENABLE_API_TESTS ON)
endif ()

if (WTF_CPU_ARM OR WTF_CPU_MIPS)
Loading
Loading