--- /dev/null
+--- 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:
--- /dev/null
+Add major version to pkg-config filename.
+Author: Rico Tzschichholz <ricotz@ubuntu.com>
+Forwarded: no
+Last-Update: 2015-05-04
+
+Index: b/js/src/Makefile.in
+===================================================================
+--- a/js/src/Makefile.in
++++ b/js/src/Makefile.in
+@@ -214,10 +214,10 @@
+ $(JS_CONFIG_NAME): js-config
+ cp $^ $@
+
+-$(LIBRARY_NAME).pc: js.pc
++$(JS_LIBRARY_NAME).pc: js.pc
+ cp $^ $@
+
+-install:: $(LIBRARY_NAME).pc
++install:: $(JS_LIBRARY_NAME).pc
+ $(SYSINSTALL) $^ $(DESTDIR)$(libdir)/pkgconfig
+
+ install:: js-config.h
--- /dev/null
+# HG changeset patch
+# Parent 4732a0e5d22bc7e5c1f1ace7a182d537d9cc2c6a
+Add major version to shell and js-config filenames.
+Author: Rico Tzschichholz <ricotz@ubuntu.com>
+Forwarded: no
+Last-Update: 2014-10-29
+
+---
+diff --git a/js/src/configure b/js/src/configure
+--- a/js/src/configure
++++ b/js/src/configure
+@@ -1696,8 +1696,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
+
+diff --git a/js/src/configure.in b/js/src/configure.in
+--- a/js/src/configure.in
++++ b/js/src/configure.in
+@@ -234,16 +234,13 @@ MOZJS_MINOR_VERSION=`echo $MOZILLA_VERSI
+ 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
+
+diff -r 80a9e64d75f5 js/src/Makefile.in
+--- a/js/src/Makefile.in Wed Jun 25 15:11:42 2014 +0200
++++ b/js/src/Makefile.in Sat Jul 05 14:08:38 2014 +0200
+@@ -273,6 +273,9 @@
+ SCRIPTS = $(JS_CONFIG_NAME)
+ SDK_BINARY = $(JS_CONFIG_NAME)
+
++$(JS_CONFIG_NAME): js-config
++ cp $^ $@
++
+ $(LIBRARY_NAME).pc: js.pc
+ cp $^ $@
+
--- /dev/null
+Summary: SpiderMonkey 38 - JavaScript implementation
+Summary(pl.UTF-8): SpiderMonkey 38 - implementacja języka JavaScript
+Name: mozjs38
+Version: 38.8.0
+Release: 1
+License: MPL v2.0
+Group: Libraries
+Source0: https://ftp.mozilla.org/pub/firefox/releases/%{version}esr/source/firefox-%{version}esr.source.tar.bz2
+# Source0-md5: af46898414a433f8260c5373efb97d19
+Patch0: %{name}-shell-version.patch
+Patch1: %{name}-pkg-config-version.patch
+Patch2: %{name}-1269317.patch
+URL: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Releases/38
+BuildRequires: libffi-devel >= 3.0.9
+BuildRequires: libffi-devel >= 5:3.0.9
+BuildRequires: libstdc++-devel
+BuildRequires: libstdc++-devel >= 6:4.4
+BuildRequires: nspr-devel >= 4.9.2
+BuildRequires: perl-base >= 1:5.6
+BuildRequires: pkgconfig
+BuildRequires: python >= 1:2.5
+BuildRequires: python-virtualenv >= 1.9.1-4
+BuildRequires: readline-devel
+BuildRequires: rpm-perlprov
+BuildRequires: rpmbuild(macros) >= 1.294
+BuildRequires: zlib-devel >= 1.2.3
+Requires: nspr >= 4.9.2
+Requires: zlib >= 1.2.3
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+JavaScript Reference Implementation (codename SpiderMonkey). The
+package contains JavaScript runtime (compiler, interpreter,
+decompiler, garbage collector, atom manager, standard classes) and
+small "shell" program that can be used interactively and with .js
+files to run scripts.
+
+%description -l pl.UTF-8
+Wzorcowa implementacja JavaScriptu (o nazwie kodowej SpiderMonkey).
+Pakiet zawiera środowisko uruchomieniowe (kompilator, interpreter,
+dekompilator, odśmiecacz, standardowe klasy) i niewielką powłokę,
+która może być używana interaktywnie lub z plikami .js do uruchamiania
+skryptów.
+
+%package devel
+Summary: Header files for JavaScript reference library
+Summary(pl.UTF-8): Pliki nagłówkowe do biblioteki JavaScript
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: libstdc++-devel
+Requires: nspr-devel >= 4.9.2
+
+%description devel
+Header files for JavaScript reference library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe do biblioteki JavaScript.
+
+%prep
+%setup -q -n mozilla-esr38
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1
+
+cd js/src
+
+# Correct sed expression for new sed
+sed -i 's|\^\[:space:\]|^\[\[:space:\]\]|g' configure
+
+%build
+export PYTHON="%{__python}"
+cd js/src
+%configure2_13 \
+ --enable-readline \
+ --enable-system-ffi \
+ --enable-threadsafe \
+ --enable-shared-js \
+ --enable-gcgenerational \
+ --with-system-nspr \
+ --with-system-icu \
+ --with-system-zlib \
+ --with-intl-api
+
+%{__make} \
+ HOST_OPTIMIZE_FLAGS= \
+ MODULE_OPTIMIZE_FLAGS= \
+ MOZ_OPTIMIZE_FLAGS="-freorder-blocks" \
+ MOZ_PGO_OPTIMIZE_FLAGS= \
+ MOZILLA_VERSION=%{version}
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} -C js/src install \
+ DESTDIR=$RPM_BUILD_ROOT \
+ MOZILLA_VERSION=%{version}
+
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/*.ajs
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post -p /sbin/ldconfig
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc js/src/README.html
+%attr(755,root,root) %{_bindir}/js38
+%attr(755,root,root) %{_libdir}/libmozjs-38.so
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/js38-config
+%{_includedir}/mozjs-38
+%{_pkgconfigdir}/mozjs-38.pc