mozjs: Update Double-Conversion inside mozjs

Update the Double-Conversion source inside mozjs to add support for more
architectures.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Alistair Francis
2018-06-20 13:15:12 -07:00
committed by Khem Raj
parent 28fab4c8f5
commit f097a2d7d6
4 changed files with 1909 additions and 77 deletions
@@ -1,76 +0,0 @@
From 15e710e331d36eb279852b5cd1ba37a9a6005217 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen.kooi@linaro.org>
Date: Mon, 2 Mar 2015 19:08:22 +0800
Subject: [PATCH 3/5] Add AArch64 support
---
Upstream-status: Pending
js/src/assembler/jit/ExecutableAllocator.h | 6 ++++++
js/src/assembler/wtf/Platform.h | 4 ++++
js/src/configure.in | 4 ++++
mfbt/double-conversion/utils.h | 1 +
4 files changed, 15 insertions(+)
diff --git a/js/src/assembler/jit/ExecutableAllocator.h b/js/src/assembler/jit/ExecutableAllocator.h
index c071c33..90764c3 100644
--- a/js/src/assembler/jit/ExecutableAllocator.h
+++ b/js/src/assembler/jit/ExecutableAllocator.h
@@ -382,6 +382,12 @@ public:
{
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) {}
diff --git a/js/src/assembler/wtf/Platform.h b/js/src/assembler/wtf/Platform.h
index 0c84896..e8763a7 100644
--- a/js/src/assembler/wtf/Platform.h
+++ b/js/src/assembler/wtf/Platform.h
@@ -325,6 +325,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.
diff --git a/js/src/configure.in b/js/src/configure.in
index 64c7606..0673aca 100644
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -1121,6 +1121,10 @@ arm*)
CPU_ARCH=arm
;;
+aarch64)
+ CPU_ARCH=aarch64
+ ;;
+
mips|mipsel)
CPU_ARCH="mips"
;;
diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
index 0eec2d9..fe26dab 100644
--- a/mfbt/double-conversion/utils.h
+++ b/mfbt/double-conversion/utils.h
@@ -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)
--
1.9.3
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,175 @@
From 1c3f6dd9bb478fea0622e8a9ba2efbf19d73e302 Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair.francis@wdc.com>
Date: Fri, 1 Jun 2018 14:46:47 -0700
Subject: [PATCH] Update the double conversion update script
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
.../add-mfbt-api-markers.patch | 94 -------------------
.../more-architectures.patch | 30 ------
mfbt/double-conversion/update.sh | 8 +-
3 files changed, 3 insertions(+), 129 deletions(-)
delete mode 100644 mfbt/double-conversion/add-mfbt-api-markers.patch
delete mode 100644 mfbt/double-conversion/more-architectures.patch
diff --git a/mfbt/double-conversion/add-mfbt-api-markers.patch b/mfbt/double-conversion/add-mfbt-api-markers.patch
deleted file mode 100644
index b98ec74..0000000
--- a/mfbt/double-conversion/add-mfbt-api-markers.patch
+++ /dev/null
@@ -1,94 +0,0 @@
-diff --git a/mfbt/double-conversion/double-conversion.h b/mfbt/double-conversion/double-conversion.h
-index f98edae..e536a01 100644
---- a/mfbt/double-conversion/double-conversion.h
-+++ b/mfbt/double-conversion/double-conversion.h
-@@ -28,6 +28,7 @@
- #ifndef DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
- #define DOUBLE_CONVERSION_DOUBLE_CONVERSION_H_
-
-+#include "mozilla/Types.h"
- #include "utils.h"
-
- namespace double_conversion {
-@@ -129,7 +130,7 @@ class DoubleToStringConverter {
- }
-
- // Returns a converter following the EcmaScript specification.
-- static const DoubleToStringConverter& EcmaScriptConverter();
-+ static MFBT_API(const DoubleToStringConverter&) EcmaScriptConverter();
-
- // Computes the shortest string of digits that correctly represent the input
- // number. Depending on decimal_in_shortest_low and decimal_in_shortest_high
-@@ -197,7 +198,7 @@ class DoubleToStringConverter {
- // The last two conditions imply that the result will never contain more than
- // 1 + kMaxFixedDigitsBeforePoint + 1 + kMaxFixedDigitsAfterPoint characters
- // (one additional character for the sign, and one for the decimal point).
-- bool ToFixed(double value,
-+ MFBT_API(bool) ToFixed(double value,
- int requested_digits,
- StringBuilder* result_builder) const;
-
-@@ -229,7 +230,7 @@ class DoubleToStringConverter {
- // kMaxExponentialDigits + 8 characters (the sign, the digit before the
- // decimal point, the decimal point, the exponent character, the
- // exponent's sign, and at most 3 exponent digits).
-- bool ToExponential(double value,
-+ MFBT_API(bool) ToExponential(double value,
- int requested_digits,
- StringBuilder* result_builder) const;
-
-@@ -267,7 +268,7 @@ class DoubleToStringConverter {
- // The last condition implies that the result will never contain more than
- // kMaxPrecisionDigits + 7 characters (the sign, the decimal point, the
- // exponent character, the exponent's sign, and at most 3 exponent digits).
-- bool ToPrecision(double value,
-+ MFBT_API(bool) ToPrecision(double value,
- int precision,
- StringBuilder* result_builder) const;
-
-@@ -292,7 +293,7 @@ class DoubleToStringConverter {
- // kBase10MaximalLength.
- // Note that DoubleToAscii null-terminates its input. So the given buffer
- // should be at least kBase10MaximalLength + 1 characters long.
-- static const int kBase10MaximalLength = 17;
-+ static const MFBT_DATA(int) kBase10MaximalLength = 17;
-
- // Converts the given double 'v' to ascii. 'v' must not be NaN, +Infinity, or
- // -Infinity. In SHORTEST_SINGLE-mode this restriction also applies to 'v'
-@@ -332,7 +333,7 @@ class DoubleToStringConverter {
- // terminating null-character when computing the maximal output size.
- // The given length is only used in debug mode to ensure the buffer is big
- // enough.
-- static void DoubleToAscii(double v,
-+ static MFBT_API(void) DoubleToAscii(double v,
- DtoaMode mode,
- int requested_digits,
- char* buffer,
-@@ -343,7 +344,7 @@ class DoubleToStringConverter {
-
- private:
- // Implementation for ToShortest and ToShortestSingle.
-- bool ToShortestIeeeNumber(double value,
-+ MFBT_API(bool) ToShortestIeeeNumber(double value,
- StringBuilder* result_builder,
- DtoaMode mode) const;
-
-@@ -351,15 +352,15 @@ class DoubleToStringConverter {
- // corresponding string using the configured infinity/nan-symbol.
- // If either of them is NULL or the value is not special then the
- // function returns false.
-- bool HandleSpecialValues(double value, StringBuilder* result_builder) const;
-+ MFBT_API(bool) HandleSpecialValues(double value, StringBuilder* result_builder) const;
- // Constructs an exponential representation (i.e. 1.234e56).
- // The given exponent assumes a decimal point after the first decimal digit.
-- void CreateExponentialRepresentation(const char* decimal_digits,
-+ MFBT_API(void) CreateExponentialRepresentation(const char* decimal_digits,
- int length,
- int exponent,
- StringBuilder* result_builder) const;
- // Creates a decimal representation (i.e 1234.5678).
-- void CreateDecimalRepresentation(const char* decimal_digits,
-+ MFBT_API(void) CreateDecimalRepresentation(const char* decimal_digits,
- int length,
- int decimal_point,
- int digits_after_point,
diff --git a/mfbt/double-conversion/more-architectures.patch b/mfbt/double-conversion/more-architectures.patch
deleted file mode 100644
index b8d3804..0000000
--- a/mfbt/double-conversion/more-architectures.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
---- a/mfbt/double-conversion/utils.h
-+++ b/mfbt/double-conversion/utils.h
-@@ -48,20 +48,24 @@
- // An easy way to test if the floating-point operations are correct is to
- // evaluate: 89255.0/1e22. If the floating-point stack is 64 bits wide then
- // the result is equal to 89255e-22.
- // The best way to test this, is to create a division-function and to compare
- // the output of the division with the expected result. (Inlining must be
- // disabled.)
- // On Linux,x86 89255e-22 != Div_double(89255.0/1e22)
- #if defined(_M_X64) || defined(__x86_64__) || \
-- defined(__ARMEL__) || \
-+ defined(__ARMEL__) || defined(__avr32__) || \
-+ defined(__hppa__) || defined(__ia64__) || \
-+ defined(__mips__) || defined(__powerpc__) || \
-+ defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
-+ defined(__SH4__) || defined(__alpha__) || \
- defined(_MIPS_ARCH_MIPS32R2)
- #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
--#elif defined(_M_IX86) || defined(__i386__)
-+#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
- #if defined(_WIN32)
- // Windows uses a 64bit wide floating point stack.
- #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
- #else
- #undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
- #endif // _WIN32
- #else
- #error Target architecture was not detected as supported by Double-Conversion.
diff --git a/mfbt/double-conversion/update.sh b/mfbt/double-conversion/update.sh
index 81add8e..9ef2e91 100755
--- a/mfbt/double-conversion/update.sh
+++ b/mfbt/double-conversion/update.sh
@@ -4,14 +4,12 @@
# double-conversion source that we need.
cp $1/LICENSE ./
-cp $1/README ./
+cp $1/COPYING ./
# Includes
-cp $1/src/*.h ./
+cp $1/double-conversion/*.h ./
# Source
-cp $1/src/*.cc ./
+cp $1/double-conversion/*.cc ./
-patch -p3 < add-mfbt-api-markers.patch
patch -p3 < use-StandardInteger.patch
-patch -p3 < more-architectures.patch
--
2.17.0
@@ -7,7 +7,6 @@ SRC_URI = "http://ftp.mozilla.org/pub/mozilla.org/js/${BPN}${PV}.tar.gz \
file://0001-mozjs17.0.0-fix-the-compile-bug-of-powerpc.patch \
file://0001-js.pc.in-do-not-include-RequiredDefines.h-for-depend.patch \
file://0002-Move-JS_BYTES_PER_WORD-out-of-config.h.patch;patchdir=../../ \
file://0003-Add-AArch64-support.patch;patchdir=../../ \
file://0004-mozbug746112-no-decommit-on-large-pages.patch;patchdir=../../ \
file://0005-aarch64-64k-page.patch;patchdir=../../ \
file://0001-regenerate-configure.patch;patchdir=../../ \
@@ -16,6 +15,8 @@ SRC_URI = "http://ftp.mozilla.org/pub/mozilla.org/js/${BPN}${PV}.tar.gz \
file://0010-fix-cross-compilation-on-i586-targets.patch;patchdir=../../ \
file://Manually_mmap_heap_memory_esr17.patch;patchdir=../../ \
file://0001-compare-the-first-character-of-string-to-be-null-or-.patch;patchdir=../../ \
file://Update-the-double-conversion-update-script.patch;patchdir=../../ \
file://Update-Double-Conversion.patch;patchdir=../../ \
"
SRC_URI[md5sum] = "20b6f8f1140ef6e47daa3b16965c9202"