Bug 1446466 Remove Nightly-only restriction on jemalloc arena implementation r?glandium draft
authorTom Ritter <tom@mozilla.com>
Wed, 21 Mar 2018 20:53:46 -0500
changeset 773274 1695039d5ff8d49ef93c8aaa2e6e6637b0e524f6
parent 773273 0d3c70995ea3f547ee12c80066f11ea6f9854007
push id104197
push userbmo:tom@mozilla.com
push dateTue, 27 Mar 2018 19:17:59 +0000
reviewersglandium
bugs1446466
milestone61.0a1
Bug 1446466 Remove Nightly-only restriction on jemalloc arena implementation r?glandium MozReview-Commit-ID: CC2cftngmli
memory/build/mozjemalloc.cpp
memory/gtest/TestJemalloc.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -4544,17 +4544,16 @@ ArenaCollection::GetById(arena_id_t aAre
   mozilla::AlignedStorage2<arena_t> key;
   key.addr()->mId = aArenaId;
   MutexAutoLock lock(mLock);
   arena_t* result = (aIsPrivate ? mPrivateArenas : mArenas).Search(key.addr());
   MOZ_RELEASE_ASSERT(result);
   return result;
 }
 
-#ifdef NIGHTLY_BUILD
 template<>
 inline arena_id_t
 MozJemalloc::moz_create_arena_with_params(arena_params_t* aParams)
 {
   if (malloc_init()) {
     arena_t* arena = gArenas.CreateArena(/* IsPrivate = */ true, aParams);
     return arena->mId;
   }
@@ -4581,30 +4580,16 @@ MozJemalloc::moz_dispose_arena(arena_id_
   {                                                                            \
     BaseAllocator allocator(                                                   \
       gArenas.GetById(aArenaId, /* IsPrivate = */ true));                      \
     return allocator.name(ARGS_HELPER(ARGS, ##__VA_ARGS__));                   \
   }
 #define MALLOC_FUNCS MALLOC_FUNCS_MALLOC_BASE
 #include "malloc_decls.h"
 
-#else
-
-#define MALLOC_DECL(name, return_type, ...)                                    \
-  template<>                                                                   \
-  inline return_type MozJemalloc::name(ARGS_HELPER(TYPED_ARGS, ##__VA_ARGS__)) \
-  {                                                                            \
-    return DummyArenaAllocator<MozJemalloc>::name(                             \
-      ARGS_HELPER(ARGS, ##__VA_ARGS__));                                       \
-  }
-#define MALLOC_FUNCS MALLOC_FUNCS_ARENA
-#include "malloc_decls.h"
-
-#endif
-
 // End non-standard functions.
 // ***************************************************************************
 // Begin library-private functions, used by threading libraries for protection
 // of malloc during fork().  These functions are only called if the program is
 // running in threaded mode, so there is no need to check whether the program
 // is threaded here.
 #ifndef XP_DARWIN
 static
--- a/memory/gtest/TestJemalloc.cpp
+++ b/memory/gtest/TestJemalloc.cpp
@@ -11,17 +11,16 @@
 #include "nsCOMPtr.h"
 #include "nsICrashReporter.h"
 #include "nsServiceManagerUtils.h"
 #include "Utils.h"
 
 #include "gtest/gtest.h"
 
 
-#ifdef NIGHTLY_BUILD
 #if defined(DEBUG) && !defined(XP_WIN) && !defined(ANDROID)
 #define HAS_GDB_SLEEP_DURATION 1
 extern unsigned int _gdb_sleep_duration;
 #endif
 
 // Death tests are too slow on OSX because of the system crash reporter.
 #ifndef XP_DARWIN
 static void DisableCrashReporter()
@@ -36,17 +35,17 @@ static void DisableCrashReporter()
 // Wrap ASSERT_DEATH_IF_SUPPORTED to disable the crash reporter
 // when entering the subprocess, so that the expected crashes don't
 // create a minidump that the gtest harness will interpret as an error.
 #define ASSERT_DEATH_WRAP(a, b) \
   ASSERT_DEATH_IF_SUPPORTED({ DisableCrashReporter(); a; }, b)
 #else
 #define ASSERT_DEATH_WRAP(a, b)
 #endif
-#endif
+
 
 using namespace mozilla;
 
 static inline void
 TestOne(size_t size)
 {
   size_t req = size;
   size_t adv = malloc_good_size(req);
@@ -250,17 +249,16 @@ TEST(Jemalloc, PtrInfo)
   // these addresses; this is more about checking that we don't crash.
   for (size_t i = 0; i < stats.chunksize; i += 256) {
     jemalloc_ptr_info(&chunk[i], &info);
   }
 
   jemalloc_thread_local_arena(false);
 }
 
-#ifdef NIGHTLY_BUILD
 size_t sSizes[] = { 1,      42,      79,      918,     1.5_KiB,
                     73_KiB, 129_KiB, 1.1_MiB, 2.6_MiB, 5.1_MiB };
 
 TEST(Jemalloc, Arenas)
 {
   arena_id_t arena = moz_create_arena();
   ASSERT_TRUE(arena != 0);
   void* ptr = moz_arena_malloc(arena, 42);
@@ -619,9 +617,8 @@ TEST(Jemalloc, JunkPoison)
   // Until Bug 1364359 is fixed it is unsafe to call moz_dispose_arena.
   // moz_dispose_arena(arena);
 
   moz_arena_free(buf_arena, poison_buf);
   moz_arena_free(buf_arena, junk_buf);
   // Until Bug 1364359 is fixed it is unsafe to call moz_dispose_arena.
   // moz_dispose_arena(buf_arena);
 }
-#endif