diff --git a/.buckconfig b/.buckconfig index cf83d21..7cfde96 100644 --- a/.buckconfig +++ b/.buckconfig @@ -1,7 +1,9 @@ [buildfile] includes = //BUILD_DEFS [ndk] - ndk_version = r10c + cpu_abis = armv7, arm64, x86, x86_64 + gcc_version = 4.9 + app_platform = android-21 cppflags = \ -std=gnu11 \ -Wall \ @@ -88,6 +90,18 @@ -mfloat-abi=softfp \ -mthumb \ -Os + x86_64_cppflags = \ + -O2 + x86_64_cflags = \ + -funswitch-loops \ + -finline-limit=300 \ + -O2 + x86_64_cxxppflags = \ + -O2 + x86_64_cxxflags = \ + -funswitch-loops \ + -finline-limit=300 \ + -O2 x86_cppflags = \ -O2 x86_cflags = \ diff --git a/.gitignore b/.gitignore index 9ac924f..5cf0a28 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.idea +*.iml +gen buck-out/ .buckd/ icu diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1a5a876 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +dist: trusty +sudo: required +env: + global: + - _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap" + +language: c + +services: + - docker + +script: +- travis_wait 60 docker run --rm --name hei -v $PWD:/pwd -w /pwd gengjiawen/android-jsc:feature_abi_support /bin/sh -c "./fetch_sources.sh && buck build :android-jsc" + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b2fb40e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,28 @@ +FROM gengjiawen/android-ndk + +# use old ndk +ENV ANDROID_NDK_HOME /opt/android-ndk +ENV ANDROID_NDK /opt/android-ndk +ENV NDK_HOME /opt/android-ndk +ENV ANDROID_NDK_VERSION r10e +RUN rm -rf ${ANDROID_HOME}/ndk-bundle + +RUN mkdir /opt/android-ndk-tmp && \ + cd /opt/android-ndk-tmp && \ + wget -q https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip && \ + unzip -q android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip && \ + mv ./android-ndk-${ANDROID_NDK_VERSION} ${ANDROID_NDK_HOME} && \ + cd ${ANDROID_NDK_HOME} && \ + rm -rf /opt/android-ndk-tmp + +ENV PATH ${ANDROID_NDK_HOME}:$PATH + +RUN apt-get install git ant python-dev ruby zip subversion -y + +#install buck and checkout jsc +RUN wget "https://github.com/facebook/buck/releases/download/v2018.03.26.01/buck_2018.03.26_all.deb" && \ + dpkg -i buck_2018.03.26_all.deb && \ + buck --version && \ + svn export https://svn.webkit.org/repository/webkit/trunk/@174650 + + diff --git a/circle.yml b/circle.yml new file mode 100644 index 0000000..5f8e66d --- /dev/null +++ b/circle.yml @@ -0,0 +1,16 @@ +version: 2 +jobs: + build: + working_directory: ~/android-jsc + docker: + - image: gengjiawen/android-jsc:feature_abi_support + environment: + - ANDROID_NDK: '/opt/android-ndk' + - _JAVA_OPTIONS: "-XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap" + steps: + - checkout + - run: + name: build aar + command: | + ./fetch_sources.sh + buck build :android-jsc diff --git a/fetch_sources.sh b/fetch_sources.sh index b0b584d..77bd885 100755 --- a/fetch_sources.sh +++ b/fetch_sources.sh @@ -12,9 +12,7 @@ curl -o icu4c.tar.gz https://android.googlesource.com/platform/external/icu/+arc echo "Extracting ICU" tar -zxf icu4c.tar.gz -C icu -echo "Downloading JSC" -curl -O https://builds-nightly.webkit.org/files/trunk/src/WebKit-r174650.tar.bz2 - -echo "Extracting JSC" -tar -jxf WebKit-r174650.tar.bz2 -C jsc --strip 2 WebKit-r174650/Source/JavaScriptCore WebKit-r174650/Source/WTF +echo "set JSC" +cp -r /trunk/Source/JavaScriptCore jsc +cp -r /trunk/Source/WTF jsc diff --git a/jsc/BUCK b/jsc/BUCK index f033522..40b3259 100644 --- a/jsc/BUCK +++ b/jsc/BUCK @@ -2,7 +2,7 @@ import os -SUPPORTED_PLATFORMS = '^android-(armv7|x86)$' +SUPPORTED_PLATFORMS = '^android-(armv7|arm64|x86|x86_64)$' def unpack_rule(source, from_rule): genrule( @@ -26,19 +26,6 @@ WTF_EXPORTED_PREPROCESSOR_FLAGS = [ '-DENABLE_GLOBAL_FASTMALLOC_NEW=0', ] -# Dirty hack, StdLibExtras.h assumes incorrectly that is_trivially_destructible -# have been added in 4.8.1 version while it was added in 4.8.0. We emulate PATCH -# version to be 1 so that StdLibExtra.h doesn't try to declare -# is_trivially_destructible -# Except from this single place JSC code doesn't check for 4.8.1 anywhere else -WTF_EXPORTED_PREPROCESSOR_FLAGS.extend([ - '-U__GNUC_PATCHLEVEL__', - '-D__GNUC_PATCHLEVEL__=1', - '-DPTHREAD_KEYS_MAX=1024', - '-DINTPTR_MAX=LONG_MAX', - '-Dlog2(x)=(log(x)/log(2.0))', -]) - cxx_library( name = 'wtfassertions', force_static = True, @@ -165,6 +152,7 @@ cxx_library( supported_platforms_regex = SUPPORTED_PLATFORMS, header_namespace = '', headers = subdir_glob([ + ('WTF', '*.h'), ('WTF/wtf', '*.h'), ('', 'extra_headers/*.h'), ]), @@ -936,7 +924,7 @@ SOURCES = glob([ 'JavaScriptCore/*.asm', ]) SOURCES.append(':InitBytecodes.asm') -for platform in ('android-armv7', 'android-x86'): +for platform in ('android-armv7', 'android-arm64', 'android-x86', 'android-x86_64'): source = 'LLIntAssembly.{0}.h'.format(platform) genrule( name = source, diff --git a/jsc/extra_headers/LLIntAssembly.h b/jsc/extra_headers/LLIntAssembly.h index 4673d9e..ec2f4c4 100644 --- a/jsc/extra_headers/LLIntAssembly.h +++ b/jsc/extra_headers/LLIntAssembly.h @@ -4,6 +4,10 @@ #include "LLIntAssembly.android-armv7.h" #elif defined(__ANDROID__) && defined(__i386__) #include "LLIntAssembly.android-x86.h" +#elif defined(__ANDROID__) && defined(__x86_64__) +#include "LLIntAssembly.android-x86_64.h" +#elif defined(__ANDROID__) && defined(__aarch64__) +#include "LLIntAssembly.android-arm64.h" #else #error "Platform not supported" #endif