summaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2013-12-11 22:24:18 +0000
committer <>2014-07-24 09:30:59 +0000
commit59e2936f588aa945e8dcd6c737523c299067e9d0 (patch)
tree97e74980cc54baa19de5faa11f5a50a0121a48ea /patches
downloadmozjs24-59e2936f588aa945e8dcd6c737523c299067e9d0.tar.gz
Imported from /home/lorry/working-area/delta_mozilla_mozjs24/mozjs-24.2.0.tar.bz2.HEADmozjs-24.2.0master
Diffstat (limited to 'patches')
-rw-r--r--patches/IsInRequest-949195.patch16
-rw-r--r--patches/JS_DEBUG.patch637
-rw-r--r--patches/disable-intl-api.patch16
-rw-r--r--patches/remove-vanilla-alloc.patch237
-rw-r--r--patches/series6
-rw-r--r--patches/shell-version.patch29
-rw-r--r--patches/strdup.patch37
7 files changed, 978 insertions, 0 deletions
diff --git a/patches/IsInRequest-949195.patch b/patches/IsInRequest-949195.patch
new file mode 100644
index 0000000..cdf5a4e
--- /dev/null
+++ b/patches/IsInRequest-949195.patch
@@ -0,0 +1,16 @@
+# HG changeset patch
+# Parent cd8909c56cccd12a576d731982a2b98be6fd1a96
+Bug 949195 - Only use IsInRequest when JS_DEBUG.
+
+diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h
+--- a/js/public/RootingAPI.h
++++ b/js/public/RootingAPI.h
+@@ -532,7 +532,7 @@ class MOZ_STACK_CLASS Rooted : public js
+ {
+ void init(JSContext *cxArg) {
+ MOZ_ASSERT(cxArg);
+-#ifdef JS_THREADSAFE
++#if defined(JS_DEBUG) && defined(JS_THREADSAFE)
+ MOZ_ASSERT(js::IsInRequest(cxArg));
+ #endif
+ #if defined(JSGC_ROOT_ANALYSIS) || defined(JSGC_USE_EXACT_ROOTING)
diff --git a/patches/JS_DEBUG.patch b/patches/JS_DEBUG.patch
new file mode 100644
index 0000000..b17cfe0
--- /dev/null
+++ b/patches/JS_DEBUG.patch
@@ -0,0 +1,637 @@
+From: Sean Stangl <sstangl@mozilla.com>
+Date: Fri, 6 Dec 2013 15:03:08 -0800
+
+Bug 939505 - Use JS_DEBUG in public headers [esr24].
+
+diff --git a/js/public/CallArgs.h b/js/public/CallArgs.h
+--- a/js/public/CallArgs.h
++++ b/js/public/CallArgs.h
+@@ -122,7 +122,7 @@ class MOZ_STACK_CLASS UsedRvalBase<NoUse
+
+ template<UsedRval WantUsedRval>
+ class MOZ_STACK_CLASS CallReceiverBase : public UsedRvalBase<
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ WantUsedRval
+ #else
+ NoUsedRval
+diff --git a/js/public/HashTable.h b/js/public/HashTable.h
+--- a/js/public/HashTable.h
++++ b/js/public/HashTable.h
+@@ -698,7 +698,7 @@ class HashTable : private AllocPolicy
+ public:
+ // Leaves Ptr uninitialized.
+ Ptr() {
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ entry_ = (Entry *)0xbad;
+ #endif
+ }
+@@ -856,7 +856,7 @@ class HashTable : private AllocPolicy
+ hashShift = sHashBits - sizeLog2;
+ }
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ mutable struct Stats
+ {
+ uint32_t searches; // total number of table searches
+diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h
+--- a/js/public/RootingAPI.h
++++ b/js/public/RootingAPI.h
+@@ -150,7 +150,7 @@ template <typename T> class MutableHandl
+ /* This is exposing internal state of the GC for inlining purposes. */
+ JS_FRIEND_API(bool) isGCEnabled();
+
+-#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
++#if defined(JS_DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
+ extern void
+ CheckStackRoots(JSContext *cx);
+ #endif
+@@ -509,7 +509,7 @@ struct GCMethods<T *>
+ #endif
+ };
+
+-#if defined(DEBUG) && defined(JS_THREADSAFE)
++#if defined(JS_DEBUG) && defined(JS_THREADSAFE)
+ /* This helper allows us to assert that Rooted<T> is scoped within a request. */
+ extern JS_PUBLIC_API(bool)
+ IsInRequest(JSContext *cx);
+@@ -654,7 +654,7 @@ class MOZ_STACK_CLASS Rooted : public js
+ Rooted<void*> **stack, *prev;
+ #endif
+
+-#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
++#if defined(JS_DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
+ /* Has the rooting analysis ever scanned this Rooted's stack location? */
+ friend void JS::CheckStackRoots(JSContext*);
+ bool scanned;
+@@ -698,7 +698,7 @@ namespace js {
+ */
+ class SkipRoot
+ {
+-#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
++#if defined(JS_DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
+
+ SkipRoot **stack, *prev;
+ const uint8_t *start;
+@@ -742,7 +742,7 @@ class SkipRoot
+ return v >= start && v + len <= end;
+ }
+
+-#else /* DEBUG && JSGC_ROOT_ANALYSIS */
++#else /* JS_DEBUG && JSGC_ROOT_ANALYSIS */
+
+ public:
+ template <typename T>
+@@ -759,7 +759,7 @@ class SkipRoot
+ MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+ }
+
+-#endif /* DEBUG && JSGC_ROOT_ANALYSIS */
++#endif /* JS_DEBUG && JSGC_ROOT_ANALYSIS */
+
+ MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+ };
+@@ -931,7 +931,7 @@ namespace js {
+ */
+ inline void MaybeCheckStackRoots(JSContext *cx)
+ {
+-#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
++#if defined(JS_DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
+ JS::CheckStackRoots(cx);
+ #endif
+ }
+diff --git a/js/public/Utility.h b/js/public/Utility.h
+--- a/js/public/Utility.h
++++ b/js/public/Utility.h
+@@ -45,7 +45,7 @@ namespace js {}
+ #define JS_ALWAYS_TRUE(expr) MOZ_ALWAYS_TRUE(expr)
+ #define JS_ALWAYS_FALSE(expr) MOZ_ALWAYS_FALSE(expr)
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ # ifdef JS_THREADSAFE
+ # define JS_THREADSAFE_ASSERT(expr) JS_ASSERT(expr)
+ # else
+@@ -55,7 +55,7 @@ namespace js {}
+ # define JS_THREADSAFE_ASSERT(expr) ((void) 0)
+ #endif
+
+-#if defined(DEBUG)
++#if defined(JS_DEBUG)
+ # define JS_DIAGNOSTICS_ASSERT(expr) MOZ_ASSERT(expr)
+ #elif defined(JS_CRASH_DIAGNOSTICS)
+ # define JS_DIAGNOSTICS_ASSERT(expr) do { if (!(expr)) MOZ_CRASH(); } while(0)
+@@ -82,7 +82,7 @@ extern JS_PUBLIC_API(void) JS_Abort(void
+ #if defined JS_USE_CUSTOM_ALLOCATOR
+ # include "jscustomallocator.h"
+ #else
+-# ifdef DEBUG
++# ifdef JS_DEBUG
+ /*
+ * In order to test OOM conditions, when the testing function
+ * oomAfterAllocations COUNT is passed, we fail continuously after the NUM'th
+@@ -146,7 +146,7 @@ PrintBacktrace()
+ # else
+ # define JS_OOM_POSSIBLY_FAIL() do {} while(0)
+ # define JS_OOM_POSSIBLY_FAIL_REPORT(cx) do {} while(0)
+-# endif /* DEBUG */
++# endif /* JS_DEBUG */
+
+ static JS_INLINE void* js_malloc(size_t bytes)
+ {
+@@ -697,26 +697,26 @@ class ReentrancyGuard
+ ReentrancyGuard(const ReentrancyGuard &);
+ void operator=(const ReentrancyGuard &);
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ bool &entered;
+ #endif
+ public:
+ template <class T>
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ ReentrancyGuard(T &obj)
+ : entered(obj.entered)
+ #else
+ ReentrancyGuard(T &/*obj*/)
+ #endif
+ {
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ JS_ASSERT(!entered);
+ entered = true;
+ #endif
+ }
+ ~ReentrancyGuard()
+ {
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ entered = false;
+ #endif
+ }
+@@ -803,7 +803,7 @@ namespace JS {
+
+ inline void PoisonPtr(void *v)
+ {
+-#if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG)
++#if defined(JSGC_ROOT_ANALYSIS) && defined(JS_DEBUG)
+ uint8_t *ptr = (uint8_t *) v + 3;
+ *ptr = JS_FREE_PATTERN;
+ #endif
+@@ -812,7 +812,7 @@ inline void PoisonPtr(void *v)
+ template <typename T>
+ inline bool IsPoisonedPtr(T *v)
+ {
+-#if defined(JSGC_ROOT_ANALYSIS) && defined(DEBUG)
++#if defined(JSGC_ROOT_ANALYSIS) && defined(JS_DEBUG)
+ uint32_t mask = uintptr_t(v) & 0xff000000;
+ return mask == uint32_t(JS_FREE_PATTERN << 24);
+ #else
+diff --git a/js/public/Value.h b/js/public/Value.h
+--- a/js/public/Value.h
++++ b/js/public/Value.h
+@@ -1649,7 +1649,7 @@ inline Anchor<Value>::~Anchor()
+ }
+ #endif
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ namespace detail {
+
+ struct ValueAlignmentTester { char c; JS::Value v; };
+@@ -1661,7 +1661,7 @@ MOZ_STATIC_ASSERT(sizeof(LayoutAlignment
+ "jsval_layout must be 16-byte-aligned");
+
+ } // namespace detail
+-#endif /* DEBUG */
++#endif /* JS_DEBUG */
+
+ } // namespace JS
+
+diff --git a/js/public/Vector.h b/js/public/Vector.h
+--- a/js/public/Vector.h
++++ b/js/public/Vector.h
+@@ -251,13 +251,13 @@ class Vector : private AllocPolicy
+ T *mBegin;
+ size_t mLength; /* Number of elements in the Vector. */
+ size_t mCapacity; /* Max number of elements storable in the Vector without resizing. */
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ size_t mReserved; /* Max elements of reserved or used space in this vector. */
+ #endif
+
+ mozilla::AlignedStorage<sInlineBytes> storage;
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ friend class ReentrancyGuard;
+ bool entered;
+ #endif
+@@ -287,7 +287,7 @@ class Vector : private AllocPolicy
+ return mBegin + mLength;
+ }
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ size_t reserved() const {
+ JS_ASSERT(mReserved <= mCapacity);
+ JS_ASSERT(mLength <= mReserved);
+@@ -530,7 +530,7 @@ JS_ALWAYS_INLINE
+ Vector<T,N,AllocPolicy>::Vector(AllocPolicy ap)
+ : AllocPolicy(ap), mBegin((T *)storage.addr()), mLength(0),
+ mCapacity(sInlineCapacity)
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ , mReserved(sInlineCapacity), entered(false)
+ #endif
+ {}
+@@ -540,13 +540,13 @@ template <class T, size_t N, class Alloc
+ JS_ALWAYS_INLINE
+ Vector<T, N, AllocPolicy>::Vector(MoveRef<Vector> rhs)
+ : AllocPolicy(rhs)
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ , entered(false)
+ #endif
+ {
+ mLength = rhs->mLength;
+ mCapacity = rhs->mCapacity;
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ mReserved = rhs->mReserved;
+ #endif
+
+@@ -567,7 +567,7 @@ Vector<T, N, AllocPolicy>::Vector(MoveRe
+ rhs->mBegin = (T *) rhs->storage.addr();
+ rhs->mCapacity = sInlineCapacity;
+ rhs->mLength = 0;
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ rhs->mReserved = sInlineCapacity;
+ #endif
+ }
+@@ -714,7 +714,7 @@ Vector<T,N,AP>::initCapacity(size_t requ
+ return false;
+ mBegin = newbuf;
+ mCapacity = request;
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ mReserved = request;
+ #endif
+ return true;
+@@ -728,7 +728,7 @@ Vector<T,N,AP>::reserve(size_t request)
+ if (request > mCapacity && !growStorageBy(request - mLength))
+ return false;
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ if (request > mReserved)
+ mReserved = request;
+ JS_ASSERT(mLength <= mReserved);
+@@ -761,7 +761,7 @@ Vector<T,N,AP>::growByImpl(size_t incr)
+ if (InitNewElems)
+ Impl::initialize(endNoCheck(), newend);
+ mLength += incr;
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ if (mLength > mReserved)
+ mReserved = mLength;
+ #endif
+@@ -826,7 +826,7 @@ Vector<T,N,AP>::clearAndFree()
+ this->free_(beginNoCheck());
+ mBegin = (T *)storage.addr();
+ mCapacity = sInlineCapacity;
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ mReserved = sInlineCapacity;
+ #endif
+ }
+@@ -847,7 +847,7 @@ Vector<T,N,AP>::append(U t)
+ if (mLength == mCapacity && !growStorageBy(1))
+ return false;
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ if (mLength + 1 > mReserved)
+ mReserved = mLength + 1;
+ #endif
+@@ -874,7 +874,7 @@ Vector<T,N,AP>::appendN(const T &t, size
+ if (mLength + needed > mCapacity && !growStorageBy(needed))
+ return false;
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ if (mLength + needed > mReserved)
+ mReserved = mLength + needed;
+ #endif
+@@ -936,7 +936,7 @@ Vector<T,N,AP>::append(const U *insBegin
+ if (mLength + needed > mCapacity && !growStorageBy(needed))
+ return false;
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ if (mLength + needed > mReserved)
+ mReserved = mLength + needed;
+ #endif
+@@ -1016,7 +1016,7 @@ Vector<T,N,AP>::extractRawBuffer()
+ mBegin = (T *)storage.addr();
+ mLength = 0;
+ mCapacity = sInlineCapacity;
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ mReserved = sInlineCapacity;
+ #endif
+ }
+@@ -1052,7 +1052,7 @@ Vector<T,N,AP>::replaceRawBuffer(T *p, s
+ mLength = aLength;
+ mCapacity = aLength;
+ }
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ mReserved = aLength;
+ #endif
+ }
+@@ -1093,7 +1093,7 @@ Vector<T,N,AP>::swap(Vector &other)
+
+ Swap(mLength, other.mLength);
+ Swap(mCapacity, other.mCapacity);
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ Swap(mReserved, other.mReserved);
+ #endif
+ }
+diff --git a/js/src/configure.in b/js/src/configure.in
+--- a/js/src/configure.in
++++ b/js/src/configure.in
+@@ -3727,6 +3727,13 @@ if test -n "$MOZ_VTUNE"; then
+ fi
+
+ dnl ========================================================
++dnl Debug (see Bug 939505)
++dnl ========================================================
++if test -n "$MOZ_DEBUG"; then
++ AC_DEFINE(JS_DEBUG)
++fi
++
++dnl ========================================================
+ dnl Profiling
+ dnl ========================================================
+ if test -n "$MOZ_PROFILING"; then
+diff --git a/js/src/js-config.h.in b/js/src/js-config.h.in
+--- a/js/src/js-config.h.in
++++ b/js/src/js-config.h.in
+@@ -12,6 +12,12 @@
+ This header file is generated by the SpiderMonkey configure script,
+ and installed along with jsapi.h. */
+
++/* Define to 1 if SpiderMonkey is in debug mode. */
++#undef JS_DEBUG
++
++/* Define to 1 if SpiderMonkey should not use struct types in debug builds. */
++#undef JS_NO_JSVAL_JSID_STRUCT_TYPES
++
+ /* Define to 1 if SpiderMonkey should support multi-threaded clients. */
+ #undef JS_THREADSAFE
+
+diff --git a/js/src/jsapi.h b/js/src/jsapi.h
+--- a/js/src/jsapi.h
++++ b/js/src/jsapi.h
+@@ -47,7 +47,7 @@ class StableCharPtr : public CharPtr {
+ {}
+ };
+
+-#if defined JS_THREADSAFE && defined DEBUG
++#if defined JS_THREADSAFE && defined JS_DEBUG
+
+ class JS_PUBLIC_API(AutoCheckRequestDepth)
+ {
+@@ -65,9 +65,9 @@ class JS_PUBLIC_API(AutoCheckRequestDept
+ # define CHECK_REQUEST(cx) \
+ ((void) 0)
+
+-#endif /* JS_THREADSAFE && DEBUG */
+-
+-#ifdef DEBUG
++#endif /* JS_THREADSAFE && JS_DEBUG */
++
++#ifdef JS_DEBUG
+ /*
+ * Assert that we're not doing GC on cx, that we're in a request as
+ * needed, and that the compartments for cx and v are correct.
+@@ -79,7 +79,7 @@ AssertArgumentsAreSane(JSContext *cx, co
+ inline void AssertArgumentsAreSane(JSContext *cx, const Value &v) {
+ /* Do nothing */
+ }
+-#endif /* DEBUG */
++#endif /* JS_DEBUG */
+
+ class JS_PUBLIC_API(AutoGCRooter) {
+ public:
+@@ -1830,7 +1830,7 @@ class JSAutoCheckRequest
+ JSAutoCheckRequest(JSContext *cx
+ MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+ {
+-#if defined JS_THREADSAFE && defined DEBUG
++#if defined JS_THREADSAFE && defined JS_DEBUG
+ mContext = cx;
+ JS_ASSERT(JS_IsInRequest(JS_GetRuntime(cx)));
+ #endif
+@@ -1838,14 +1838,14 @@ class JSAutoCheckRequest
+ }
+
+ ~JSAutoCheckRequest() {
+-#if defined JS_THREADSAFE && defined DEBUG
++#if defined JS_THREADSAFE && defined JS_DEBUG
+ JS_ASSERT(JS_IsInRequest(JS_GetRuntime(mContext)));
+ #endif
+ }
+
+
+ private:
+-#if defined JS_THREADSAFE && defined DEBUG
++#if defined JS_THREADSAFE && defined JS_DEBUG
+ JSContext *mContext;
+ #endif
+ MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+@@ -2592,10 +2592,10 @@ JS_GetTraceThingInfo(char *buf, size_t b
+ extern JS_PUBLIC_API(const char *)
+ JS_GetTraceEdgeName(JSTracer *trc, char *buffer, int bufferSize);
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+
+ /*
+- * DEBUG-only method to dump the object graph of heap-allocated things.
++ * Debug-only method to dump the object graph of heap-allocated things.
+ *
+ * fp: file for the dump output.
+ * start: when non-null, dump only things reachable from start
+@@ -3733,13 +3733,13 @@ struct JSPrincipals {
+ /* Don't call "destroy"; use reference counting macros below. */
+ int refcount;
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ /* A helper to facilitate principals debugging. */
+ uint32_t debugToken;
+ #endif
+
+ void setDebugToken(uint32_t token) {
+-# ifdef DEBUG
++# ifdef JS_DEBUG
+ debugToken = token;
+ # endif
+ }
+@@ -5026,7 +5026,7 @@ class JSAutoSetRuntimeThread
+ static JS_ALWAYS_INLINE JSBool
+ JS_IsConstructing(JSContext *cx, const jsval *vp)
+ {
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ JSObject *callee = JSVAL_TO_OBJECT(JS_CALLEE(cx, vp));
+ if (JS_ObjectIsFunction(cx, callee)) {
+ JSFunction *fun = JS_ValueToFunction(cx, JS_CALLEE(cx, vp));
+diff --git a/js/src/jsdbgapi.h b/js/src/jsdbgapi.h
+--- a/js/src/jsdbgapi.h
++++ b/js/src/jsdbgapi.h
+@@ -39,7 +39,7 @@ FormatStackDump(JSContext *cx, char *buf
+
+ }
+
+-# ifdef DEBUG
++# ifdef JS_DEBUG
+ JS_FRIEND_API(void) js_DumpValue(const js::Value &val);
+ JS_FRIEND_API(void) js_DumpId(jsid id);
+ JS_FRIEND_API(void) js_DumpStackFrame(JSContext *cx, js::StackFrame *start = NULL);
+diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h
+--- a/js/src/jsfriendapi.h
++++ b/js/src/jsfriendapi.h
+@@ -137,7 +137,7 @@ js_ObjectClassIs(JSContext *cx, JS::Hand
+ JS_FRIEND_API(const char *)
+ js_ObjectClassName(JSContext *cx, JS::HandleObject obj);
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+
+ /*
+ * Routines to print out values during debugging. These are FRIEND_API to help
+@@ -824,7 +824,7 @@ CastToJSFreeOp(FreeOp *fop)
+ extern JS_FRIEND_API(const jschar*)
+ GetErrorTypeName(JSContext* cx, int16_t exnType);
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ extern JS_FRIEND_API(unsigned)
+ GetEnterCompartmentDepth(JSContext* cx);
+ #endif
+@@ -1725,7 +1725,7 @@ class JS_FRIEND_API(AutoCTypesActivityCa
+ }
+ };
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ extern JS_FRIEND_API(void)
+ assertEnteredPolicy(JSContext *cx, JSObject *obj, jsid id);
+ #else
+diff --git a/js/src/jsproxy.h b/js/src/jsproxy.h
+--- a/js/src/jsproxy.h
++++ b/js/src/jsproxy.h
+@@ -358,7 +358,7 @@ class JS_FRIEND_API(AutoEnterPolicy)
+ typedef BaseProxyHandler::Action Action;
+ AutoEnterPolicy(JSContext *cx, BaseProxyHandler *handler,
+ HandleObject wrapper, HandleId id, Action act, bool mayThrow)
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ : context(NULL)
+ #endif
+ {
+@@ -381,7 +381,7 @@ class JS_FRIEND_API(AutoEnterPolicy)
+ protected:
+ // no-op constructor for subclass
+ AutoEnterPolicy()
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ : context(NULL)
+ #endif
+ {};
+@@ -389,7 +389,7 @@ class JS_FRIEND_API(AutoEnterPolicy)
+ bool allow;
+ bool rv;
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ JSContext *context;
+ mozilla::Maybe<HandleObject> enteredProxy;
+ mozilla::Maybe<HandleId> enteredId;
+@@ -408,7 +408,7 @@ class JS_FRIEND_API(AutoEnterPolicy)
+
+ };
+
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ class JS_FRIEND_API(AutoWaivePolicy) : public AutoEnterPolicy {
+ public:
+ AutoWaivePolicy(JSContext *cx, HandleObject proxy, HandleId id)
+diff --git a/js/src/jspubtd.h b/js/src/jspubtd.h
+--- a/js/src/jspubtd.h
++++ b/js/src/jspubtd.h
+@@ -44,7 +44,7 @@ struct Zone;
+ * oblivious to the change. This feature can be explicitly disabled in debug
+ * builds by defining JS_NO_JSVAL_JSID_STRUCT_TYPES.
+ */
+-# if defined(DEBUG) && !defined(JS_NO_JSVAL_JSID_STRUCT_TYPES)
++# if defined(JS_DEBUG) && !defined(JS_NO_JSVAL_JSID_STRUCT_TYPES)
+ # define JS_USE_JSID_STRUCT_TYPES
+ # endif
+
+@@ -304,7 +304,7 @@ struct ContextFriendFields
+ JS::Rooted<void*> *thingGCRooters[THING_ROOT_LIMIT];
+ #endif
+
+-#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
++#if defined(JS_DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
+ /*
+ * Stack allocated list of stack locations which hold non-relocatable
+ * GC heap pointers (where the target is rooted somewhere else) or integer
+@@ -334,7 +334,7 @@ struct PerThreadDataFriendFields
+ struct PerThreadDummy {
+ void *field1;
+ uintptr_t field2;
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ uint64_t field3;
+ #endif
+ } mainThread;
+@@ -352,7 +352,7 @@ struct PerThreadDataFriendFields
+ JS::Rooted<void*> *thingGCRooters[THING_ROOT_LIMIT];
+ #endif
+
+-#if defined(DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
++#if defined(JS_DEBUG) && defined(JS_GC_ZEAL) && defined(JSGC_ROOT_ANALYSIS) && !defined(JS_THREADSAFE)
+ /*
+ * Stack allocated list of stack locations which hold non-relocatable
+ * GC heap pointers (where the target is rooted somewhere else) or integer
+diff --git a/js/src/jsutil.h b/js/src/jsutil.h
+--- a/js/src/jsutil.h
++++ b/js/src/jsutil.h
+@@ -302,7 +302,7 @@ bool DecompressString(const unsigned cha
+ } /* namespace js */
+
+ /* Crash diagnostics */
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ # define JS_CRASH_DIAGNOSTICS 1
+ #endif
+ #ifdef JS_CRASH_DIAGNOSTICS
+@@ -312,7 +312,7 @@ bool DecompressString(const unsigned cha
+ #endif
+
+ /* Basic stats */
+-#ifdef DEBUG
++#ifdef JS_DEBUG
+ # define JS_BASIC_STATS 1
+ #endif
+ #ifdef JS_BASIC_STATS
diff --git a/patches/disable-intl-api.patch b/patches/disable-intl-api.patch
new file mode 100644
index 0000000..d92435f
--- /dev/null
+++ b/patches/disable-intl-api.patch
@@ -0,0 +1,16 @@
+# HG changeset patch
+# Parent 22fb8d1ae29a528ee415b77c5969655ab0588bcb
+Disable internationalization API by default.
+
+diff --git a/js/src/configure.in b/js/src/configure.in
+--- a/js/src/configure.in
++++ b/js/src/configure.in
+@@ -4419,7 +4419,7 @@ dnl ECMAScript Internationalization API
+ dnl ========================================================
+
+ if test -n "$JS_STANDALONE"; then
+- ENABLE_INTL_API=1
++ ENABLE_INTL_API=
+ fi
+ MOZ_ARG_ENABLE_BOOL(intl-api,
+ [ --enable-intl-api Enable ECMAScript Internationalization API (default=yes for standalone JS)],
diff --git a/patches/remove-vanilla-alloc.patch b/patches/remove-vanilla-alloc.patch
new file mode 100644
index 0000000..b7aafc8
--- /dev/null
+++ b/patches/remove-vanilla-alloc.patch
@@ -0,0 +1,237 @@
+# HG changeset patch
+# User Nicholas Nethercote <nnethercote@mozilla.com>
+# Date 1383798497 -39600
+# Thu Nov 07 15:28:17 2013 +1100
+# Node ID fcfdc49d52489b12a4e724ce52b2009ff32d8bc0
+# Parent 8aa6d9c79371db8e92214025cbfa5f116a607c07
+Bug 634417 - Remove inappropriate uses of vanilla malloc/calloc/realloc/free/strdup from SpiderMonkey.
+
+diff --git a/js/public/Utility.h b/js/public/Utility.h
+--- a/js/public/Utility.h
++++ b/js/public/Utility.h
+@@ -110,6 +110,8 @@ PrintBacktrace()
+ fprintf(stderr, "#%d %s\n", OOM_traceIdx, OOM_traceSymbols[OOM_traceIdx]);
+ }
+
++ // This must be free(), not js_free(), because backtrace_symbols()
++ // allocates with malloc().
+ free(OOM_traceSymbols);
+ }
+
+diff --git a/js/src/TraceLogging.cpp b/js/src/TraceLogging.cpp
+--- a/js/src/TraceLogging.cpp
++++ b/js/src/TraceLogging.cpp
+@@ -104,7 +104,7 @@ TraceLogging::~TraceLogging()
+
+ if (entries != NULL) {
+ flush();
+- free(entries);
++ js_free(entries);
+ entries = NULL;
+ }
+ }
+@@ -112,7 +112,7 @@ TraceLogging::~TraceLogging()
+ void
+ TraceLogging::grow()
+ {
+- Entry* nentries = (Entry*) realloc(entries, numEntries*2*sizeof(Entry));
++ Entry* nentries = (Entry*) js_realloc(entries, numEntries*2*sizeof(Entry));
+
+ // Allocating a bigger array failed.
+ // Keep using the current storage, but remove all entries by flushing them.
+@@ -132,7 +132,7 @@ TraceLogging::log(Type type, const char*
+
+ // Create array containing the entries if not existing.
+ if (entries == NULL) {
+- entries = (Entry*) malloc(numEntries*sizeof(Entry));
++ entries = (Entry*) js_malloc(numEntries*sizeof(Entry));
+ if (entries == NULL)
+ return;
+ }
+@@ -214,7 +214,7 @@ TraceLogging::flush()
+ }
+
+ if (entries[i].file() != NULL) {
+- free(entries[i].file());
++ js_free(entries[i].file());
+ entries[i].file_ = NULL;
+ }
+ }
+diff --git a/js/src/assembler/assembler/AssemblerBuffer.h b/js/src/assembler/assembler/AssemblerBuffer.h
+--- a/js/src/assembler/assembler/AssemblerBuffer.h
++++ b/js/src/assembler/assembler/AssemblerBuffer.h
+@@ -73,7 +73,7 @@ namespace JSC {
+ ~AssemblerBuffer()
+ {
+ if (m_buffer != m_inlineBuffer)
+- free(m_buffer);
++ js_free(m_buffer);
+ }
+
+ void ensureSpace(int space)
+@@ -225,7 +225,7 @@ namespace JSC {
+ }
+
+ if (m_buffer == m_inlineBuffer) {
+- newBuffer = static_cast<char*>(malloc(newCapacity));
++ newBuffer = static_cast<char*>(js_malloc(newCapacity));
+ if (!newBuffer) {
+ m_size = 0;
+ m_oom = true;
+@@ -233,7 +233,7 @@ namespace JSC {
+ }
+ memcpy(newBuffer, m_buffer, m_size);
+ } else {
+- newBuffer = static_cast<char*>(realloc(m_buffer, newCapacity));
++ newBuffer = static_cast<char*>(js_realloc(m_buffer, newCapacity));
+ if (!newBuffer) {
+ m_size = 0;
+ m_oom = true;
+diff --git a/js/src/assembler/assembler/AssemblerBufferWithConstantPool.h b/js/src/assembler/assembler/AssemblerBufferWithConstantPool.h
+--- a/js/src/assembler/assembler/AssemblerBufferWithConstantPool.h
++++ b/js/src/assembler/assembler/AssemblerBufferWithConstantPool.h
+@@ -106,14 +106,14 @@ public:
+ , m_lastConstDelta(0)
+ , m_flushCount(0)
+ {
+- m_pool = static_cast<uint32_t*>(malloc(maxPoolSize));
+- m_mask = static_cast<char*>(malloc(maxPoolSize / sizeof(uint32_t)));
++ m_pool = static_cast<uint32_t*>(js_malloc(maxPoolSize));
++ m_mask = static_cast<char*>(js_malloc(maxPoolSize / sizeof(uint32_t)));
+ }
+
+ ~AssemblerBufferWithConstantPool()
+ {
+- free(m_mask);
+- free(m_pool);
++ js_free(m_mask);
++ js_free(m_pool);
+ }
+
+ void ensureSpace(int space)
+diff --git a/js/src/builtin/Profilers.cpp b/js/src/builtin/Profilers.cpp
+--- a/js/src/builtin/Profilers.cpp
++++ b/js/src/builtin/Profilers.cpp
+@@ -498,10 +498,15 @@ JSBool js_StartPerf()
+ flags = "--call-graph";
+ }
+
+- // Split |flags| on spaces. (Don't bother to free it -- we're going to
++ char *flags2 = (char *)js_malloc(strlen(flags) + 1);
++ if (!flags2)
++ return false;
++ strcpy(flags2, flags);
++
++ // Split |flags2| on spaces. (Don't bother to free it -- we're going to
+ // exec anyway.)
+ char *toksave;
+- char *tok = strtok_r(strdup(flags), " ", &toksave);
++ char *tok = strtok_r(flags2, " ", &toksave);
+ while (tok) {
+ args.append(tok);
+ tok = strtok_r(NULL, " ", &toksave);
+diff --git a/js/src/jit/AsmJS.cpp b/js/src/jit/AsmJS.cpp
+--- a/js/src/jit/AsmJS.cpp
++++ b/js/src/jit/AsmJS.cpp
+@@ -1172,7 +1172,7 @@ class MOZ_STACK_CLASS ModuleCompiler
+ JS_ASSERT(str);
+ JS_ASSERT(pn);
+ errorNode_ = pn;
+- errorString_ = strdup(str);
++ errorString_ = js_strdup(cx_, str);
+ return false;
+ }
+
+diff --git a/js/src/jit/MIR.cpp b/js/src/jit/MIR.cpp
+--- a/js/src/jit/MIR.cpp
++++ b/js/src/jit/MIR.cpp
+@@ -642,7 +642,7 @@ MPhi::reserveLength(size_t length)
+ {
+ // Initializes a new MPhi to have an Operand vector of at least the given
+ // capacity. This permits use of addInput() instead of addInputSlow(), the
+- // latter of which may call realloc().
++ // latter of which may call realloc_().
+ JS_ASSERT(numOperands() == 0);
+ #if DEBUG
+ capacity_ = length;
+@@ -788,7 +788,7 @@ MPhi::addInputSlow(MDefinition *ins, boo
+ uint32_t index = inputs_.length();
+ bool performingRealloc = !inputs_.canAppendWithoutRealloc(1);
+
+- // Remove all MUses from all use lists, in case realloc() moves.
++ // Remove all MUses from all use lists, in case realloc_() moves.
+ if (performingRealloc) {
+ for (uint32_t i = 0; i < index; i++) {
+ MUse *use = &inputs_[i];
+diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h
+--- a/js/src/jit/MIR.h
++++ b/js/src/jit/MIR.h
+@@ -3677,7 +3677,7 @@ class MPhi : public MDefinition, public
+ // Use only if capacity has been reserved by reserveLength
+ void addInput(MDefinition *ins);
+
+- // Appends a new input to the input vector. May call realloc().
++ // Appends a new input to the input vector. May call realloc_().
+ // Prefer reserveLength() and addInput() instead, where possible.
+ bool addInputSlow(MDefinition *ins, bool *ptypeChange = NULL);
+
+diff --git a/js/src/jsprf.cpp b/js/src/jsprf.cpp
+--- a/js/src/jsprf.cpp
++++ b/js/src/jsprf.cpp
+@@ -368,7 +368,7 @@ cvt_ws(SprintfState *ss, const jschar *w
+ int result;
+ /*
+ * Supply NULL as the JSContext; errors are not reported,
+- * and malloc() is used to allocate the buffer buffer.
++ * and js_malloc() is used to allocate the buffer buffer.
+ */
+ if (ws) {
+ size_t wslen = js_strlen(ws);
+@@ -443,7 +443,7 @@ static struct NumArgState* BuildArgArray
+
+
+ if( number > NAS_DEFAULT_NUM ){
+- nas = (struct NumArgState*)malloc( number * sizeof( struct NumArgState ) );
++ nas = (struct NumArgState*)js_malloc( number * sizeof( struct NumArgState ) );
+ if( !nas ){
+ *rv = -1;
+ return NULL;
+@@ -1038,7 +1038,7 @@ JS_PUBLIC_API(uint32_t) JS_vsxprintf(JSS
+ }
+
+ /*
+-** Stuff routine that automatically grows the malloc'd output buffer
++** Stuff routine that automatically grows the js_malloc'd output buffer
+ ** before it overflows.
+ */
+ static int GrowStuff(SprintfState *ss, const char *sp, uint32_t len)
+@@ -1075,7 +1075,7 @@ static int GrowStuff(SprintfState *ss, c
+ }
+
+ /*
+-** sprintf into a malloc'd buffer
++** sprintf into a js_malloc'd buffer
+ */
+ JS_PUBLIC_API(char *) JS_smprintf(const char *fmt, ...)
+ {
+diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp
+--- a/js/src/shell/js.cpp
++++ b/js/src/shell/js.cpp
+@@ -284,7 +284,7 @@ GetLine(FILE *file, const char * prompt)
+ }
+ if (len + 1 == size) {
+ size = size * 2;
+- char *tmp = (char *) realloc(buffer, size);
++ char *tmp = (char *) js_realloc(buffer, size);
+ if (!tmp) {
+ free(buffer);
+ return NULL;
+@@ -329,7 +329,7 @@ NewContextData()
+ return NULL;
+
+ JSShellContextData *data = (JSShellContextData *)
+- calloc(sizeof(JSShellContextData), 1);
++ js_calloc(sizeof(JSShellContextData), 1);
+ if (!data)
+ return NULL;
+ data->startTime = PRMJ_Now();
diff --git a/patches/series b/patches/series
new file mode 100644
index 0000000..0d98219
--- /dev/null
+++ b/patches/series
@@ -0,0 +1,6 @@
+disable-intl-api.patch
+shell-version.patch
+strdup.patch
+remove-vanilla-alloc.patch
+JS_DEBUG.patch
+IsInRequest-949195.patch
diff --git a/patches/shell-version.patch b/patches/shell-version.patch
new file mode 100644
index 0000000..04cbe26
--- /dev/null
+++ b/patches/shell-version.patch
@@ -0,0 +1,29 @@
+# HG changeset patch
+# Parent 4732a0e5d22bc7e5c1f1ace7a182d537d9cc2c6a
+Add major version to shell and js-config filenames.
+
+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 --git a/patches/strdup.patch b/patches/strdup.patch
new file mode 100644
index 0000000..2343ef3
--- /dev/null
+++ b/patches/strdup.patch
@@ -0,0 +1,37 @@
+# HG changeset patch
+# Parent aae86c76643fd282c5e42c5bf784ccee2dc877a8
+Backport js_strdup().
+
+diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp
+--- a/js/src/jscntxt.cpp
++++ b/js/src/jscntxt.cpp
+@@ -709,6 +709,16 @@ js::PrintError(JSContext *cx, FILE *file
+ return true;
+ }
+
++char *
++js_strdup(JSContext *cx, const char *s)
++{
++ size_t n = strlen(s) + 1;
++ void *p = cx->malloc_(n);
++ if (!p)
++ return NULL;
++ return (char *)js_memcpy(p, s, n);
++}
++
+ /*
+ * The arguments from ap need to be packaged up into an array and stored
+ * into the report struct.
+diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h
+--- a/js/src/jscntxt.h
++++ b/js/src/jscntxt.h
+@@ -2221,6 +2221,9 @@ js_ReportValueErrorFlags(JSContext *cx,
+
+ extern const JSErrorFormatString js_ErrorFormatString[JSErr_Limit];
+
++char *
++js_strdup(JSContext *cx, const char *s);
++
+ #ifdef JS_THREADSAFE
+ # define JS_ASSERT_REQUEST_DEPTH(cx) JS_ASSERT((cx)->runtime()->requestDepth >= 1)
+ #else