extra/js to 24.2.0-3.1

This commit is contained in:
Kevin Mihelich 2016-10-13 00:18:03 +00:00
parent 0802fbbb34
commit 994beb6663
4 changed files with 116 additions and 18 deletions

View file

@ -2,11 +2,11 @@
# Maintainer: Ionut Biru <ibiru@archlinux.org>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - patch for AArch64
# - patches for AArch64 from Fedora
pkgname=js
pkgver=24.2.0
pkgrel=3
pkgrel=3.1
pkgdesc="JavaScript interpreter and libraries"
arch=(i686 x86_64)
url="https://developer.mozilla.org/En/SpiderMonkey/17"
@ -15,9 +15,11 @@ depends=(nspr gcc-libs readline zlib)
makedepends=(python2 zip libffi)
options=(!staticlibs)
source=(http://ftp.mozilla.org/pub/mozilla.org/js/mozjs-$pkgver.tar.bz2
aarch64.patch)
mozjs24-0001-Add-AArch64-support.patch
mozjs24-48-bit-VA-fix.patch)
md5sums=('5db79c10e049a2dc117a6e6a3bc78a8e'
'144736bd4a4825ba5a1c87439230964d')
'06eea5b38cf71b894a079a1c932e421b'
'82e9016bc35b745d56aec6dbea3ed520')
prepare() {
cd mozjs-$pkgver/js/src
@ -29,7 +31,8 @@ prepare() {
sed -i 's/(defined\((@TEMPLATE_FILE)\))/\1/' config/milestone.pl
cd ../..
patch -p1 -i ../aarch64.patch
patch -p1 -i ../mozjs24-0001-Add-AArch64-support.patch
patch -p1 -i ../mozjs24-48-bit-VA-fix.patch
}
build() {

View file

@ -1,13 +0,0 @@
diff -urN a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
--- a/mfbt/double-conversion/utils.h 2013-10-29 14:40:19.000000000 -0600
+++ b/mfbt/double-conversion/utils.h 2015-07-10 22:55:40.262596161 -0600
@@ -58,7 +58,8 @@
defined(__mips__) || defined(__powerpc__) || \
defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
defined(__SH4__) || defined(__alpha__) || \
- defined(_MIPS_ARCH_MIPS32R2)
+ defined(_MIPS_ARCH_MIPS32R2) || \
+ defined(__AARCH64EL__)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
#if defined(_WIN32)

View file

@ -0,0 +1,51 @@
--- mozjs-24.2.0/js/src/assembler/jit/ExecutableAllocator.h.orig 2013-10-29 20:40:26.000000000 +0000
+++ mozjs-24.2.0/js/src/assembler/jit/ExecutableAllocator.h 2014-01-22 16:52:53.603726328 +0000
@@ -391,6 +391,12 @@
{
reprotectRegion(start, size, Executable);
}
+#elif WTF_CPU_AARCH64 && WTF_PLATFORM_LINUX
+ static void cacheFlush(void* code, size_t size)
+ {
+ intptr_t end = reinterpret_cast<intptr_t>(code) + size;
+ __builtin___clear_cache(reinterpret_cast<char*>(code), reinterpret_cast<char*>(end));
+ }
#else
static void makeWritable(void*, size_t) {}
static void makeExecutable(void*, size_t) {}
--- mozjs-24.2.0/js/src/assembler/wtf/Platform.h.orig 2013-10-29 20:40:26.000000000 +0000
+++ mozjs-24.2.0/js/src/assembler/wtf/Platform.h 2014-01-22 16:52:53.604726300 +0000
@@ -326,6 +326,10 @@
#define WTF_THUMB_ARCH_VERSION 0
#endif
+/* CPU(AArch64) - 64-bit ARM */
+#if defined(__aarch64__)
+#define WTF_CPU_AARCH64 1
+#endif
/* WTF_CPU_ARMV5_OR_LOWER - ARM instruction set v5 or earlier */
/* On ARMv5 and below the natural alignment is required.
--- mozjs-24.2.0/js/src/configure.in.orig 2013-12-11 22:22:50.000000000 +0000
+++ mozjs-24.2.0/js/src/configure.in 2014-01-22 16:52:53.604726300 +0000
@@ -1018,6 +1018,10 @@
CPU_ARCH=arm
;;
+aarch64)
+ CPU_ARCH=aarch64
+ ;;
+
mips|mipsel)
CPU_ARCH="mips"
;;
--- mozjs-24.2.0/mfbt/double-conversion/utils.h.orig 2014-01-22 16:52:42.596045903 +0000
+++ mozjs-24.2.0/mfbt/double-conversion/utils.h 2014-01-22 16:52:53.605726272 +0000
@@ -58,6 +58,7 @@
defined(__mips__) || defined(__powerpc__) || \
defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
defined(__SH4__) || defined(__alpha__) || \
+ defined(__aarch64__) || \
defined(_MIPS_ARCH_MIPS32R2)
#define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)

View file

@ -0,0 +1,57 @@
From c3ef56fa3239d9133be922059300a6fd2e7c1435 Mon Sep 17 00:00:00 2001
From: Zheng Xu <zheng.xu@linaro.org>
Date: Wed, 17 Aug 2016 11:59:15 +0800
Subject: [PATCH] Bug 1143022 - Manually mmap on arm64 to ensure high 17 bits are clear. r=ehoogeveen
There might be 48-bit VA on arm64 depending on kernel configuration.
Manually mmap heap memory to align with the assumption made by JS engine.
Change-Id: Ic5d2b2fe4b758b3c87cc0688348af7e71a991146
---
diff --git a/js/src/gc/Memory.cpp b/js/src/gc/Memory.cpp
index 153ccb4..b2d1311 100644
--- a/js/src/gc/Memory.cpp
+++ b/js/src/gc/Memory.cpp
@@ -339,6 +339,41 @@
return MAP_FAILED;
}
return region;
+#elif defined(__aarch64__)
+ /*
+ * There might be similar virtual address issue on arm64 which depends on
+ * hardware and kernel configurations. But the work around is slightly
+ * different due to the different mmap behavior.
+ *
+ * TODO: Merge with the above code block if this implementation works for
+ * ia64 and sparc64.
+ */
+ const uintptr_t start = (uintptr_t)(0x0000070000000000UL);
+ const uintptr_t end = (uintptr_t)(0x0000800000000000UL);
+ const uintptr_t step = ChunkSize;
+ /*
+ * Optimization options if there are too many retries in practice:
+ * 1. Examine /proc/self/maps to find an available address. This file is
+ * not always available, however. In addition, even if we examine
+ * /proc/self/maps, we may still need to retry several times due to
+ * racing with other threads.
+ * 2. Use a global/static variable with lock to track the addresses we have
+ * allocated or tried.
+ */
+ uintptr_t hint;
+ void* region = MAP_FAILED;
+ for (hint = start; region == MAP_FAILED && hint + length <= end; hint += step) {
+ region = mmap((void*)hint, length, prot, flags, fd, offset);
+ if (region != MAP_FAILED) {
+ if ((uintptr_t(region) + (length - 1)) & 0xffff800000000000) {
+ if (munmap(region, length)) {
+ MOZ_ASSERT(errno == ENOMEM);
+ }
+ region = MAP_FAILED;
+ }
+ }
+ }
+ return region == MAP_FAILED ? nullptr : region;
#else
return mmap(NULL, length, prot, flags, fd, offset);
#endif