Bug 1418153 - Remove impossible condition. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 16 Nov 2017 15:35:37 +0900
changeset 699644 e2a3fd5461327fcdb0662d441dcf5578ef4dd471
parent 699643 fc1a6407c7f9d0c01c9ab19b19f3e301e3bc04d7
child 699645 5a945d5210789ed02db367f85697b50b3519c615
push id89625
push userbmo:mh+mozilla@glandium.org
push dateFri, 17 Nov 2017 11:44:35 +0000
reviewersnjn
bugs1418153
milestone59.0a1
Bug 1418153 - Remove impossible condition. r?njn Since the old size arena_ralloc is given is already a size class, when the size class for the new size is the same as the old size, the new size can't be larger than the old size, so there's never anything to zero.
memory/build/mozjemalloc.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -3697,22 +3697,20 @@ arena_ralloc_large(void* aPtr, size_t aS
 static void*
 arena_ralloc(void* aPtr, size_t aSize, size_t aOldSize, arena_t* aArena)
 {
   void* ret;
   size_t copysize;
 
   // Try to avoid moving the allocation.
   if (aSize <= gMaxBinClass) {
-    if (aOldSize <= gMaxBinClass && SizeClass(aSize) == SizeClass(aOldSize)) {
+    if (aOldSize <= gMaxBinClass && SizeClass(aSize).Size() == aOldSize) {
       if (aSize < aOldSize) {
         memset(
           (void*)(uintptr_t(aPtr) + aSize), kAllocPoison, aOldSize - aSize);
-      } else if (opt_zero && aSize > aOldSize) {
-        memset((void*)(uintptr_t(aPtr) + aOldSize), 0, aSize - aOldSize);
       }
       return aPtr;
     }
   } else if (aOldSize > gMaxBinClass && aOldSize <= gMaxLargeClass) {
     MOZ_ASSERT(aSize > gMaxBinClass);
     if (arena_ralloc_large(aPtr, aSize, aOldSize, aArena)) {
       return aPtr;
     }