diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml
index b2feca0b3..8b03cec80 100644
--- a/.github/workflows/build_and_test.yml
+++ b/.github/workflows/build_and_test.yml
@@ -1,11 +1,14 @@
name: Build jsc-android and test
-on: [push, pull_request]
+on:
+ push:
+ branches: [main]
+ pull_request:
jobs:
build:
runs-on: ubuntu-latest
- container: reactnativecommunity/react-native-android:2019-9-4
+ container: reactnativecommunity/react-native-android:5.4
steps:
- uses: actions/checkout@v1
@@ -13,22 +16,27 @@ jobs:
- name: Install packages
run: |
apt-get update
- apt-get install coreutils realpath curl git subversion python3.5 python3.5-dev ruby gperf -y
- update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
- wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
+ apt-get install coreutils curl git subversion wget python3 ruby gperf -y
+ wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
echo 'export NVM_DIR="$HOME/.nvm"' >> "${HOME}/.bashrc"
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> "${HOME}/.bashrc"
source "${HOME}/.bashrc"
- nvm install 10
- nvm use 10
- nvm alias default 10
+ nvm install 16
+ nvm use 16
+ nvm alias default 16
shell: bash
- name: Install Android packages
run: |
sdkmanager \
- "cmake;3.10.2.4988404"
+ "cmake;3.10.2.4988404" \
+ "cmake;3.18.1" \
+ "ndk;23.2.8568313"
+ # move out builtin icu headers from ndk and prevent icu build errors
+ mv "${ANDROID_HOME}/ndk/23.2.8568313/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode" "${ANDROID_HOME}/ndk/23.2.8568313/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/unicode2"
+ echo "ANDROID_NDK=$ANDROID_HOME/ndk/23.2.8568313" >> $GITHUB_ENV
shell: bash
+
- name: Build
run: |
yarn clean
@@ -64,7 +72,7 @@ jobs:
- name: Run test
uses: reactivecircus/android-emulator-runner@v2
with:
- api-level: 16
- arch: x86
+ api-level: 21
+ arch: x86_64
disable-animations: false
script: mv archive/dist . && cd test && yarn && cd android && ./gradlew assembleRelease assembleAndroidTest connectedAndroidTest
diff --git a/.gitignore b/.gitignore
index da88e9758..6841f050f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
package-lock.json
/build
/dist
+/dist.unstripped
# Created by https://www.gitignore.io/api/node,android,reactnative,intellij+all,androidstudio,visualstudiocode
diff --git a/lib/cppruntime/build.gradle b/lib/cppruntime/build.gradle
deleted file mode 100644
index 19f3454ac..000000000
--- a/lib/cppruntime/build.gradle
+++ /dev/null
@@ -1,45 +0,0 @@
-apply plugin: 'com.android.library'
-
-def distDir = project.findProperty("distDir") ?: ""
-def jniLibsDir = project.findProperty("jniLibsDir") ?: ""
-def revision = project.findProperty("revision") ?: "".replaceAll("\\s", "")
-
-if (!distDir) throw new RuntimeException("expecting --project-prop distDir=??? but was empty")
-if (!jniLibsDir) throw new RuntimeException("expecting --project-prop jniLibsDir=??? but was empty")
-if (!revision) throw new RuntimeException("expecting --project-prop revision=??? but was empty")
-
-android {
- compileSdkVersion 28
-
- defaultConfig {
- minSdkVersion 16
- targetSdkVersion 28
- versionCode 1
- versionName "1.0"
- }
-
- sourceSets {
- main {
- jniLibs.srcDirs = ["${jniLibsDir}"]
- }
- }
-}
-
-dependencies {}
-
-apply plugin: 'maven'
-
-task createAAR(type: Upload) {
- project.group = "org.webkit"
- project.version = "r${revision}"
-
- configuration = configurations.archives
- repositories.mavenDeployer {
- repository url: "file://${distDir}"
- pom.project {
- name "android-jsc"
- artifactId "android-jsc-cppruntime"
- packaging "aar"
- }
- }
-}
diff --git a/lib/cppruntime/src/main/AndroidManifest.xml b/lib/cppruntime/src/main/AndroidManifest.xml
deleted file mode 100644
index 8121629a7..000000000
--- a/lib/cppruntime/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
diff --git a/lib/settings.gradle b/lib/settings.gradle
index baa5c84a9..46d63710c 100644
--- a/lib/settings.gradle
+++ b/lib/settings.gradle
@@ -1,4 +1,3 @@
rootProject.name = 'JavaScriptCore Lib'
include ':android-jsc'
-include ':cppruntime'
diff --git a/package.json b/package.json
index 8aa3f24a2..90cd8bdb6 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "jsc-android",
- "version": "250230.2.1",
+ "version": "294992.0.0",
"description": "Pre-build version of JavaScriptCore to be used by React Native apps",
"repository": {
"type": "git",
@@ -26,8 +26,8 @@
"start": "./scripts/start.sh"
},
"config": {
- "webkitGTK": "2.26.1",
- "chromiumICUCommit": "64e5d7d43a1ff205e3787ab6150bbc1a1837332b"
+ "webkitGTK": "2.36.3",
+ "chromiumICUCommit": "85814e1af52482199a13d284545623ffbc9eef83"
},
"devDependencies": {
"commander": "^4.0.1",
diff --git a/patches/jsc.patch b/patches/jsc.patch
index 00475e129..2ab096548 100644
--- a/patches/jsc.patch
+++ b/patches/jsc.patch
@@ -8,3 +8,16 @@
# Force staging of shared scripts, even if they aren't directly used to build JavaScriptCore.
+--- target-org/webkit/Source/cmake/OptionsJSCOnly.cmake 2022-07-09 15:31:32.000000000 +0800
++++ target/webkit/Source/cmake/OptionsJSCOnly.cmake 2022-07-10 12:40:43.000000000 +0800
+@@ -58,8 +58,8 @@
+ # https://bugs.webkit.org/show_bug.cgi?id=172862
+ if (NOT ENABLE_STATIC_JSC AND NOT WIN32)
+ set(JavaScriptCore_LIBRARY_TYPE SHARED)
+- set(bmalloc_LIBRARY_TYPE OBJECT)
+- set(WTF_LIBRARY_TYPE OBJECT)
++ set(bmalloc_LIBRARY_TYPE STATIC)
++ set(WTF_LIBRARY_TYPE STATIC)
+ endif ()
+
+ if (WIN32)
diff --git a/patches/jsc_features.patch b/patches/jsc_features.patch
index 23adc4680..12b9fab65 100644
--- a/patches/jsc_features.patch
+++ b/patches/jsc_features.patch
@@ -1,54 +1,34 @@
-diff -aur target-org/webkit/CMakeLists.txt target/webkit/CMakeLists.txt
---- target-org/webkit/CMakeLists.txt 2017-12-22 19:18:43.000000000 +0200
-+++ target/webkit/CMakeLists.txt 2018-06-14 15:41:59.000000000 +0300
-@@ -177,13 +177,13 @@
+--- target-org/webkit/CMakeLists.txt 2021-03-06 03:12:45.000000000 +0800
++++ target/webkit/CMakeLists.txt 2022-07-09 18:13:01.000000000 +0800
+@@ -38,9 +38,9 @@
add_subdirectory(Tools)
endif ()
-
--if ("${PORT}" STREQUAL "GTK" OR "${PORT}" STREQUAL "WPE")
-- if (DEVELOPER_MODE)
-- add_subdirectory(PerformanceTests)
-- endif ()
--else ()
+
+-if (DEVELOPER_MODE)
- add_subdirectory(PerformanceTests)
-endif ()
-+#if ("${PORT}" STREQUAL "GTK" OR "${PORT}" STREQUAL "WPE")
-+# if (DEVELOPER_MODE)
-+# add_subdirectory(PerformanceTests)
-+# endif ()
-+#else ()
-+# add_subdirectory(PerformanceTests)
-+#endif ()
-
++# if (DEVELOPER_MODE)
++# add_subdirectory(PerformanceTests)
++# endif ()
+
# -----------------------------------------------------------------------------
# Print the features list last, for maximum visibility.
-diff -aur target-org/webkit/Source/cmake/OptionsJSCOnly.cmake target/webkit/Source/cmake/OptionsJSCOnly.cmake
---- target-org/webkit/Source/cmake/OptionsJSCOnly.cmake 2019-03-26 11:25:17.000000000 +0800
-+++ target/webkit/Source/cmake/OptionsJSCOnly.cmake 2019-03-26 11:28:29.000000000 +0800
-@@ -35,12 +35,7 @@
- set(ENABLE_WEBCORE OFF)
- set(ENABLE_WEBKIT_LEGACY OFF)
- set(ENABLE_WEBKIT OFF)
--
--if (WIN32)
-- set(ENABLE_API_TESTS OFF)
--else ()
+--- target-org/webkit/Source/cmake/OptionsJSCOnly.cmake 2022-07-09 15:31:32.000000000 +0800
++++ target/webkit/Source/cmake/OptionsJSCOnly.cmake 2022-07-09 15:29:24.000000000 +0800
+@@ -47,7 +47,7 @@
+ if (WIN32)
+ set(ENABLE_API_TESTS OFF)
+ else ()
- set(ENABLE_API_TESTS ON)
--endif ()
-+set(ENABLE_API_TESTS OFF)
-
++ set(ENABLE_API_TESTS OFF)
+ endif ()
+
if (WTF_CPU_ARM OR WTF_CPU_MIPS)
- SET_AND_EXPOSE_TO_BUILD(USE_CAPSTONE TRUE)
-diff -aur target-org/webkit/Source/JavaScriptCore/CMakeLists.txt target/webkit/Source/JavaScriptCore/CMakeLists.txt
---- target-org/webkit/Source/JavaScriptCore/CMakeLists.txt 2017-05-02 21:13:03.000000000 +0200
-+++ target/webkit/Source/JavaScriptCore/CMakeLists.txt 2017-07-11 11:34:55.962374878 +0200
-@@ -1291,7 +1291,7 @@
- )
- target_include_directories(LLIntOffsetsExtractor SYSTEM PRIVATE ${JavaScriptCore_SYSTEM_INCLUDE_DIRECTORIES})
-
+--- target-org/webkit/Source/JavaScriptCore/CMakeLists.txt 2022-07-09 15:31:21.000000000 +0800
++++ target/webkit/Source/JavaScriptCore/CMakeLists.txt 2022-07-09 15:31:50.000000000 +0800
+@@ -1564,4 +1565,4 @@
+ VERBATIM)
+ endif ()
+
-add_subdirectory(shell)
+# add_subdirectory(shell)
-
- WEBKIT_COMPUTE_SOURCES(JavaScriptCore)
- WEBKIT_WRAP_SOURCELIST(${JavaScriptCore_SOURCES})
-
diff --git a/patches/jsc_fix_build_error_getline.patch b/patches/jsc_fix_build_error_getline.patch
deleted file mode 100644
index 35a695de7..000000000
--- a/patches/jsc_fix_build_error_getline.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-diff -aur target-org/webkit/Source/WTF/wtf/linux/MemoryFootprintLinux.cpp target/webkit/Source/WTF/wtf/linux/MemoryFootprintLinux.cpp
---- target-org/webkit/Source/WTF/wtf/linux/MemoryFootprintLinux.cpp 2019-06-18 21:49:53.000000000 +0800
-+++ target/webkit/Source/WTF/wtf/linux/MemoryFootprintLinux.cpp 2019-06-18 22:44:39.000000000 +0800
-@@ -23,6 +23,10 @@
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-+// CUSTOMIZE_REACT_NATIVE: getline() does not implemented until Android NDK API 18.
-+// Since MemoryFootprint does not being used in JSC, comment out to prevent build break.
-+#if !defined(CUSTOMIZE_REACT_NATIVE)
-+
- #include "config.h"
- #include
-
-@@ -100,3 +104,5 @@
- }
-
- } // namespace WTF
-+
-+#endif // !defined(CUSTOMIZE_REACT_NATIVE)
diff --git a/patches/jsc_fix_build_error_log2.patch b/patches/jsc_fix_build_error_log2.patch
deleted file mode 100644
index 37644fd31..000000000
--- a/patches/jsc_fix_build_error_log2.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -aur target-org/webkit/Source/JavaScriptCore/Sources.txt target/webkit/Source/JavaScriptCore/Sources.txt
---- target-org/webkit/Source/JavaScriptCore/Sources.txt 2018-11-11 23:05:40.000000000 +0800
-+++ target/webkit/Source/JavaScriptCore/Sources.txt 2018-11-12 00:03:26.000000000 +0800
-@@ -1053,3 +1053,6 @@
-
- // Derived Sources
- yarr/YarrCanonicalizeUnicode.cpp
-+
-+// Polyfills
-+polyfills/log2.cpp
-diff -aur /dev/null target/webkit/Source/JavaScriptCore/polyfills/log2.cpp
---- /dev/null 2018-11-12 01:21:57.000000000 +0800
-+++ target/webkit/Source/JavaScriptCore/polyfills/log2.cpp 2018-11-12 01:19:49.000000000 +0800
-@@ -0,0 +1,7 @@
-+#include
-+
-+#if defined(__ANDROID__) && __ANDROID_API__ < 18
-+double log2(double x) {
-+ return log(x) / log(2.0);
-+}
-+#endif
diff --git a/patches/jsc_fix_build_error_memalign.patch b/patches/jsc_fix_build_error_memalign.patch
deleted file mode 100644
index 708975e0b..000000000
--- a/patches/jsc_fix_build_error_memalign.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-diff -aur target-org/webkit/Source/bmalloc/CMakeLists.txt target/webkit/Source/bmalloc/CMakeLists.txt
---- target-org/webkit/Source/bmalloc/CMakeLists.txt 2018-07-12 11:27:26.185794000 -0700
-+++ target/webkit/Source/bmalloc/CMakeLists.txt 2019-06-11 12:20:28.556676100 -0700
-@@ -32,6 +32,7 @@
- bmalloc/VMHeap.cpp
- bmalloc/bmalloc.cpp
- bmalloc/mbmalloc.cpp
-+ bmalloc/posix_memalign.cpp
- )
-
- if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
-
-
-diff -aur /dev/null target/webkit/Source/bmalloc/bmalloc/posix_memalign.cpp
---- /dev/null 2019-06-11 10:46:36.937580800 -0700
-+++ target/webkit/Source/bmalloc/bmalloc/posix_memalign.cpp 2019-06-11 14:47:32.119738900 -0700
-@@ -0,0 +1,23 @@
-+#if defined(__ANDROID__) && __ANDROID_API__ < 17
-+//
-+// Implementation borrowed from the Android Support Library
-+// https://android.googlesource.com/platform/ndk/+/c066f37aeadeb8a8b21468ad8c82f4469fb5a70d/sources/android/support/src/posix_memalign.cpp
-+//
-+#include
-+#include
-+#include
-+
-+int posix_memalign(void** memptr, size_t alignment, size_t size) {
-+ if ((alignment & (alignment - 1)) != 0 || alignment == 0) {
-+ return EINVAL;
-+ }
-+ if (alignment % sizeof(void*) != 0) {
-+ return EINVAL;
-+ }
-+ *memptr = memalign(alignment, size);
-+ if (*memptr == NULL) {
-+ return errno;
-+ }
-+ return 0;
-+}
-+#endif
diff --git a/patches/jsc_fix_build_error_mulodi4.patch b/patches/jsc_fix_build_error_mulodi4.patch
deleted file mode 100644
index 5a92e05b3..000000000
--- a/patches/jsc_fix_build_error_mulodi4.patch
+++ /dev/null
@@ -1,29 +0,0 @@
---- target-org/webkit/Source/WTF/wtf/CheckedArithmetic.h 2019-06-18 21:49:53.000000000 +0800
-+++ target/webkit/Source/WTF/wtf/CheckedArithmetic.h 2019-06-18 22:44:39.000000000 +0800
-@@ -360,7 +360,7 @@
-
- static inline bool multiply(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN
- {
--#if COMPILER(GCC_COMPATIBLE)
-+#if COMPILER(GCC_COMPATIBLE) && CPU(ARM_THUMB2) && defined(NDEBUG)
- ResultType temp;
- if (__builtin_mul_overflow(lhs, rhs, &temp))
- return false;
-@@ -433,7 +433,7 @@
-
- static inline bool multiply(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN
- {
--#if COMPILER(GCC_COMPATIBLE)
-+#if COMPILER(GCC_COMPATIBLE) && CPU(ARM_THUMB2) && defined(NDEBUG)
- ResultType temp;
- if (__builtin_mul_overflow(lhs, rhs, &temp))
- return false;
-@@ -496,7 +496,7 @@
-
- static inline bool multiply(int64_t lhs, int64_t rhs, ResultType& result)
- {
--#if COMPILER(GCC_COMPATIBLE)
-+#if COMPILER(GCC_COMPATIBLE) && CPU(ARM_THUMB2) && defined(NDEBUG)
- ResultType temp;
- if (__builtin_mul_overflow(lhs, rhs, &temp))
- return false;
diff --git a/patches/jsc_fix_build_error_statvfs.patch b/patches/jsc_fix_build_error_statvfs.patch
deleted file mode 100644
index 084a37bee..000000000
--- a/patches/jsc_fix_build_error_statvfs.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff -aur target-org/webkit/Source/WTF/wtf/posix/FileSystemPOSIX.cpp target/webkit/Source/WTF/wtf/posix/FileSystemPOSIX.cpp
---- target-org/webkit/Source/WTF/wtf/posix/FileSystemPOSIX.cpp 2019-06-18 21:49:52.000000000 +0800
-+++ target/webkit/Source/WTF/wtf/posix/FileSystemPOSIX.cpp 2019-06-18 22:58:46.000000000 +0800
-@@ -45,6 +45,11 @@
- #include
- #include
-
-+#if defined(CUSTOMIZE_REACT_NATIVE) && defined(__ANDROID__) && __ANDROID_API__ < 19
-+#include
-+#define statvfs statfs
-+#endif // defined(CUSTOMIZE_REACT_NATIVE) && defined(__ANDROID__) && __ANDROID_API__ < 19
-+
- namespace WTF {
-
- namespace FileSystemImpl {
diff --git a/patches/jsc_fix_concurrent_gc_issue.patch b/patches/jsc_fix_concurrent_gc_issue.patch
deleted file mode 100644
index 7424cc387..000000000
--- a/patches/jsc_fix_concurrent_gc_issue.patch
+++ /dev/null
@@ -1,125 +0,0 @@
---- target-org/webkit/Source/JavaScriptCore/ChangeLog 2019-09-23 18:14:45.000000000 +0800
-+++ target/webkit/Source/JavaScriptCore/ChangeLog 2019-12-18 08:36:29.000000000 +0800
-@@ -1,3 +1,40 @@
-+2019-10-18 Yusuke Suzuki
-+
-+ [JSC] Make ConcurrentJSLock Lock even if ENABLE_CONCURRENT_JS=OFF
-+ https://bugs.webkit.org/show_bug.cgi?id=202892
-+
-+ Reviewed by Mark Lam.
-+
-+ We are using ConcurrentJSLock to guard data structure against concurrent compilers.
-+ But these data structures should be guarded by GC concurrent collector, so we are using this ConcurrentJSLock
-+ to guard them against concurrent collector too.
-+ The problem is that ENABLE(CONCURRENT_JS) relies on ENABLE(DFG_JIT). If we configure JSC with the options like,
-+
-+ ENABLE_DFG_JIT 0
-+ ENABLE_FTL_JIT 0
-+
-+ Then, the built JSC becomes
-+
-+ ENABLE_CONCURRENT_JS 0
-+ But, Concurrent GC is enabled.
-+
-+ This is wrong due to several reasons.
-+
-+ 1. Baseline JIT can produce JIT related data structures that are traced by concurrent collector. In the above options,
-+ these data structures are not guarded by lock.
-+ 2. Baseline JIT also has concurrent JIT compiler. But ENABLE_CONCURRENT_JS does not reflect this.
-+
-+ In this patch, we fix two things.
-+
-+ 1. We should make ConcurrentJSLock always Lock. In 64bit environment we are supporting actively (including watchOS ARM64_32),
-+ we are enabling ENABLE(JIT) regardless of we are actually using JIT. So, anyway, this is already a Lock. Flipping these
-+ bits does not matter in 32bit architectures since they do not have concurrent compilers anyway. This makes things simpler:
-+ it is always a Lock. And concurrent collector can use it.
-+ 2. We should make `ENABLE(CONCURRENT_JS)` ON when `ENABLE(JIT)` is true, to reflect the fact that Baseline JIT has concurrent compiler.
-+
-+ * runtime/ConcurrentJSLock.h:
-+ (JSC::ConcurrentJSLocker::ConcurrentJSLocker):
-+
- 2019-09-18 Saam Barati
-
- Phantom insertion phase may disagree with arguments forwarding about live ranges
---- target-org/webkit/Source/JavaScriptCore/runtime/ConcurrentJSLock.h 2018-12-19 20:41:11.000000000 -0800
-+++ target/webkit/Source/JavaScriptCore/runtime/ConcurrentJSLock.h 2019-10-21 11:43:39.000000000 -0700
-@@ -32,13 +32,8 @@
-
- namespace JSC {
-
--#if ENABLE(CONCURRENT_JS)
--typedef Lock ConcurrentJSLock;
--typedef LockHolder ConcurrentJSLockerImpl;
--#else
--typedef NoLock ConcurrentJSLock;
--typedef NoLockLocker ConcurrentJSLockerImpl;
--#endif
-+using ConcurrentJSLock = Lock;
-+using ConcurrentJSLockerImpl = LockHolder;
-
- static_assert(sizeof(ConcurrentJSLock) == 1, "Regardless of status of concurrent JS flag, size of ConurrentJSLock is always one byte.");
-
-@@ -103,7 +98,7 @@
- public:
- ConcurrentJSLocker(ConcurrentJSLock& lockable)
- : ConcurrentJSLockerBase(lockable)
--#if ENABLE(CONCURRENT_JS) && !defined(NDEBUG)
-+#if !defined(NDEBUG)
- , m_disallowGC(std::in_place)
- #endif
- {
-@@ -111,7 +106,7 @@
-
- ConcurrentJSLocker(ConcurrentJSLock* lockable)
- : ConcurrentJSLockerBase(lockable)
--#if ENABLE(CONCURRENT_JS) && !defined(NDEBUG)
-+#if !defined(NDEBUG)
- , m_disallowGC(std::in_place)
- #endif
- {
-@@ -119,7 +114,7 @@
-
- ConcurrentJSLocker(NoLockingNecessaryTag)
- : ConcurrentJSLockerBase(NoLockingNecessary)
--#if ENABLE(CONCURRENT_JS) && !defined(NDEBUG)
-+#if !defined(NDEBUG)
- , m_disallowGC(WTF::nullopt)
- #endif
- {
-@@ -127,7 +122,7 @@
-
- ConcurrentJSLocker(int) = delete;
-
--#if ENABLE(CONCURRENT_JS) && !defined(NDEBUG)
-+#if !defined(NDEBUG)
- private:
- Optional m_disallowGC;
- #endif
---- target-org/webkit/Source/WTF/ChangeLog 2019-09-23 18:40:37.000000000 +0800
-+++ target/webkit/Source/WTF/ChangeLog 2019-12-18 08:35:53.000000000 +0800
-@@ -1,3 +1,15 @@
-+2019-10-18 Yusuke Suzuki
-+
-+ [JSC] Make ConcurrentJSLock Lock even if ENABLE_CONCURRENT_JS=OFF
-+ https://bugs.webkit.org/show_bug.cgi?id=202892
-+
-+ Reviewed by Mark Lam.
-+
-+ BaselineJIT also has concurrent compiler. ENABLE(CONCURRENT_JS) should not rely on ENABLE(DFG_JIT).
-+ It should rely on ENABLE(JIT) instead.
-+
-+ * wtf/Platform.h:
-+
- 2019-09-20 Libor Bukata
-
- UI process crash when using callOnMainThread() after the main thread dispatcher has been destroyed
---- target-org/webkit/Source/WTF/wtf/Platform.h 2019-08-23 14:21:51.000000000 -0700
-+++ target/webkit/Source/WTF/wtf/Platform.h 2019-10-21 11:44:30.000000000 -0700
-@@ -840,7 +840,7 @@
- values get stored to atomically. This is trivially true on 64-bit platforms,
- but not true at all on 32-bit platforms where values are composed of two
- separate sub-values. */
--#if ENABLE(DFG_JIT) && USE(JSVALUE64)
-+#if ENABLE(JIT) && USE(JSVALUE64)
- #define ENABLE_CONCURRENT_JS 1
- #endif
diff --git a/patches/jsc_heap_gc_like_ios.patch b/patches/jsc_heap_gc_like_ios.patch
deleted file mode 100644
index c24645f0b..000000000
--- a/patches/jsc_heap_gc_like_ios.patch
+++ /dev/null
@@ -1,58 +0,0 @@
---- download/webkit/Source/JavaScriptCore/heap/Heap.cpp 2019-09-17 23:35:30.000000000 +0800
-+++ target/webkit/Source/JavaScriptCore/heap/Heap.cpp 2019-09-17 23:18:36.000000000 +0800
-@@ -88,7 +88,7 @@
- #include
- #include
-
--#if PLATFORM(IOS_FAMILY)
-+#if PLATFORM(IOS_FAMILY) || defined(__ANDROID__)
- #include
- #endif
-
-@@ -129,7 +129,7 @@
- if (VM::isInMiniMode())
- return Options::miniVMHeapGrowthFactor() * heapSize;
-
--#if PLATFORM(IOS_FAMILY)
-+#if PLATFORM(IOS_FAMILY) || defined(__ANDROID__)
- size_t memoryFootprint = bmalloc::api::memoryFootprint();
- if (memoryFootprint < ramSize * Options::smallHeapRAMFraction())
- return Options::smallHeapGrowthFactor() * heapSize;
-@@ -538,7 +538,7 @@
-
- bool Heap::overCriticalMemoryThreshold(MemoryThresholdCallType memoryThresholdCallType)
- {
--#if PLATFORM(IOS_FAMILY)
-+#if PLATFORM(IOS_FAMILY) || defined(__ANDROID__)
- if (memoryThresholdCallType == MemoryThresholdCallType::Direct || ++m_precentAvailableMemoryCachedCallCount >= 100) {
- m_overCriticalMemoryThreshold = bmalloc::api::percentAvailableMemoryInUse() > Options::criticalGCMemoryThreshold();
- m_precentAvailableMemoryCachedCallCount = 0;
-@@ -2332,7 +2332,7 @@
- }
- }
-
--#if PLATFORM(IOS_FAMILY)
-+#if PLATFORM(IOS_FAMILY) || defined(__ANDROID__)
- // Get critical memory threshold for next cycle.
- overCriticalMemoryThreshold(MemoryThresholdCallType::Direct);
- #endif
-@@ -2629,7 +2629,7 @@
- } else {
- size_t bytesAllowedThisCycle = m_maxEdenSize;
-
--#if PLATFORM(IOS_FAMILY)
-+#if PLATFORM(IOS_FAMILY) || defined(__ANDROID__)
- if (overCriticalMemoryThreshold())
- bytesAllowedThisCycle = std::min(m_maxEdenSizeWhenCritical, bytesAllowedThisCycle);
- #endif
---- download/webkit/Source/JavaScriptCore/heap/Heap.h 2019-09-17 23:35:36.000000000 +0800
-+++ target/webkit/Source/JavaScriptCore/heap/Heap.h 2019-09-17 23:18:36.000000000 +0800
-@@ -739,7 +739,7 @@
- CurrentThreadState* m_currentThreadState { nullptr };
- Thread* m_currentThread { nullptr }; // It's OK if this becomes a dangling pointer.
-
--#if PLATFORM(IOS_FAMILY)
-+#if PLATFORM(IOS_FAMILY) || defined(__ANDROID__)
- unsigned m_precentAvailableMemoryCachedCallCount;
- bool m_overCriticalMemoryThreshold;
- #endif
diff --git a/patches/jsc_startup_log_version.patch b/patches/jsc_startup_log_version.patch
index 05fb25af5..a17d53156 100644
--- a/patches/jsc_startup_log_version.patch
+++ b/patches/jsc_startup_log_version.patch
@@ -1,10 +1,9 @@
-diff -aur target-org/webkit/Source/JavaScriptCore/API/JSBase.cpp target/webkit/Source/JavaScriptCore/API/JSBase.cpp
---- target-org/webkit/Source/JavaScriptCore/API/JSBase.cpp 2017-05-05 02:37:52.000000000 +0300
-+++ target/webkit/Source/JavaScriptCore/API/JSBase.cpp 2018-10-09 14:38:30.000000000 +0300
-@@ -197,3 +197,9 @@
- const char iosInstallName60 = 0;
- const char iosInstallName61 = 0;
- #endif
+--- target-org/webkit/Source/JavaScriptCore/API/JSBase.cpp 2021-09-30 08:19:07.000000000 +0800
++++ target/webkit/Source/JavaScriptCore/API/JSBase.cpp 2022-07-09 17:00:28.000000000 +0800
+@@ -221,3 +221,9 @@
+
+ return toRef(object);
+ }
+
+extern "C" int __android_log_print(int prio, const char *tag, const char *fmt, ...);
+__attribute__((constructor))
diff --git a/patches/ndkr23.patch b/patches/ndkr23.patch
new file mode 100644
index 000000000..7996283d1
--- /dev/null
+++ b/patches/ndkr23.patch
@@ -0,0 +1,53 @@
+--- target-org/webkit/Source/bmalloc/libpas/src/libpas/pas_min_heap.h 2021-11-16 15:02:45.000000000 +0800
++++ target/webkit/Source/bmalloc/libpas/src/libpas/pas_min_heap.h 2022-07-10 11:45:19.000000000 +0800
+@@ -260,7 +260,7 @@
+ \
+ size_t index = config.get_index(&element); \
+ PAS_ASSERT(index); \
+- PAS_ASSERT(!bcmp(name##_get_ptr_by_index(min_heap, index), &element, sizeof(type))); \
++ PAS_ASSERT(!memcmp(name##_get_ptr_by_index(min_heap, index), &element, sizeof(type))); \
+ name##_remove_by_index(min_heap, index); \
+ } \
+ \
+--- target-org/webkit/Source/bmalloc/libpas/src/libpas/pas_thread_local_cache.c 2022-07-10 22:34:50.000000000 +0800
++++ target/webkit/Source/bmalloc/libpas/src/libpas/pas_thread_local_cache.c 2022-07-10 23:15:53.000000000 +0800
+@@ -201,9 +201,9 @@
+ else
+ pas_log("[%d] thread %p does not have id\n", getpid(), thread);
+ #endif
+- if (!pthread_getname_np(thread, thread_name, sizeof(thread_name)))
+- pas_log("[%d] thread %p has name %s\n", getpid(), (void*)thread, thread_name);
+- else
++ // if (!pthread_getname_np(thread, thread_name, sizeof(thread_name)))
++ // pas_log("[%d] thread %p has name %s\n", getpid(), (void*)thread, thread_name);
++ // else
+ pas_log("[%d] thread %p does not have name\n", getpid(), (void*)thread);
+ }
+
+--- target-org/webkit/Source/cmake/OptionsCommon.cmake 2022-02-12 06:46:36.000000000 +0800
++++ target/webkit/Source/cmake/OptionsCommon.cmake 2022-07-10 22:56:50.000000000 +0800
+@@ -1,10 +1,11 @@
+-set(CMAKE_CXX_STANDARD 20)
++set(CMAKE_CXX_STANDARD 17)
+ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+ set(CMAKE_CXX_EXTENSIONS OFF)
+
+ add_definitions(-DBUILDING_WITH_CMAKE=1)
+ add_definitions(-DHAVE_CONFIG_H=1)
+ add_definitions(-DPAS_BMALLOC=1)
++add_definitions(-DHAVE_MISSING_STD_FILESYSTEM_PATH_CONSTRUCTOR=1)
+
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+ define_property(TARGET PROPERTY FOLDER INHERITED BRIEF_DOCS "folder" FULL_DOCS "IDE folder name")
+--- target-org/webkit/Source/WTF/wtf/PlatformJSCOnly.cmake 2021-10-20 16:26:42.000000000 +0800
++++ target/webkit/Source/WTF/wtf/PlatformJSCOnly.cmake 2022-07-10 12:49:42.000000000 +0800
+@@ -95,7 +95,7 @@
+ list(APPEND WTF_PUBLIC_HEADERS
+ spi/darwin/ProcessMemoryFootprint.h
+ )
+-elseif (CMAKE_SYSTEM_NAME MATCHES "Linux")
++elseif (CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "Android")
+ list(APPEND WTF_SOURCES
+ linux/CurrentProcessMemoryStatus.cpp
+ linux/MemoryFootprintLinux.cpp
+
diff --git a/scripts/compile/all.sh b/scripts/compile/all.sh
index 1a6e29c06..9bd1fd38c 100755
--- a/scripts/compile/all.sh
+++ b/scripts/compile/all.sh
@@ -30,13 +30,6 @@ compile() {
done
}
-if ${I18N}
-then
- export FLAVOR=intl
- export ENABLE_INTL=1
- compile
-else
- export FLAVOR=no-intl
- export ENABLE_INTL=0
- compile
-fi
+export FLAVOR=intl
+export ENABLE_INTL=1
+compile
diff --git a/scripts/compile/common.sh b/scripts/compile/common.sh
index 4c81a6470..1e5a6c44b 100755
--- a/scripts/compile/common.sh
+++ b/scripts/compile/common.sh
@@ -49,38 +49,18 @@ TOOLCHAIN_PLATFORM=$(ls -1 $ANDROID_NDK/toolchains/llvm/prebuilt | head -1)
TOOLCHAIN_DIR="$ANDROID_NDK/toolchains/llvm/prebuilt/$TOOLCHAIN_PLATFORM/"
# settings
-PLATFORM_CFLAGS_arm=" \
--march=armv7-a \
--mfloat-abi=softfp \
--mfpu=neon \
--mthumb \
-"
-PLATFORM_LDFLAGS_arm=" \
--march=armv7-a \
--Wl,--fix-cortex-a8 \
-"
+PLATFORM_CFLAGS_arm=""
+PLATFORM_LDFLAGS_arm=""
JNI_ARCH_arm=armeabi-v7a
PLATFORM_LDFLAGS_arm64=""
JNI_ARCH_arm64=arm64-v8a
-PLATFORM_CFLAGS_x86=" \
--march=i686 \
--mtune=intel \
--mssse3 \
--mfpmath=sse \
--m32 \
-"
+PLATFORM_CFLAGS_x86=""
PLATFORM_LDFLAGS_x86=""
JNI_ARCH_x86=x86
-PLATFORM_CFLAGS_x86_64=" \
--march=x86-64 \
--msse4.2 \
--mpopcnt \
--m64 \
--mtune=intel \
-"
+PLATFORM_CFLAGS_x86_64=""
PLATFORM_LDFLAGS_x86_64=""
JNI_ARCH_x86_64=x86_64
@@ -119,7 +99,7 @@ DEBUG_SYMBOL_LEVEL="-g2"
if [[ "$BUILD_TYPE" = "Release" ]]
then
FRAME_POINTER_FLAG="-fomit-frame-pointer"
- CFLAGS_BUILD_TYPE="-DNDEBUG -g0"
+ CFLAGS_BUILD_TYPE="-DNDEBUG -g0 -Oz -flto=full"
ICU_CFLAGS_BUILD_TYPE="-Oz"
else
FRAME_POINTER_FLAG="-fno-omit-frame-pointer"
@@ -149,7 +129,7 @@ $FRAME_POINTER_FLAG \
-DCUSTOMIZE_REACT_NATIVE \
$SWITCH_COMMON_CFLAGS_INTL \
$CFLAGS_BUILD_TYPE \
--D__ANDROID_API__=${ANDROID_API} \
+-D__ANDROID_MIN_SDK_VERSION__=${ANDROID_API} \
"
COMMON_CXXFLAGS=" \
@@ -158,8 +138,6 @@ COMMON_CXXFLAGS=" \
ICU_CFLAGS="$COMMON_CFLAGS $PLATFORM_CFLAGS $ICU_CFLAGS_BUILD_TYPE"
ICU_CXXFLAGS="$COMMON_CXXFLAGS $ICU_CFLAGS $ICU_CFLAGS_BUILD_TYPE"
ICU_LDFLAGS="$COMMON_LDFLAGS \
--fuse-ld=gold \
--Wl,--icf=safe \
$PLATFORM_LDFLAGS \
"
diff --git a/scripts/compile/icu.sh b/scripts/compile/icu.sh
index 999541ae8..1696958dc 100755
--- a/scripts/compile/icu.sh
+++ b/scripts/compile/icu.sh
@@ -46,8 +46,10 @@ $TARGETDIR/icu/source/configure --prefix=${INSTALL_DIR} \
LDFLAGS="$ICU_LDFLAGS" \
CC=$CROSS_COMPILE_PLATFORM_CC-clang \
CXX=$CROSS_COMPILE_PLATFORM_CC-clang++ \
- AR=$CROSS_COMPILE_PLATFORM-ar \
- RINLIB=$CROSS_COMPILE_PLATFORM-ranlib \
+ AR=$TOOLCHAIN_DIR/bin/llvm-ar \
+ LD=$TOOLCHAIN_DIR/bin/ld \
+ RANLIB=$TOOLCHAIN_DIR/bin/llvm-ranlib \
+ STRIP=$TOOLCHAIN_DIR/bin/llvm-strip \
--with-data-packaging=static
make -j5 install
diff --git a/scripts/compile/jsc.sh b/scripts/compile/jsc.sh
index 0abcd7ca9..6a2061ea9 100755
--- a/scripts/compile/jsc.sh
+++ b/scripts/compile/jsc.sh
@@ -19,7 +19,7 @@ $PLATFORM_CFLAGS \
CMAKE_LD_FLAGS=" \
-latomic \
-lm \
--lc++_shared \
+-static-libstdc++ \
$JSC_LDFLAGS \
$PLATFORM_LDFLAGS \
"
@@ -90,7 +90,5 @@ mkdir -p $INSTALL_UNSTRIPPED_DIR_I18N/$JNI_ARCH
mkdir -p $INSTALL_DIR_I18N/$JNI_ARCH
cp $TARGETDIR/webkit/WebKitBuild/$BUILD_TYPE/lib/libjsc.so $INSTALL_UNSTRIPPED_DIR_I18N/$JNI_ARCH
cp $TARGETDIR/webkit/WebKitBuild/$BUILD_TYPE/lib/libjsc.so $INSTALL_DIR_I18N/$JNI_ARCH
-$TOOLCHAIN_DIR/$CROSS_COMPILE_PLATFORM/bin/strip $INSTALL_DIR_I18N/$JNI_ARCH/libjsc.so
+$TOOLCHAIN_DIR/bin/llvm-strip $INSTALL_DIR_I18N/$JNI_ARCH/libjsc.so
mv $TARGETDIR/webkit/WebKitBuild $TARGETDIR/webkit/${CROSS_COMPILE_PLATFORM}-${FLAVOR}
-
-cp $TOOLCHAIN_DIR/sysroot/usr/lib/$CROSS_COMPILE_PLATFORM/libc++_shared.so $INSTALL_CPPRUNTIME_DIR
diff --git a/scripts/env.sh b/scripts/env.sh
index b5779e7c0..75f6b8330 100644
--- a/scripts/env.sh
+++ b/scripts/env.sh
@@ -11,9 +11,6 @@ export INSTALL_DIR=$ROOTDIR/build/compiled
# JSC unstripped shared library install dir
export INSTALL_UNSTRIPPED_DIR=$ROOTDIR/build/compiled.unstripped
-# CPP runtime shared library install dir
-export INSTALL_CPPRUNTIME_DIR=$ROOTDIR/build/cppruntime
-
# Install dir for i18n build variants
export INSTALL_DIR_I18N_true=$INSTALL_DIR/intl
export INSTALL_DIR_I18N_false=$INSTALL_DIR/nointl
diff --git a/scripts/patch.sh b/scripts/patch.sh
index 3214a77fe..feb9e0382 100755
--- a/scripts/patch.sh
+++ b/scripts/patch.sh
@@ -15,20 +15,12 @@ JSC_PATCHSET=(
# Feature toggles, e.g. disable unnecessary build or JIT settings
"jsc_features.patch"
+ # NDK r23 support and fix build errors
+ "ndkr23.patch"
+
# NDK does not support backtrace and execinfo.h
"jsc_fix_build_error_execinfo.patch"
- # NDK API 16 does not have getline().
- # Since the WTF MemoryFootprint is not used in JSC, comment out all the code.
- "jsc_fix_build_error_getline.patch"
-
- # NDK API 16 does not have log2().
- # Add custom polyfill
- "jsc_fix_build_error_log2.patch"
-
- # NDK API 16 does not have posix_memalign
- "jsc_fix_build_error_memalign.patch"
-
# Fix build error which related to C++StringView
"jsc_fix_build_error_stringview.patch"
@@ -41,14 +33,6 @@ JSC_PATCHSET=(
# Will print current JSC version in adb log during initialization
"jsc_startup_log_version.patch"
- # NDK r17c does not define __mulodi4, which is being used in debug build.
- # (However, NDK r19 fixed this)
- "jsc_fix_build_error_mulodi4.patch"
-
- # statvfs is provided after NDK API level 19.
- # Use statfs as fallback
- "jsc_fix_build_error_statvfs.patch"
-
# Misc errors
"jsc_fix_build_error_miss_headers.patch"
@@ -56,14 +40,7 @@ JSC_PATCHSET=(
"jsc_fix_arm64_jit_crash.patch"
# Intl default timezone with Android integration
- "jsc_intl_timezone.patch"
-
- # Improve heap GC mechanism like iOS
- "jsc_heap_gc_like_ios.patch"
-
- # GC concurrent issue potential fix
- # https://trac.webkit.org/changeset/251307/webkit
- "jsc_fix_concurrent_gc_issue.patch"
+ # "jsc_intl_timezone.patch"
)
if [[ "$I18N" = false ]]
diff --git a/scripts/start.sh b/scripts/start.sh
index 97b57afaa..5bbd8dd0c 100755
--- a/scripts/start.sh
+++ b/scripts/start.sh
@@ -1,6 +1,6 @@
#!/bin/bash -e
-export ANDROID_API_FOR_ABI_32=16
+export ANDROID_API_FOR_ABI_32=21
export ANDROID_API_FOR_ABI_64=21
export ROOTDIR=$PWD
@@ -96,26 +96,18 @@ copyHeaders() {
cp -Rf $TARGETDIR/webkit/Source/JavaScriptCore/API/*.h ${distDir}/include
}
-export I18N=false
-prep
-compile
-
export I18N=true
prep
compile
export DISTDIR=${ROOTDIR}/dist
printf "\n\n\t\t===================== create stripped distributions =====================\n\n"
-createAAR "android-jsc" ${DISTDIR} ${INSTALL_DIR_I18N_false} "false"
createAAR "android-jsc" ${DISTDIR} ${INSTALL_DIR_I18N_true} "true"
-createAAR "cppruntime" ${DISTDIR} ${INSTALL_CPPRUNTIME_DIR} "false"
copyHeaders ${DISTDIR}
printf "\n\n\t\t===================== create unstripped distributions =====================\n\n"
export DISTDIR=${ROOTDIR}/dist.unstripped
-createAAR "android-jsc" ${DISTDIR} ${INSTALL_UNSTRIPPED_DIR_I18N_false} "false"
createAAR "android-jsc" ${DISTDIR} ${INSTALL_UNSTRIPPED_DIR_I18N_true} "true"
-createAAR "cppruntime" ${DISTDIR} ${INSTALL_CPPRUNTIME_DIR} "false"
copyHeaders ${DISTDIR}
npm run info
diff --git a/test/android/app/build.gradle b/test/android/app/build.gradle
index 9bc247c31..a9dec7906 100644
--- a/test/android/app/build.gradle
+++ b/test/android/app/build.gradle
@@ -109,7 +109,7 @@ def enableProguardInReleaseBuilds = false
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
-def jscFlavor = 'org.webkit:android-jsc:+'
+def jscFlavor = 'org.webkit:android-jsc-intl:+'
/**
* Whether to enable the Hermes VM.