[jhbuild] core-deps-3.26: Add mozjs45
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild] core-deps-3.26: Add mozjs45
- Date: Mon, 24 Apr 2017 04:33:25 +0000 (UTC)
commit 6374f621e5b710f3b066593289c8441d7d4a1503
Author: Philip Chimento <philip chimento gmail com>
Date: Sun Apr 23 21:32:28 2017 -0700
core-deps-3.26: Add mozjs45
This won't stay here, it's just for people hacking on the mozjs45 branch.
It will be replaced by mozjs52, and at that point mozjs38 will be removed.
modulesets/gnome-suites-core-deps-3.26.modules | 24 ++
patches/mozjs45-1176787-disable-mozglue.patch | 87 +++++++
patches/mozjs45-1269317.patch | 122 ++++++++++
patches/mozjs45-add-bracket.patch | 16 ++
patches/mozjs45-build-parallel-installable.patch | 64 +++++
patches/mozjs45-copy-headers.patch | 13 +
patches/mozjs45-fix-tracelogger.patch | 274 ++++++++++++++++++++++
patches/mozjs45-functions-visibility.patch | 66 ++++++
patches/mozjs45-install-name.patch | 14 ++
9 files changed, 680 insertions(+), 0 deletions(-)
---
diff --git a/modulesets/gnome-suites-core-deps-3.26.modules b/modulesets/gnome-suites-core-deps-3.26.modules
index 82ce192..c629cfb 100644
--- a/modulesets/gnome-suites-core-deps-3.26.modules
+++ b/modulesets/gnome-suites-core-deps-3.26.modules
@@ -68,6 +68,8 @@
href="http://www.spice-space.org/download/"/>
<repository type="tarball" name="people.mozilla.org"
href="https://people.mozilla.org/~sstangl/"/>
+<repository type="tarball" name="mozilla2"
+ href="https://people-mozilla.org/~sfink/"/>
<include href="gnome-sysdeps-3.26.modules"/>
@@ -1572,6 +1574,28 @@
</dependencies>
</autotools>
+ <autotools id="mozjs45" autogen-sh="configure"
+ autogenargs="--enable-posix-nspr-emulation --with-system-zlib --enable-system-ffi
--with-system-icu --with-intl-api">
+ <pkg-config>mozjs-45.pc</pkg-config>
+ <branch repo="mozilla2" module="mozjs-45.0.2.tar.bz2"
+ version="45.0.2" source-subdir="js/src">
+ <patch file="mozjs45-fix-tracelogger.patch" strip="1"/>
+ <patch file="mozjs45-build-parallel-installable.patch" strip="1"/>
+ <patch file="mozjs45-install-name.patch" strip="1"/>
+ <patch file="mozjs45-copy-headers.patch" strip="1"/>
+ <patch file="mozjs45-add-bracket.patch" strip="1"/>
+ <patch file="mozjs45-1269317.patch" strip="1"/>
+ <patch file="mozjs45-functions-visibility.patch" strip="1"/>
+ <patch file="mozjs45-1176787-disable-mozglue.patch" strip="1"/>
+ </branch>
+ <dependencies>
+ <dep package="libffi"/>
+ <dep package="libicu"/>
+ <dep package="python2"/>
+ <dep package="zlib"/>
+ </dependencies>
+ </autotools>
+
<autotools id="pango" autogenargs="--with-cairo --enable-installed-tests">
<branch/>
<dependencies>
diff --git a/patches/mozjs45-1176787-disable-mozglue.patch b/patches/mozjs45-1176787-disable-mozglue.patch
new file mode 100644
index 0000000..a94d2cb
--- /dev/null
+++ b/patches/mozjs45-1176787-disable-mozglue.patch
@@ -0,0 +1,87 @@
+# HG changeset patch
+# User Till Schneidereit <till tillschneidereit net>
+# Date 1443697149 -7200
+# Thu Oct 01 12:59:09 2015 +0200
+# Node ID abab858f34206c8281ef6bfd0e046b4c8e70131a
+# Parent 3b476e0a4777fc2f0d977e7a9137f3892924ef90
+Bug 1176787 - Disable MOZ_GLUE_IN_PROGRAM in stand-alone builds on all platforms. r=glandium
+
+diff --git a/js/src/configure.in b/js/src/configure.in
+--- a/js/src/configure.in
++++ b/js/src/configure.in
+@@ -2931,26 +2931,31 @@ MOZ_ARG_DISABLE_BOOL(jemalloc,
+
+ dnl Consult the command-line arguments in stand alone-builds only. In
+ dnl non-stand-alone builds, we always use the value of MOZ_MEMORY inherited from
+ dnl the top-level configure script.
+ if test "$JS_STANDALONE"; then
+ MOZ_MEMORY=$LOCAL_MOZ_MEMORY
+ fi
+
+-case "${OS_TARGET}" in
+-Android|WINNT|Darwin)
++dnl In stand-alone builds we always only want to link executables against mozglue.
++if test "$JS_STANDALONE"; then
+ MOZ_GLUE_IN_PROGRAM=
+- ;;
+-*)
+- dnl On !Android !Windows !OSX, we only want to link executables against mozglue
+- MOZ_GLUE_IN_PROGRAM=1
+- AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
+- ;;
+-esac
++else
++ case "${OS_TARGET}" in
++ Android|WINNT|Darwin)
++ MOZ_GLUE_IN_PROGRAM=
++ ;;
++ *)
++ dnl On !Android !Windows !OSX, we only want to link executables against mozglue
++ MOZ_GLUE_IN_PROGRAM=1
++ AC_DEFINE(MOZ_GLUE_IN_PROGRAM)
++ ;;
++ esac
++fi
+
+ if test "$MOZ_MEMORY"; then
+ AC_DEFINE(MOZ_MEMORY)
+ if test "x$MOZ_DEBUG" = "x1"; then
+ AC_DEFINE(MOZ_MEMORY_DEBUG)
+ fi
+ dnl The generic feature tests that determine how to compute ncpus are long and
+ dnl complicated. Therefore, simply define special cpp variables for the
+--- a/js/src/configure 2017-03-20 10:01:40.087593115 +0000
++++ b/js/src/configure 2017-03-20 10:03:55.320550817 +0000
+@@ -14064,12 +14064,15 @@
+ MOZ_MEMORY=$LOCAL_MOZ_MEMORY
+ fi
+
+-case "${OS_TARGET}" in
+-Android|WINNT|Darwin)
++if test "$JS_STANDALONE"; then
+ MOZ_GLUE_IN_PROGRAM=
+- ;;
+-*)
+- MOZ_GLUE_IN_PROGRAM=1
++else
++ case "${OS_TARGET}" in
++ Android|WINNT|Darwin)
++ MOZ_GLUE_IN_PROGRAM=
++ ;;
++ *)
++ MOZ_GLUE_IN_PROGRAM=1
+ cat >> confdefs.pytmp <<\EOF
+ (''' MOZ_GLUE_IN_PROGRAM ''', ' 1 ')
+ EOF
+@@ -14077,8 +14080,9 @@
+ #define MOZ_GLUE_IN_PROGRAM 1
+ EOF
+
+- ;;
+-esac
++ ;;
++ esac
++fi
+
+ if test "$MOZ_MEMORY"; then
+ cat >> confdefs.pytmp <<\EOF
diff --git a/patches/mozjs45-1269317.patch b/patches/mozjs45-1269317.patch
new file mode 100644
index 0000000..a3a57d5
--- /dev/null
+++ b/patches/mozjs45-1269317.patch
@@ -0,0 +1,122 @@
+--- a/js/src/jit/RegisterSets.h 2017-02-10 17:33:06.210702431 -0800
++++ b/js/src/jit/RegisterSets.h 2017-02-10 17:43:52.877514146 -0800
+@@ -7,7 +7,6 @@
+ #ifndef jit_RegisterSets_h
+ #define jit_RegisterSets_h
+
+-#include "mozilla/Alignment.h"
+ #include "mozilla/MathAlgorithms.h"
+
+ #include "jit/JitAllocPolicy.h"
+@@ -26,8 +25,8 @@
+ Code code_;
+
+ public:
+- AnyRegister()
+- { }
++ AnyRegister() = default;
++
+ explicit AnyRegister(Register gpr) {
+ code_ = gpr.code();
+ }
+@@ -156,7 +155,7 @@
+ }
+ #endif
+
+- ValueOperand() {}
++ ValueOperand() = default;
+ };
+
+ // Registers to hold either either a typed or untyped value.
+@@ -165,46 +164,25 @@
+ // Type of value being stored.
+ MIRType type_;
+
+- // Space to hold either an AnyRegister or a ValueOperand.
+ union U {
+- mozilla::AlignedStorage2<AnyRegister> typed;
+- mozilla::AlignedStorage2<ValueOperand> value;
++ AnyRegister typed;
++ ValueOperand value;
+ } data;
+
+- AnyRegister& dataTyped() {
+- MOZ_ASSERT(hasTyped());
+- return *data.typed.addr();
+- }
+- ValueOperand& dataValue() {
+- MOZ_ASSERT(hasValue());
+- return *data.value.addr();
+- }
+-
+- AnyRegister dataTyped() const {
+- MOZ_ASSERT(hasTyped());
+- return *data.typed.addr();
+- }
+- const ValueOperand& dataValue() const {
+- MOZ_ASSERT(hasValue());
+- return *data.value.addr();
+- }
+-
+ public:
+
+- TypedOrValueRegister()
+- : type_(MIRType_None)
+- {}
++ TypedOrValueRegister() = default;
+
+ TypedOrValueRegister(MIRType type, AnyRegister reg)
+ : type_(type)
+ {
+- dataTyped() = reg;
++ data.typed = reg;
+ }
+
+ MOZ_IMPLICIT TypedOrValueRegister(ValueOperand value)
+ : type_(MIRType_Value)
+ {
+- dataValue() = value;
++ data.value = value;
+ }
+
+ MIRType type() const {
+@@ -220,11 +198,13 @@
+ }
+
+ AnyRegister typedReg() const {
+- return dataTyped();
++ MOZ_ASSERT(hasTyped());
++ return data.typed;
+ }
+
+ ValueOperand valueReg() const {
+- return dataValue();
++ MOZ_ASSERT(hasValue());
++ return data.value;
+ }
+
+ AnyRegister scratchReg() {
+@@ -240,19 +220,18 @@
+ // Whether a constant value is being stored.
+ bool constant_;
+
+- // Space to hold either a Value or a TypedOrValueRegister.
+ union U {
+- mozilla::AlignedStorage2<Value> constant;
+- mozilla::AlignedStorage2<TypedOrValueRegister> reg;
++ Value constant;
++ TypedOrValueRegister reg;
+ } data;
+
+ Value& dataValue() {
+ MOZ_ASSERT(constant());
+- return *data.constant.addr();
++ return data.constant;
+ }
+ TypedOrValueRegister& dataReg() {
+ MOZ_ASSERT(!constant());
+- return *data.reg.addr();
++ return data.reg;
+ }
+
+ public:
diff --git a/patches/mozjs45-add-bracket.patch b/patches/mozjs45-add-bracket.patch
new file mode 100644
index 0000000..873697d
--- /dev/null
+++ b/patches/mozjs45-add-bracket.patch
@@ -0,0 +1,16 @@
+Add bracket for sed 4.3 compliance
+
+Based on upstream fix by Daniel Stenberg in 09 jan 2017
+See: https://hg.mozilla.org/mozilla-central/rev/ebcbf47a83e7
+
+--- a/js/src/configure 2017-02-21 16:56:42.350105741 -0300
++++ b/js/src/configure 2017-02-21 17:33:13.183493978 -0300
+@@ -15231,7 +15231,7 @@
+ fi
+ fi
+
+- version=`sed -n
's/^[:space:]*#[[:space:]]*define[[:space:]][[:space:]]*U_ICU_VERSION_MAJOR_NUM[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p'
"$icudir/common/unicode/uvernum.h"`
++ version=`sed -n
's/^[[:space:]]*#[[:space:]]*define[[:space:]][[:space:]]*U_ICU_VERSION_MAJOR_NUM[[:space:]][[:space:]]*\([0-9][0-9]*\)[[:space:]]*$/\1/p'
"$icudir/common/unicode/uvernum.h"`
+ if test x"$version" = x; then
+ { echo "configure: error: cannot determine icu version number from uvernum.h header file $lineno"
1>&2; echo "configure: error: cannot determine icu version number from uvernum.h header file $lineno" 1>&5;
exit 1; }
+ fi
diff --git a/patches/mozjs45-build-parallel-installable.patch
b/patches/mozjs45-build-parallel-installable.patch
new file mode 100644
index 0000000..8cc9ea2
--- /dev/null
+++ b/patches/mozjs45-build-parallel-installable.patch
@@ -0,0 +1,64 @@
+Fixes the build so that it is parallel installable with other versions of
+mozjs. The mozjs-45.pc, js45, and js45-config files need to have "45" in the
+name.
+
+FIXME put mozbugzilla link here
+
+--- a/js/src/configure.in 2017-03-17 20:05:07.011058901 -0700
++++ b/js/src/configure.in 2017-03-17 20:05:44.011308025 -0700
+@@ -713,16 +713,13 @@
+ MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
+ IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
+
+-dnl XXX in a temporary bid to avoid developer anger at renaming files
+-dnl XXX before "js" symlinks exist, don't change names.
+-dnl
+-dnl if test -n "$JS_STANDALONE"; then
+-dnl JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
+-dnl JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
+-dnl else
++if test -n "$JS_STANDALONE"; then
++JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
++JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
++else
+ JS_SHELL_NAME=js
+ JS_CONFIG_NAME=js-config
+-dnl fi
++fi
+
+ changequote([,])
+ if test -n "$IS_ALPHA"; then
+--- a/js/src/configure 2017-03-17 20:05:02.147026160 -0700
++++ b/js/src/configure 2017-03-17 20:05:56.119389577 -0700
+@@ -6015,8 +6015,13 @@
+ MOZJS_PATCH_VERSION=`echo $MOZILLA_VERSION | sed "s|^[0-9]*\.[0-9]*[^0-9]*||"`
+ IS_ALPHA=`echo $MOZILLA_VERSION | grep '[ab]'`
+
++if test -n "$JS_STANDALONE"; then
++JS_SHELL_NAME=js$MOZJS_MAJOR_VERSION
++JS_CONFIG_NAME=js$MOZJS_MAJOR_VERSION-config
++else
+ JS_SHELL_NAME=js
+ JS_CONFIG_NAME=js-config
++fi
+
+
+ if test -n "$IS_ALPHA"; then
+--- a/js/src/Makefile.in 2017-03-17 20:08:12.608309863 -0700
++++ b/js/src/Makefile.in 2017-03-17 20:09:59.449031469 -0700
+@@ -175,10 +175,13 @@
+ SCRIPTS = $(JS_CONFIG_NAME)
+ SDK_BINARY = $(JS_CONFIG_NAME)
+
+-$(LIBRARY_NAME).pc: js.pc
++$(JS_CONFIG_NAME): js-config
+ cp $^ $@
+
+-install:: $(LIBRARY_NAME).pc
++$(JS_LIBRARY_NAME).pc: js.pc
++ cp $^ $@
++
++install:: $(JS_LIBRARY_NAME).pc
+ $(SYSINSTALL) $^ $(DESTDIR)$(libdir)/pkgconfig
+
+ install:: js-config.h
diff --git a/patches/mozjs45-copy-headers.patch b/patches/mozjs45-copy-headers.patch
new file mode 100644
index 0000000..7457509
--- /dev/null
+++ b/patches/mozjs45-copy-headers.patch
@@ -0,0 +1,13 @@
+Copies installed files to the install directory, instead of symlinking them.
+
+--- a/python/mozbuild/mozbuild/backend/recursivemake.py 2017-03-17 22:43:57.750699563 -0700
++++ b/python/mozbuild/mozbuild/backend/recursivemake.py 2017-03-17 22:44:28.722912859 -0700
+@@ -1306,7 +1306,7 @@
+ for f in files:
+ if not isinstance(f, ObjDirPath):
+ dest = mozpath.join(reltarget, path, mozpath.basename(f))
+- install_manifest.add_symlink(f.full_path, dest)
++ install_manifest.add_copy(f.full_path, dest)
+ else:
+ backend_file.write('%s_FILES += %s\n' % (
+ target_var, self._pretty_path(f, backend_file)))
diff --git a/patches/mozjs45-fix-tracelogger.patch b/patches/mozjs45-fix-tracelogger.patch
new file mode 100644
index 0000000..c8410ed
--- /dev/null
+++ b/patches/mozjs45-fix-tracelogger.patch
@@ -0,0 +1,274 @@
+# === Fix the SM45 tracelogger ===
+# This patch is a squashed version of several patches that were adapted
+# to fix failing hunks.
+#
+# Applied in the following order, they are:
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1266649
+# Handle failing to add to pointermap gracefully.
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1280648
+# Don't cache based on pointers to movable GC things.
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1255766
+# Also mark resizing of memory.
+# * https://bugzilla.mozilla.org/show_bug.cgi?id=1259403
+# Only increase capacity by multiples of 2.
+# Always make sure there are 3 free slots for events.
+# ===
+
+diff --git a/js/src/jit-test/tests/tracelogger/bug1266649.js
b/js/src/jit-test/tests/tracelogger/bug1266649.js
+new file mode 100644
+--- /dev/null
++++ b/js/src/jit-test/tests/tracelogger/bug1266649.js
+@@ -0,0 +1,8 @@
++
++var du = new Debugger();
++if (typeof du.setupTraceLogger === "function") {
++ du.setupTraceLogger({
++ Scripts: true
++ })
++ oomTest(() => function(){});
++}
+--- a/js/src/vm/TraceLogging.cpp 2016-04-14 10:55:17.000000000 -0700
++++ b/js/src/vm/TraceLogging.cpp 2017-03-29 18:17:25.235673763 -0700
+@@ -393,14 +393,14 @@
+ return nullptr;
+ }
+
+- if (!pointerMap.add(p, text, payload))
+- return nullptr;
+-
+ if (graph.get())
+ graph->addTextId(textId, str);
+
+ nextTextId++;
+
++ if (!pointerMap.add(p, text, payload))
++ return nullptr;
++
+ return payload;
+ }
+
+@@ -420,10 +420,13 @@
+ if (!traceLoggerState->isTextIdEnabled(type))
+ return getOrCreateEventPayload(type);
+
+- PointerHashMap::AddPtr p = pointerMap.lookupForAdd(ptr);
+- if (p) {
+- MOZ_ASSERT(p->value()->textId() < nextTextId); // Sanity check.
+- return p->value();
++ PointerHashMap::AddPtr p;
++ if (ptr) {
++ p = pointerMap.lookupForAdd(ptr);
++ if (p) {
++ MOZ_ASSERT(p->value()->textId() < nextTextId); // Sanity check.
++ return p->value();
++ }
+ }
+
+ // Compute the length of the string to create.
+@@ -455,14 +458,16 @@
+ return nullptr;
+ }
+
+- if (!pointerMap.add(p, ptr, payload))
+- return nullptr;
+-
+ if (graph.get())
+ graph->addTextId(textId, str);
+
+ nextTextId++;
+
++ if (ptr) {
++ if (!pointerMap.add(p, ptr, payload))
++ return nullptr;
++ }
++
+ return payload;
+ }
+
+@@ -477,7 +482,7 @@
+ TraceLoggerThread::getOrCreateEventPayload(TraceLoggerTextId type,
+ const JS::ReadOnlyCompileOptions& script)
+ {
+- return getOrCreateEventPayload(type, script.filename(), script.lineno, script.column, &script);
++ return getOrCreateEventPayload(type, script.filename(), script.lineno, script.column, nullptr);
+ }
+
+ void
+@@ -550,19 +555,42 @@
+ return;
+
+ MOZ_ASSERT(traceLoggerState);
+- if (!events.ensureSpaceBeforeAdd()) {
++ if (!events.hasSpaceForAdd(3)) {
+ uint64_t start = rdtsc() - traceLoggerState->startupTime;
+
+- if (graph.get())
+- graph->log(events);
++ if (!events.ensureSpaceBeforeAdd(3)) {
++ if (graph.get())
++ graph->log(events);
++
++ iteration_++;
++ events.clear();
++
++ // Remove the item in the pointerMap for which the payloads
++ // have no uses anymore
++ for (PointerHashMap::Enum e(pointerMap); !e.empty(); e.popFront()) {
++ if (e.front().value()->uses() != 0)
++ continue;
++
++ TextIdHashMap::Ptr p = textIdPayloads.lookup(e.front().value()->textId());
++ MOZ_ASSERT(p);
++ textIdPayloads.remove(p);
+
+- iteration_++;
+- events.clear();
++ e.removeFront();
++ }
++
++ // Free all payloads that have no uses anymore.
++ for (TextIdHashMap::Enum e(textIdPayloads); !e.empty(); e.popFront()) {
++ if (e.front().value()->uses() == 0) {
++ js_delete(e.front().value());
++ e.removeFront();
++ }
++ }
++ }
+
+ // Log the time it took to flush the events as being from the
+ // Tracelogger.
+ if (graph.get()) {
+- MOZ_ASSERT(events.capacity() > 2);
++ MOZ_ASSERT(events.capacity() - events.size() > 2);
+ EventEntry& entryStart = events.pushUninitialized();
+ entryStart.time = start;
+ entryStart.textId = TraceLogger_Internal;
+@@ -572,26 +600,6 @@
+ entryStop.textId = TraceLogger_Stop;
+ }
+
+- // Remove the item in the pointerMap for which the payloads
+- // have no uses anymore
+- for (PointerHashMap::Enum e(pointerMap); !e.empty(); e.popFront()) {
+- if (e.front().value()->uses() != 0)
+- continue;
+-
+- TextIdHashMap::Ptr p = textIdPayloads.lookup(e.front().value()->textId());
+- MOZ_ASSERT(p);
+- textIdPayloads.remove(p);
+-
+- e.removeFront();
+- }
+-
+- // Free all payloads that have no uses anymore.
+- for (TextIdHashMap::Enum e(textIdPayloads); !e.empty(); e.popFront()) {
+- if (e.front().value()->uses() == 0) {
+- js_delete(e.front().value());
+- e.removeFront();
+- }
+- }
+ }
+
+ uint64_t time = rdtsc() - traceLoggerState->startupTime;
+diff --git a/js/src/vm/TraceLogging.h b/js/src/vm/TraceLogging.h
+--- a/js/src/vm/TraceLogging.h
++++ b/js/src/vm/TraceLogging.h
+@@ -237,17 +237,17 @@ class TraceLoggerThread
+ // If still logging in the same iteration, there are no lost events.
+ if (lastIteration == iteration_) {
+ MOZ_ASSERT(lastSize <= events.size());
+ return false;
+ }
+
+ // If we are in a consecutive iteration we are only sure we didn't lose any events,
+ // when the lastSize equals the maximum size 'events' can get.
+- if (lastIteration == iteration_ - 1 && lastSize == CONTINUOUSSPACE_LIMIT)
++ if (lastIteration == iteration_ - 1 && lastSize == events.max_items())
+ return false;
+
+ return true;
+ }
+
+ const char* eventText(uint32_t id);
+ bool textIdIsScriptEvent(uint32_t id);
+
+diff --git a/js/src/vm/TraceLoggingTypes.h b/js/src/vm/TraceLoggingTypes.h
+--- a/js/src/vm/TraceLoggingTypes.h
++++ b/js/src/vm/TraceLoggingTypes.h
+@@ -127,25 +127,25 @@ inline bool
+ TLTextIdIsTreeEvent(uint32_t id)
+ {
+ // Everything between TraceLogger_Error and TraceLogger_LastTreeItem are tree events and
+ // atm also every custom event.
+ return (id > TraceLogger_Error && id < TraceLogger_LastTreeItem) ||
+ id >= TraceLogger_Last;
+ }
+
+-// The maximum amount of ram memory a continuous space structure can take (in bytes).
+-static const uint32_t CONTINUOUSSPACE_LIMIT = 200 * 1024 * 1024;
+-
+ template <class T>
+ class ContinuousSpace {
+ T* data_;
+ uint32_t size_;
+ uint32_t capacity_;
+
++ // The maximum amount of ram memory a continuous space structure can take (in bytes).
++ static const uint32_t LIMIT = 200 * 1024 * 1024;
++
+ public:
+ ContinuousSpace ()
+ : data_(nullptr)
+ { }
+
+ bool init() {
+ capacity_ = 64;
+ size_ = 0;
+@@ -157,16 +157,20 @@ class ContinuousSpace {
+ }
+
+ ~ContinuousSpace()
+ {
+ js_free(data_);
+ data_ = nullptr;
+ }
+
++ uint32_t max_items() {
++ return LIMIT / sizeof(T);
++ }
++
+ T* data() {
+ return data_;
+ }
+
+ uint32_t capacity() {
+ return capacity_;
+ }
+
+@@ -194,21 +198,24 @@ class ContinuousSpace {
+ }
+
+ bool ensureSpaceBeforeAdd(uint32_t count = 1) {
+ MOZ_ASSERT(data_);
+ if (hasSpaceForAdd(count))
+ return true;
+
+ uint32_t nCapacity = capacity_ * 2;
+- if (size_ + count > nCapacity || nCapacity * sizeof(T) > CONTINUOUSSPACE_LIMIT) {
++ if (size_ + count > nCapacity)
+ nCapacity = size_ + count;
+
++ if (nCapacity > max_items()) {
++ nCapacity = max_items();
++
+ // Limit the size of a continuous buffer.
+- if (nCapacity * sizeof(T) > CONTINUOUSSPACE_LIMIT)
++ if (size_ + count > nCapacity)
+ return false;
+ }
+
+ T* entries = (T*) js_realloc(data_, nCapacity * sizeof(T));
+ if (!entries)
+ return false;
+
+ data_ = entries;
diff --git a/patches/mozjs45-functions-visibility.patch b/patches/mozjs45-functions-visibility.patch
new file mode 100644
index 0000000..c73f817
--- /dev/null
+++ b/patches/mozjs45-functions-visibility.patch
@@ -0,0 +1,66 @@
+Some symbols that need to be public are not marked as such.
+
+--- a/js/public/CharacterEncoding.h 2017-03-22 18:06:39.633393242 +0000
++++ b/js/public/CharacterEncoding.h 2017-03-22 18:06:57.141741214 +0000
+@@ -187,7 +187,7 @@
+ * - On success, returns a malloc'd TwoByteCharsZ, and updates |outlen| to hold
+ * its length; the length value excludes the trailing null.
+ */
+-extern TwoByteCharsZ
++extern JS_PUBLIC_API(TwoByteCharsZ)
+ UTF8CharsToNewTwoByteCharsZ(JSContext* cx, const UTF8Chars utf8, size_t* outlen);
+
+ /*
+--- a/js/public/Utility.h 2017-03-20 06:15:15.283755975 +0000
++++ b/js/public/Utility.h 2017-03-20 06:16:06.528152239 +0000
+@@ -91,7 +91,7 @@
+ # if defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
+ extern bool InitThreadType(void);
+ extern void SetThreadType(ThreadType);
+-extern uint32_t GetThreadType(void);
++extern JS_FRIEND_API(uint32_t) GetThreadType(void);
+ # else
+ inline bool InitThreadType(void) { return true; }
+ inline void SetThreadType(ThreadType t) {};
+--- a/js/src/jsalloc.h 2017-03-29 18:22:18.902294948 -0700
++++ b/js/src/jsalloc.h 2017-03-29 18:23:36.694986602 -0700
+@@ -17,6 +17,8 @@
+ #include "js/TypeDecls.h"
+ #include "js/Utility.h"
+
++extern JS_PUBLIC_API(void) JS_ReportOutOfMemory(JSContext* cx);
++
+ namespace js {
+
+ enum class AllocFunction {
+@@ -130,7 +132,7 @@
+
+ bool checkSimulatedOOM() const {
+ if (js::oom::ShouldFailWithOOM()) {
+- js::ReportOutOfMemory(reinterpret_cast<ExclusiveContext*>(cx_));
++ JS_ReportOutOfMemory(reinterpret_cast<JSContext*>(cx_));
+ return false;
+ }
+
+--- a/js/src/jsapi.h 2017-03-20 06:27:47.265550528 +0000
++++ b/js/src/jsapi.h 2017-03-20 06:28:42.645975646 +0000
+@@ -2411,7 +2411,7 @@
+ {}
+
+ static void trace(JSPropertyDescriptor* self, JSTracer* trc) { self->trace(trc); }
+- void trace(JSTracer* trc);
++ JS_PUBLIC_API(void) trace(JSTracer* trc);
+ };
+
+ namespace JS {
+--- a/js/src/vm/CharacterEncoding.cpp 2017-03-22 18:03:40.209786639 +0000
++++ b/js/src/vm/CharacterEncoding.cpp 2017-03-22 18:03:48.717959359 +0000
+@@ -364,7 +364,7 @@
+ return TwoByteCharsZ(dst, *outlen);
+ }
+
+-TwoByteCharsZ
++JS_PUBLIC_API(TwoByteCharsZ)
+ JS::UTF8CharsToNewTwoByteCharsZ(JSContext* cx, const UTF8Chars utf8, size_t* outlen)
+ {
+ return InflateUTF8StringHelper(cx, utf8, InflateUTF8StringToBuffer<CountAndReportInvalids>,
diff --git a/patches/mozjs45-install-name.patch b/patches/mozjs45-install-name.patch
new file mode 100644
index 0000000..ed95849
--- /dev/null
+++ b/patches/mozjs45-install-name.patch
@@ -0,0 +1,14 @@
+Fixes the library's install_name for JHBuild on macOS. It has to be an absolute
+path due to JHBuild's LD_ environment variables getting clobbered.
+
+--- a/config/rules.mk 2017-03-17 20:15:12.531151950 -0700
++++ b/config/rules.mk 2017-03-17 20:15:36.995318002 -0700
+@@ -399,7 +399,7 @@
+ ifdef MOZ_IOS
+ _LOADER_PATH := @rpath
+ else
+-_LOADER_PATH := @executable_path
++_LOADER_PATH := $(abspath $(prefix))/lib
+ endif
+ EXTRA_DSO_LDOPTS += -dynamiclib -install_name $(_LOADER_PATH)/$(SHARED_LIBRARY) -compatibility_version
1 -current_version 1 -single_module
+ endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]