Bug 1511251 - Remove redundant and costly assert. r=njn
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 05 Dec 2018 14:45:52 +0000
changeset 508631 7c58f1010e376df70c61afd96dfb531ca9145374
parent 508630 fb51ef38b61ba4989e4b178b8984c1376e57eaf3
child 508632 134001f7ca7fb0a6cfd32d56ea1a324d31fb62e1
push id1905
push userffxbld-merge
push dateMon, 21 Jan 2019 12:33:13 +0000
treeherdermozilla-release@c2fca1944d8c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1511251, 1405159
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1511251 - Remove redundant and costly assert. r=njn The diagnostic assert (so fortunately, it doesn't impact release builds) as added in bug 1405159, but is costly because it uses the modulus of the division with a variable integer, which is a slow operation. However, in arena_run_reg_dalloc, we end up doing the same diagnostic assert, in a different form: after performing the division in a faster manner, we assert that the result, multiplied by the diviser, returns the original number. Differential Revision: https://phabricator.services.mozilla.com/D13501
memory/build/mozjemalloc.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -3223,20 +3223,16 @@ void arena_t::DallocSmall(arena_chunk_t*
   size_t size;
 
   run = (arena_run_t*)(aMapElm->bits & ~gPageSizeMask);
   MOZ_DIAGNOSTIC_ASSERT(run->mMagic == ARENA_RUN_MAGIC);
   bin = run->mBin;
   size = bin->mSizeClass;
   MOZ_DIAGNOSTIC_ASSERT(uintptr_t(aPtr) >=
                         uintptr_t(run) + bin->mRunFirstRegionOffset);
-  MOZ_DIAGNOSTIC_ASSERT(
-      (uintptr_t(aPtr) - (uintptr_t(run) + bin->mRunFirstRegionOffset)) %
-          size ==
-      0);
 
   memset(aPtr, kAllocPoison, size);
 
   arena_run_reg_dalloc(run, bin, aPtr, size);
   run->mNumFree++;
 
   if (run->mNumFree == bin->mRunNumRegions) {
     // Deallocate run.