Bug 1338574 - Part 8: Use MOZ_ASSERT and MOZ_CRASH_UNSAFE_OOL in mozjemalloc. r=glandium, a=NPOTB
authorEmanuel Hoogeveen <emanuel.hoogeveen@gmail.com>
Tue, 21 Feb 2017 18:02:07 +0100
changeset 355809 5e85bc599d0c94f0ba792c9505081ba6486f7557
parent 355808 1d14abf37cf8cac38763f79c70742fac5a0fbb16
child 355810 68e0c0279f72f7fbd83c9a3aa11775dd2fa34679
push id7088
push userryanvm@gmail.com
push dateThu, 11 May 2017 21:13:08 +0000
treeherdermozilla-esr52@5e85bc599d0c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium, NPOTB
bugs1338574
milestone52.1.2
Bug 1338574 - Part 8: Use MOZ_ASSERT and MOZ_CRASH_UNSAFE_OOL in mozjemalloc. r=glandium, a=NPOTB
memory/mozjemalloc/jemalloc.c
--- a/memory/mozjemalloc/jemalloc.c
+++ b/memory/mozjemalloc/jemalloc.c
@@ -1591,55 +1591,38 @@ wrtmessage(const char *p1, const char *p
 	if (_write(STDERR_FILENO, p4, (unsigned int) strlen(p4)) < 0)
 		return;
 }
 
 MOZ_JEMALLOC_API
 void	(*_malloc_message)(const char *p1, const char *p2, const char *p3,
 	    const char *p4) = wrtmessage;
 
-#ifdef MALLOC_DEBUG
-#  define assert(e) do {						\
-	if (!(e)) {							\
-		char line_buf[UMAX2S_BUFSIZE];				\
-		_malloc_message(__FILE__, ":", umax2s(__LINE__, 10,	\
-		    line_buf), ": Failed assertion: ");			\
-		_malloc_message("\"", #e, "\"\n", "");			\
-		abort();						\
-	}								\
-} while (0)
-#else
-#define assert(e)
-#endif
-
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/TaggedAnonymousMemory.h"
 // Note: MozTaggedAnonymousMmap() could call an LD_PRELOADed mmap
 // instead of the one defined here; use only MozTagAnonymousMemory().
 
+#ifdef MALLOC_DEBUG
+#  define assert(e) MOZ_ASSERT(e)
+#else
+#  define assert(e)
+#endif
+
 #ifdef MOZ_MEMORY_ANDROID
 // Android's pthread.h does not declare pthread_atfork() until SDK 21.
 extern MOZ_EXPORT
 int pthread_atfork(void (*)(void), void (*)(void), void(*)(void));
 #endif
 
-/* RELEASE_ASSERT calls jemalloc_crash() instead of calling MOZ_CRASH()
- * directly because we want crashing to add a frame to the stack.  This makes
- * it easier to find the failing assertion in crash stacks. */
-MOZ_NEVER_INLINE static void
-jemalloc_crash()
-{
-	MOZ_CRASH();
-}
-
 #if defined(MOZ_JEMALLOC_HARD_ASSERTS)
 #  define RELEASE_ASSERT(assertion) do {	\
 	if (!(assertion)) {			\
-		jemalloc_crash();		\
+		MOZ_CRASH_UNSAFE_OOL(#assertion);	\
 	}					\
 } while (0)
 #else
 #  define RELEASE_ASSERT(assertion) assert(assertion)
 #endif
 
 /******************************************************************************/
 /*