Bug 715453 - Remove computedSize from nsMallocSizeOfFun. r=jlebar,bhackett.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 25 Jan 2012 00:52:51 -0800
changeset 87923 01d0bab1636ef49d2cbb9dc2a64405cba7b204fc
parent 87922 6f3b4c36b2850ebb13adb23f8b6ce716fe7b54b4
child 87924 0ddce98aaed2e581fdae7d1b0bad0bc49507241b
push idunknown
push userunknown
push dateunknown
reviewersjlebar, bhackett
bugs715453
milestone12.0a1
Bug 715453 - Remove computedSize from nsMallocSizeOfFun. r=jlebar,bhackett.
extensions/spellcheck/hunspell/src/mozHunspell.cpp
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxFont.h
js/public/HashTable.h
js/public/Utility.h
js/src/MemoryMetrics.cpp
js/src/ds/LifoAlloc.h
js/src/jscntxt.cpp
js/src/jsdhash.cpp
js/src/jsinfer.cpp
js/src/jsobjinlines.h
js/src/jsscope.h
js/src/jsscript.cpp
js/src/jsscript.h
js/src/methodjit/MethodJIT.cpp
js/src/vm/String.cpp
js/xpconnect/src/XPCJSRuntime.cpp
js/xpconnect/src/XPCMaps.cpp
js/xpconnect/src/XPCWrappedNativeInfo.cpp
js/xpconnect/src/XPCWrappedNativeScope.cpp
js/xpconnect/src/xpcpublic.h
layout/base/nsPresArena.cpp
layout/base/nsPresContext.h
layout/base/nsPresShell.h
layout/generic/nsTextRunTransformations.cpp
layout/style/AnimationCommon.cpp
layout/style/nsAnimationManager.cpp
layout/style/nsCSSRuleProcessor.cpp
layout/style/nsHTMLCSSStyleSheet.cpp
layout/style/nsStyleSet.cpp
layout/style/nsTransitionManager.cpp
memory/mozalloc/mozalloc.cpp
memory/mozalloc/mozalloc.h
netwerk/cache/nsDiskCacheMap.cpp
startupcache/StartupCache.cpp
startupcache/StartupCache.h
toolkit/components/places/History.cpp
toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
xpcom/base/nsIMemoryReporter.idl
xpcom/base/nscore.h
xpcom/ds/nsAtomTable.cpp
xpcom/glue/nsTArray.h
xpcom/glue/pldhash.cpp
xpcom/string/src/nsSubstring.cpp
xpcom/typelib/xpt/public/xpt_arena.h
xpcom/typelib/xpt/src/xpt_arena.c
--- a/extensions/spellcheck/hunspell/src/mozHunspell.cpp
+++ b/extensions/spellcheck/hunspell/src/mozHunspell.cpp
@@ -97,22 +97,20 @@ NS_IMPL_CYCLE_COLLECTION_3(mozHunspell,
 
 // Memory reporting stuff.
 static PRInt64 gHunspellAllocatedSize = 0;
 
 NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(HunspellMallocSizeOfForCounterInc, "hunspell")
 NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN_UN(HunspellMallocSizeOfForCounterDec)
 
 void HunspellReportMemoryAllocation(void* ptr) {
-  // |computedSize| is zero because we don't know what it is.
-  gHunspellAllocatedSize += HunspellMallocSizeOfForCounterInc(ptr, 0);
+  gHunspellAllocatedSize += HunspellMallocSizeOfForCounterInc(ptr);
 }
 void HunspellReportMemoryDeallocation(void* ptr) {
-  // |computedSize| is zero because we don't know what it is.
-  gHunspellAllocatedSize -= HunspellMallocSizeOfForCounterDec(ptr, 0);
+  gHunspellAllocatedSize -= HunspellMallocSizeOfForCounterDec(ptr);
 }
 static PRInt64 HunspellGetCurrentAllocatedSize() {
   return gHunspellAllocatedSize;
 }
 
 NS_MEMORY_REPORTER_IMPLEMENT(Hunspell,
     "explicit/spell-check",
     KIND_HEAP,
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -5274,20 +5274,17 @@ gfxTextRun::SizeOfExcludingThis(nsMalloc
     }
 
     return total;
 }
 
 size_t
 gfxTextRun::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
 {
-    // The second arg is how much gfxTextRun::AllocateStorageForTextRun would
-    // have allocated, given the character count of this run.
-    return aMallocSizeOf(this, sizeof(gfxTextRun) + sizeof(CompressedGlyph) * GetLength()) +
-           SizeOfExcludingThis(aMallocSizeOf);
+    return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }
 
 
 #ifdef DEBUG
 void
 gfxTextRun::Dump(FILE* aOutput) {
     if (!aOutput) {
         aOutput = stdout;
--- a/gfx/thebes/gfxFont.h
+++ b/gfx/thebes/gfxFont.h
@@ -2100,17 +2100,17 @@ private:
                                                         CompareRecordOffsets())) {
                     return nsnull;
                 }
             }
             return details;
         }
 
         size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) {
-            return aMallocSizeOf(this, sizeof(DetailedGlyphStore)) +
+            return aMallocSizeOf(this) +
                 mDetails.SizeOfExcludingThis(aMallocSizeOf) +
                 mOffsetToIndex.SizeOfExcludingThis(aMallocSizeOf);
         }
 
     private:
         struct DGRec {
             DGRec(const PRUint32& aOffset, const PRUint32& aIndex)
                 : mOffset(aOffset), mIndex(aIndex) { }
--- a/js/public/HashTable.h
+++ b/js/public/HashTable.h
@@ -653,21 +653,21 @@ class HashTable : private AllocPolicy
         return JS_BIT(sHashBits - hashShift);
     }
 
     uint32_t generation() const {
         return gen;
     }
 
     size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const {
-        return mallocSizeOf(table, capacity() * sizeof(Entry));
+        return mallocSizeOf(table);
     }
 
     size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const {
-        return mallocSizeOf(this, sizeof(HashTable)) + sizeOfExcludingThis(mallocSizeOf);
+        return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf);
     }
 
     Ptr lookup(const Lookup &l) const {
         ReentrancyGuard g(*this);
         HashNumber keyHash = prepareHash(l);
         return Ptr(lookup(l, keyHash, 0));
     }
 
@@ -1067,17 +1067,17 @@ class HashMap
     size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const {
         return impl.sizeOfExcludingThis(mallocSizeOf);
     }
     size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const {
         /* 
          * Don't just call |impl.sizeOfExcludingThis()| because there's no
          * guarantee that |impl| is the first field in HashMap.
          */
-        return mallocSizeOf(this, sizeof(*this)) + impl.sizeOfExcludingThis(mallocSizeOf);
+        return mallocSizeOf(this) + impl.sizeOfExcludingThis(mallocSizeOf);
     }
 
     /*
      * Typedef for the enumeration class. An Enum may be used to examine and
      * remove table entries:
      *
      *   typedef HashMap<int,char> HM;
      *   HM s;
@@ -1277,17 +1277,17 @@ class HashSet
     size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const {
         return impl.sizeOfExcludingThis(mallocSizeOf);
     }
     size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const {
         /* 
          * Don't just call |impl.sizeOfExcludingThis()| because there's no
          * guarantee that |impl| is the first field in HashSet.
          */
-        return mallocSizeOf(this, sizeof(*this)) + impl.sizeOfExcludingThis(mallocSizeOf);
+        return mallocSizeOf(this) + impl.sizeOfExcludingThis(mallocSizeOf);
     }
 
     /*
      * Typedef for the enumeration class. An Enum may be used to examine and
      * remove table entries:
      *
      *   typedef HashSet<int> HS;
      *   HS s;
--- a/js/public/Utility.h
+++ b/js/public/Utility.h
@@ -861,17 +861,17 @@ RoundUpPow2(size_t x)
 
 } /* namespace js */
 
 #endif /* defined(__cplusplus) */
 
 /*
  * This is SpiderMonkey's equivalent to |nsMallocSizeOfFun|.
  */
-typedef size_t(*JSMallocSizeOfFun)(const void *p, size_t computedSize);
+typedef size_t(*JSMallocSizeOfFun)(const void *p);
 
 /* sixgill annotation defines */
 #ifndef HAVE_STATIC_ANNOTATIONS
 # define HAVE_STATIC_ANNOTATIONS
 # ifdef XGILL_PLUGIN
 #  define STATIC_PRECONDITION(COND)         __attribute__((precondition(#COND)))
 #  define STATIC_PRECONDITION_ASSUME(COND)  __attribute__((precondition_assume(#COND)))
 #  define STATIC_POSTCONDITION(COND)        __attribute__((postcondition(#COND)))
--- a/js/src/MemoryMetrics.cpp
+++ b/js/src/MemoryMetrics.cpp
@@ -215,17 +215,17 @@ CollectCompartmentStatsForRuntime(JSRunt
         data->gcHeapChunkTotal =
             int64_t(JS_GetGCParameter(rt, JSGC_TOTAL_CHUNKS)) *
             gc::ChunkSize;
 
         IterateCompartmentsArenasCells(cx, data, CompartmentMemoryCallback,
                                        ArenaCallback, CellCallback);
         IterateChunks(cx, data, ChunkCallback);
 
-        data->runtimeObject = data->mallocSizeOf(rt, sizeof(JSRuntime));
+        data->runtimeObject = data->mallocSizeOf(rt);
 
         size_t normal, temporary, regexpCode, stackCommitted;
         rt->sizeOfExcludingThis(data->mallocSizeOf,
                                 &normal,
                                 &temporary,
                                 &regexpCode,
                                 &stackCommitted);
 
--- a/js/src/ds/LifoAlloc.h
+++ b/js/src/ds/LifoAlloc.h
@@ -109,17 +109,17 @@ class BumpChunk
     }
 
   public:
     BumpChunk *next() const { return next_; }
     void setNext(BumpChunk *succ) { next_ = succ; }
 
     size_t used() const { return bump - bumpBase(); }
     size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) {
-        return mallocSizeOf(this, limit - headerBase());
+        return mallocSizeOf(this);
     }
 
     void resetBump() {
         setBump(headerBase() + sizeof(BumpChunk));
     }
 
     void *mark() const { return bump; }
 
@@ -300,18 +300,17 @@ class LifoAlloc
             accum += it->sizeOfIncludingThis(mallocSizeOf);
             it = it->next();
         }
         return accum;
     }
 
     /* Like sizeOfExcludingThis(), but includes the size of the LifoAlloc itself. */
     size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const {
-        return mallocSizeOf(this, sizeof(LifoAlloc)) +
-               sizeOfExcludingThis(mallocSizeOf);
+        return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf);
     }
 
     /* Doesn't perform construction; useful for lazily-initialized POD types. */
     template <typename T>
     JS_ALWAYS_INLINE
     T *newPod() {
         return static_cast<T *>(alloc(sizeof(T)));
     }
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -91,22 +91,18 @@
 
 using namespace js;
 using namespace js::gc;
 
 void
 JSRuntime::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf, size_t *normal, size_t *temporary,
                                size_t *regexpCode, size_t *stackCommitted)
 {
-    /*
-     * The computedSize is 0 because sizeof(DtoaState) isn't available here and
-     * it's not worth making it available.
-     */
     if (normal)
-        *normal = mallocSizeOf(dtoaState, /* sizeof(DtoaState) */0);
+        *normal = mallocSizeOf(dtoaState);
 
     if (temporary)
         *temporary = tempLifoAlloc.sizeOfExcludingThis(mallocSizeOf);
 
     if (regexpCode) {
         size_t method = 0, regexp = 0, unused = 0;
         if (execAlloc_)
             execAlloc_->sizeOfCode(&method, &regexp, &unused);
@@ -1313,18 +1309,17 @@ JSContext::updateJITEnabled()
 size_t
 JSContext::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const
 {
     /*
      * There are other JSContext members that could be measured; the following
      * ones have been found by DMD to be worth measuring.  More stuff may be
      * added later.
      */
-    return mallocSizeOf(this, sizeof(JSContext)) +
-           busyArrays.sizeOfExcludingThis(mallocSizeOf);
+    return mallocSizeOf(this) + busyArrays.sizeOfExcludingThis(mallocSizeOf);
 }
 
 namespace JS {
 
 #if defined JS_THREADSAFE && defined DEBUG
 
 AutoCheckRequestDepth::AutoCheckRequestDepth(JSContext *cx)
     : cx(cx)
--- a/js/src/jsdhash.cpp
+++ b/js/src/jsdhash.cpp
@@ -803,35 +803,33 @@ SizeOfEntryExcludingThisEnumerator(JSDHa
 
 extern JS_PUBLIC_API(size_t)
 JS_DHashTableSizeOfExcludingThis(const JSDHashTable *table,
                                  JSDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis,
                                  JSMallocSizeOfFun mallocSizeOf,
                                  void *arg /* = NULL */)
 {
     size_t n = 0;
-    n += mallocSizeOf(table->entryStore,
-                      JS_DHASH_TABLE_SIZE(table) * table->entrySize +
-                      ENTRY_STORE_EXTRA);
+    n += mallocSizeOf(table->entryStore);
     if (sizeOfEntryExcludingThis) {
         SizeOfEntryExcludingThisArg arg2 = { 0, sizeOfEntryExcludingThis, mallocSizeOf, arg };
         JS_DHashTableEnumerate(const_cast<JSDHashTable *>(table),
                                SizeOfEntryExcludingThisEnumerator, &arg2);
         n += arg2.total;
     }
     return n;
 }
 
 extern JS_PUBLIC_API(size_t)
 JS_DHashTableSizeOfIncludingThis(const JSDHashTable *table,
                                  JSDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis,
                                  JSMallocSizeOfFun mallocSizeOf,
                                  void *arg /* = NULL */)
 {
-    return mallocSizeOf(table, sizeof(JSDHashTable)) +
+    return mallocSizeOf(table) +
            JS_DHashTableSizeOfExcludingThis(table, sizeOfEntryExcludingThis,
                                             mallocSizeOf, arg);
 }
 
 #ifdef DEBUG
 JS_PUBLIC_API(void)
 JS_DHashMarkTableImmutable(JSDHashTable *table)
 {
--- a/js/src/jsinfer.cpp
+++ b/js/src/jsinfer.cpp
@@ -6299,28 +6299,28 @@ static void
 GetScriptMemoryStats(JSScript *script, TypeInferenceMemoryStats *stats, JSMallocSizeOfFun mallocSizeOf)
 {
     TypeScript *typeScript = script->types;
     if (!typeScript)
         return;
 
     /* If TI is disabled, a single TypeScript is still present. */
     if (!script->compartment()->types.inferenceEnabled) {
-        stats->scripts += mallocSizeOf(typeScript, sizeof(TypeScript));
+        stats->scripts += mallocSizeOf(typeScript);
         return;
     }
 
-    stats->scripts += mallocSizeOf(typeScript->nesting, sizeof(TypeScriptNesting));
+    stats->scripts += mallocSizeOf(typeScript->nesting);
 
     unsigned count = TypeScript::NumTypeSets(script);
-    stats->scripts += mallocSizeOf(typeScript, sizeof(TypeScript) + count * sizeof(TypeSet));
+    stats->scripts += mallocSizeOf(typeScript);
 
     TypeResult *result = typeScript->dynamicList;
     while (result) {
-        stats->scripts += mallocSizeOf(result, sizeof(TypeResult));
+        stats->scripts += mallocSizeOf(result);
         result = result->next;
     }
 
     /*
      * This counts memory that is in the temp pool but gets attributed
      * elsewhere.  See JS::SizeOfCompartmentTypeInferenceData for more details.
      */
     TypeSet *typeArray = typeScript->typeArray();
@@ -6340,18 +6340,17 @@ JS::SizeOfCompartmentTypeInferenceData(J
      * Note: not all data in the pool is temporary, and some will survive GCs
      * by being copied to the replacement pool. This memory will be counted
      * elsewhere and deducted from the amount of temporary data.
      */
     stats->temporary += compartment->typeLifoAlloc.sizeOfExcludingThis(mallocSizeOf);
 
     /* Pending arrays are cleared on GC along with the analysis pool. */
     stats->temporary +=
-        mallocSizeOf(compartment->types.pendingArray, 
-                     sizeof(TypeCompartment::PendingWork) * compartment->types.pendingCapacity);
+        mallocSizeOf(compartment->types.pendingArray);
 
     /* TypeCompartment::pendingRecompiles is non-NULL only while inference code is running. */
     JS_ASSERT(!compartment->types.pendingRecompiles);
 
     for (gc::CellIter i(cx, compartment, gc::FINALIZE_SCRIPT); !i.done(); i.next())
         GetScriptMemoryStats(i.get<JSScript>(), stats, mallocSizeOf);
 
     if (compartment->types.allocationSiteTable)
@@ -6366,18 +6365,17 @@ JS::SizeOfCompartmentTypeInferenceData(J
         for (ObjectTypeTable::Enum e(*compartment->types.objectTypeTable);
              !e.empty();
              e.popFront())
         {
             const ObjectTableKey &key = e.front().key;
             const ObjectTableEntry &value = e.front().value;
 
             /* key.ids and values.types have the same length. */
-            stats->tables += mallocSizeOf(key.ids, key.nslots * sizeof(jsid)) +
-                             mallocSizeOf(value.types, key.nslots * sizeof(Type));
+            stats->tables += mallocSizeOf(key.ids) + mallocSizeOf(value.types);
         }
     }
 }
 
 void
 JS::SizeOfTypeObjectExcludingThis(void *object_, TypeInferenceMemoryStats *stats, JSMallocSizeOfFun mallocSizeOf)
 {
     TypeObject *object = (TypeObject *) object_;
@@ -6387,26 +6385,18 @@ JS::SizeOfTypeObjectExcludingThis(void *
          * Properties and associated type sets for singletons are cleared on
          * every GC. The type object is normally destroyed too, but we don't
          * charge this to 'temporary' as this is not for GC heap values.
          */
         JS_ASSERT(!object->newScript);
         return;
     }
 
-    if (object->newScript) {
-        /* The initializerList is tacked onto the end of the TypeNewScript. */
-        size_t computedSize = sizeof(TypeNewScript);
-        for (TypeNewScript::Initializer *init = object->newScript->initializerList; ; init++) {
-            computedSize += sizeof(TypeNewScript::Initializer);
-            if (init->kind == TypeNewScript::Initializer::DONE)
-                break;
-        }
-        stats->objects += mallocSizeOf(object->newScript, computedSize);
-    }
+    if (object->newScript)
+        stats->objects += mallocSizeOf(object->newScript);
 
     /*
      * This counts memory that is in the temp pool but gets attributed
      * elsewhere.  See JS_GetTypeInferenceMemoryStats for more details.
      */
     size_t bytes = object->dynamicSize();
     stats->objects += bytes;
     stats->temporary -= bytes;
--- a/js/src/jsobjinlines.h
+++ b/js/src/jsobjinlines.h
@@ -1213,26 +1213,26 @@ JSObject::computedSizeOfIncludingThis() 
 }
 
 inline void
 JSObject::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf,
                               size_t *slotsSize, size_t *elementsSize) const
 {
     if (hasDynamicSlots()) {
         size_t computedSize = numDynamicSlots() * sizeof(js::Value);
-        *slotsSize = mallocSizeOf ? mallocSizeOf(slots, computedSize) : computedSize;
+        *slotsSize = mallocSizeOf ? mallocSizeOf(slots) : computedSize;
     } else {
         *slotsSize = 0;
     }
     if (hasDynamicElements()) {
         size_t computedSize =
             (js::ObjectElements::VALUES_PER_HEADER +
              getElementsHeader()->capacity) * sizeof(js::Value);
         *elementsSize =
-            mallocSizeOf ? mallocSizeOf(getElementsHeader(), computedSize) : computedSize;
+            mallocSizeOf ? mallocSizeOf(getElementsHeader()) : computedSize;
     } else {
         *elementsSize = 0;
     }
 }
 
 inline JSBool
 JSObject::lookupGeneric(JSContext *cx, jsid id, JSObject **objp, JSProperty **propp)
 {
--- a/js/src/jsscope.h
+++ b/js/src/jsscope.h
@@ -172,18 +172,17 @@ struct PropertyTable {
     /* Computes the size of the entries array for a given capacity. */
     static size_t sizeOfEntries(size_t cap) { return cap * sizeof(Shape *); }
 
     /*
      * This counts the PropertyTable object itself (which must be
      * heap-allocated) and its |entries| array.
      */
     size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const {
-        return mallocSizeOf(this, sizeof(PropertyTable)) +
-               mallocSizeOf(entries, sizeOfEntries(capacity()));
+        return mallocSizeOf(this) + mallocSizeOf(entries);
     }
 
     /* Whether we need to grow.  We want to do this if the load factor is >= 0.75 */
     bool needsToGrow() const {
         uint32_t size = capacity();
         return entryCount + removedCount >= size - (size >> 2);
     }
 
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -1282,17 +1282,17 @@ JSScript::computedSizeOfData()
 size_t
 JSScript::sizeOfData(JSMallocSizeOfFun mallocSizeOf)
 {
 #if JS_SCRIPT_INLINE_DATA_LIMIT
     if (data == inlineData)
         return 0;
 #endif
 
-    return mallocSizeOf(data, computedSizeOfData());
+    return mallocSizeOf(data);
 }
 
 /*
  * Nb: srcnotes are variable-length.  This function computes the number of
  * srcnote *slots*, which may be greater than the number of srcnotes.
  */
 uint32_t
 JSScript::numNotes()
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -632,17 +632,21 @@ struct JSScript : public js::gc::Cell {
         return constructing ? jitCtor : jitNormal;
     }
 
     size_t getUseCount() const  { return useCount; }
     size_t incUseCount() { return ++useCount; }
     size_t *addressOfUseCount() { return &useCount; }
     void resetUseCount() { useCount = 0; }
 
-    /* Size of the JITScript and all sections.  (This method is implemented in MethodJIT.cpp.) */
+    /*
+     * Size of the JITScript and all sections.  If |mallocSizeOf| is NULL, the
+     * size is computed analytically.  (This method is implemented in
+     * MethodJIT.cpp.)
+     */
     size_t sizeOfJitScripts(JSMallocSizeOfFun mallocSizeOf);
 
 #endif
 
     /* Counter accessors. */
     js::OpcodeCounts getCounts(jsbytecode *pc) {
         JS_ASSERT(size_t(pc - code) < length);
         return pcCounters.counts[pc - code];
--- a/js/src/methodjit/MethodJIT.cpp
+++ b/js/src/methodjit/MethodJIT.cpp
@@ -1370,20 +1370,17 @@ JSScript::sizeOfJitScripts(JSMallocSizeO
     if (jitCtor)
         n += jitCtor->sizeOfIncludingThis(mallocSizeOf); 
     return n;
 }
 
 size_t
 mjit::JITScript::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf)
 {
-    size_t computedSize = sizeof(JITScript) +
-                          (nchunks * sizeof(ChunkDescriptor)) +
-                          (nedges * sizeof(CrossChunkEdge));
-    size_t n = mallocSizeOf(this, computedSize);
+    size_t n = mallocSizeOf(this);
     for (unsigned i = 0; i < nchunks; i++) {
         const ChunkDescriptor &desc = chunkDescriptor(i);
         if (desc.chunk)
             n += desc.chunk->sizeOfIncludingThis(mallocSizeOf);
     }
     return n;
 }
 
@@ -1408,17 +1405,17 @@ mjit::JITChunk::computedSizeOfIncludingT
 #endif
            0;
 }
 
 /* Please keep in sync with Compiler::finishThisUp! */
 size_t
 mjit::JITChunk::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf)
 {
-    return mallocSizeOf(this, computedSizeOfIncludingThis());
+    return mallocSizeOf(this);
 }
 
 void
 mjit::ReleaseScriptCode(JSContext *cx, JSScript *script, bool construct)
 {
     // NB: The recompiler may call ReleaseScriptCode, in which case it
     // will get called again when the script is destroyed, so we
     // must protect against calling ReleaseScriptCode twice.
--- a/js/src/vm/String.cpp
+++ b/js/src/vm/String.cpp
@@ -91,32 +91,32 @@ JSString::sizeOfExcludingThis(JSMallocSi
     if (isDependent())
         return 0;
 
     JS_ASSERT(isFlat());
 
     /* JSExtensibleString: count the full capacity, not just the used space. */
     if (isExtensible()) {
         JSExtensibleString &extensible = asExtensible();
-        return mallocSizeOf(extensible.chars(), asExtensible().capacity() * sizeof(jschar));
+        return mallocSizeOf(extensible.chars());
     }
 
     JS_ASSERT(isFixed());
 
     /* JSExternalString: don't count, the chars could be stored anywhere. */
     if (isExternal())
         return 0;
 
     /* JSInlineString, JSShortString, JSInlineAtom, JSShortAtom: the chars are inline. */
     if (isInline())
         return 0;
 
     /* JSAtom, JSFixedString: count the chars. +1 for the null char. */
     JSFixedString &fixed = asFixed();
-    return mallocSizeOf(fixed.chars(), (length() + 1) * sizeof(jschar));
+    return mallocSizeOf(fixed.chars());
 }
 
 static JS_ALWAYS_INLINE bool
 AllocChars(JSContext *maybecx, size_t length, jschar **chars, size_t *capacity)
 {
     /*
      * String length doesn't include the null char, so include it here before
      * doubling. Adding the null char after doubling would interact poorly with
--- a/js/xpconnect/src/XPCJSRuntime.cpp
+++ b/js/xpconnect/src/XPCJSRuntime.cpp
@@ -968,17 +968,17 @@ XPCJSRuntime::ActivityCallback(void *arg
         self->mLastActiveTime = PR_Now();
     }
 }
 
 size_t
 XPCJSRuntime::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf)
 {
     size_t n = 0;
-    n += mallocSizeOf(this, sizeof(XPCJSRuntime));
+    n += mallocSizeOf(this);
     n += mWrappedJSMap->SizeOfIncludingThis(mallocSizeOf);
     n += mIID2NativeInterfaceMap->SizeOfIncludingThis(mallocSizeOf);
     n += mClassInfo2NativeSetMap->ShallowSizeOfIncludingThis(mallocSizeOf);
     n += mNativeSetMap->SizeOfIncludingThis(mallocSizeOf);
 
     // NULL for the second arg;  we're not measuring anything hanging off the
     // entries in mJSHolders.
     n += JS_DHashTableSizeOfExcludingThis(&mJSHolders, NULL, mallocSizeOf);
--- a/js/xpconnect/src/XPCMaps.cpp
+++ b/js/xpconnect/src/XPCMaps.cpp
@@ -136,27 +136,26 @@ JSObject2WrappedJSMap::~JSObject2Wrapped
     if (mTable)
         JS_DHashTableDestroy(mTable);
 }
 
 size_t
 JSObject2WrappedJSMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf)
 {
     size_t n = 0;
-    n += mallocSizeOf(this, sizeof(JSObject2WrappedJSMap));
+    n += mallocSizeOf(this);
     n += mTable ? JS_DHashTableSizeOfIncludingThis(mTable, SizeOfEntryExcludingThis, mallocSizeOf) : 0;
     return n;
 }
 
 /* static */ size_t
 JSObject2WrappedJSMap::SizeOfEntryExcludingThis(JSDHashEntryHdr *hdr,
                                                 JSMallocSizeOfFun mallocSizeOf, void *)
 {
-    return mallocSizeOf(((JSObject2WrappedJSMap::Entry*)hdr)->value,
-                        sizeof(nsXPCWrappedJS));
+    return mallocSizeOf(((JSObject2WrappedJSMap::Entry*)hdr)->value);
 }
 
 /***************************************************************************/
 // implement Native2WrappedNativeMap...
 
 // static
 Native2WrappedNativeMap*
 Native2WrappedNativeMap::newMap(int size)
@@ -179,27 +178,26 @@ Native2WrappedNativeMap::~Native2Wrapped
     if (mTable)
         JS_DHashTableDestroy(mTable);
 }
 
 size_t
 Native2WrappedNativeMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf)
 {
     size_t n = 0;
-    n += mallocSizeOf(this, sizeof(Native2WrappedNativeMap));
+    n += mallocSizeOf(this);
     n += mTable ? JS_DHashTableSizeOfIncludingThis(mTable, SizeOfEntryExcludingThis, mallocSizeOf) : 0;
     return n;
 }
 
 /* static */ size_t
 Native2WrappedNativeMap::SizeOfEntryExcludingThis(JSDHashEntryHdr *hdr,
                                                   JSMallocSizeOfFun mallocSizeOf, void *)
 {
-    return mallocSizeOf(((Native2WrappedNativeMap::Entry*)hdr)->value,
-                         sizeof(XPCWrappedNative));
+    return mallocSizeOf(((Native2WrappedNativeMap::Entry*)hdr)->value);
 }
 
 /***************************************************************************/
 // implement IID2WrappedJSClassMap...
 
 struct JSDHashTableOps IID2WrappedJSClassMap::Entry::sOps =
 {
     JS_DHashAllocTable,
@@ -269,17 +267,17 @@ IID2NativeInterfaceMap::~IID2NativeInter
     if (mTable)
         JS_DHashTableDestroy(mTable);
 }
 
 size_t
 IID2NativeInterfaceMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf)
 {
     size_t n = 0;
-    n += mallocSizeOf(this, sizeof(IID2NativeInterfaceMap));
+    n += mallocSizeOf(this);
     n += mTable ? JS_DHashTableSizeOfIncludingThis(mTable, SizeOfEntryExcludingThis, mallocSizeOf) : 0;
     return n;
 }
 
 /* static */ size_t
 IID2NativeInterfaceMap::SizeOfEntryExcludingThis(JSDHashEntryHdr *hdr,
                                                  JSMallocSizeOfFun mallocSizeOf, void *)
 {
@@ -312,17 +310,17 @@ ClassInfo2NativeSetMap::~ClassInfo2Nativ
     if (mTable)
         JS_DHashTableDestroy(mTable);
 }
 
 size_t
 ClassInfo2NativeSetMap::ShallowSizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf)
 {
     size_t n = 0;
-    n += mallocSizeOf(this, sizeof(ClassInfo2NativeSetMap));
+    n += mallocSizeOf(this);
     // The second arg is NULL because this is a "shallow" measurement of the map.
     n += mTable ? JS_DHashTableSizeOfIncludingThis(mTable, NULL, mallocSizeOf) : 0;
     return n;
 }
 
 /***************************************************************************/
 // implement ClassInfo2WrappedNativeProtoMap...
 
@@ -348,27 +346,26 @@ ClassInfo2WrappedNativeProtoMap::~ClassI
     if (mTable)
         JS_DHashTableDestroy(mTable);
 }
 
 size_t
 ClassInfo2WrappedNativeProtoMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf)
 {
     size_t n = 0;
-    n += mallocSizeOf(this, sizeof(ClassInfo2WrappedNativeProtoMap));
+    n += mallocSizeOf(this);
     n += mTable ? JS_DHashTableSizeOfIncludingThis(mTable, SizeOfEntryExcludingThis, mallocSizeOf) : 0;
     return n;
 }
 
 /* static */ size_t
 ClassInfo2WrappedNativeProtoMap::SizeOfEntryExcludingThis(JSDHashEntryHdr *hdr,
                                                           JSMallocSizeOfFun mallocSizeOf, void *)
 {
-    return mallocSizeOf(((ClassInfo2WrappedNativeProtoMap::Entry*)hdr)->value,
-                        sizeof(XPCWrappedNativeProto));
+    return mallocSizeOf(((ClassInfo2WrappedNativeProtoMap::Entry*)hdr)->value);
 }
 
 /***************************************************************************/
 // implement NativeSetMap...
 
 JSBool
 NativeSetMap::Entry::Match(JSDHashTable *table,
                            const JSDHashEntryHdr *entry,
@@ -473,17 +470,17 @@ NativeSetMap::~NativeSetMap()
     if (mTable)
         JS_DHashTableDestroy(mTable);
 }
 
 size_t
 NativeSetMap::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf)
 {
     size_t n = 0;
-    n += mallocSizeOf(this, sizeof(NativeSetMap));
+    n += mallocSizeOf(this);
     n += mTable ? JS_DHashTableSizeOfIncludingThis(mTable, SizeOfEntryExcludingThis, mallocSizeOf) : 0;
     return n;
 }
 
 /* static */ size_t
 NativeSetMap::SizeOfEntryExcludingThis(JSDHashEntryHdr *hdr, JSMallocSizeOfFun mallocSizeOf, void *)
 {
     XPCNativeSet *set = ((NativeSetMap::Entry*)hdr)->key_value;
--- a/js/xpconnect/src/XPCWrappedNativeInfo.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeInfo.cpp
@@ -414,21 +414,17 @@ XPCNativeInterface::DestroyInstance(XPCN
 {
     inst->~XPCNativeInterface();
     delete [] (char*) inst;
 }
 
 size_t
 XPCNativeInterface::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf)
 {
-    size_t computedSize = sizeof(XPCNativeInterface);
-    if (mMemberCount > 1)
-        computedSize += (mMemberCount - 1) * sizeof(XPCNativeMember);
-
-    return mallocSizeOf(this, computedSize);
+    return mallocSizeOf(this);
 }
 
 void
 XPCNativeInterface::DebugDump(PRInt16 depth)
 {
 #ifdef DEBUG
     depth--;
     XPC_LOG_ALWAYS(("XPCNativeInterface @ %x", this));
@@ -780,21 +776,17 @@ XPCNativeSet::DestroyInstance(XPCNativeS
 {
     inst->~XPCNativeSet();
     delete [] (char*) inst;
 }
 
 size_t
 XPCNativeSet::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf)
 {
-    size_t computedSize = sizeof(XPCNativeSet);
-    if (mInterfaceCount > 1)
-        computedSize += (mInterfaceCount - 1) * sizeof(XPCNativeInterface *);
-
-    return mallocSizeOf(this, computedSize);
+    return mallocSizeOf(this);
 }
 
 void
 XPCNativeSet::DebugDump(PRInt16 depth)
 {
 #ifdef DEBUG
     depth--;
     XPC_LOG_ALWAYS(("XPCNativeSet @ %x", this));
--- a/js/xpconnect/src/XPCWrappedNativeScope.cpp
+++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp
@@ -969,17 +969,17 @@ XPCWrappedNativeScope::SizeOfAllScopesIn
     }
     return n;
 }
 
 size_t
 XPCWrappedNativeScope::SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf)
 {
     size_t n = 0;
-    n += mallocSizeOf(this, sizeof(XPCWrappedNativeScope));
+    n += mallocSizeOf(this);
     n += mWrappedNativeMap->SizeOfIncludingThis(mallocSizeOf);
     n += mWrappedNativeProtoMap->SizeOfIncludingThis(mallocSizeOf);
     n += mMainThreadWrappedNativeProtoMap->SizeOfIncludingThis(mallocSizeOf);
 
     // There are other XPCWrappedNativeScope members that could be measured;
     // the above ones have been seen by DMD to be worth measuring.  More stuff
     // may be added later.
 
--- a/js/xpconnect/src/xpcpublic.h
+++ b/js/xpconnect/src/xpcpublic.h
@@ -204,17 +204,17 @@ bool Base64Decode(JSContext *cx, JS::Val
  * Convert an nsString to jsval, returning true on success.
  * Note, the ownership of the string buffer may be moved from str to rval.
  * If that happens, str will point to an empty string after this call.
  */
 bool StringToJsval(JSContext *cx, nsString &str, JS::Value *rval);
 
 void *GetCompartmentName(JSContext *cx, JSCompartment *c);
 void DestroyCompartmentName(void *string);
-size_t JsMallocSizeOf(const void *ptr, size_t computedSize);
+size_t JsMallocSizeOf(const void *ptr);
 
 } // namespace xpc
 
 class nsIMemoryMultiReporterCallback;
 
 namespace mozilla {
 namespace xpconnect {
 namespace memory {
--- a/layout/base/nsPresArena.cpp
+++ b/layout/base/nsPresArena.cpp
@@ -384,24 +384,24 @@ struct nsPresArena::State {
       *reinterpret_cast<PRUword*>(p) = ARENA_POISON;
     }
 
     list->mEntries.AppendElement(aPtr);
   }
 
   size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
   {
-    size_t n = aMallocSizeOf(this, sizeof(*this));
+    size_t n = aMallocSizeOf(this);
 
     // The first PLArena is within the PLArenaPool, i.e. within |this|, so we
     // don't measure it.  Subsequent PLArenas are by themselves and must be
     // measured.
     const PLArena *arena = mPool.first.next;
     while (arena) {
-      n += aMallocSizeOf(arena, arena->limit - arena->base);
+      n += aMallocSizeOf(arena);
       arena = arena->next;
     }
     return n;
   }
 };
 
 size_t
 nsPresArena::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -966,18 +966,17 @@ public:
   virtual NS_MUST_OVERRIDE size_t
         SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const {
     // XXX: lots of things hang off nsPresContext and should be included in
     // this measurement.  Bug 671299 may add them.
     return 0;
   }
   virtual NS_MUST_OVERRIDE size_t
         SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const {
-    return aMallocSizeOf(this, sizeof(nsPresContext)) +
-           SizeOfExcludingThis(aMallocSizeOf);
+    return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
   }
 
   bool IsRootContentDocument();
 
 protected:
   friend class nsRunnableMethod<nsPresContext>;
   NS_HIDDEN_(void) ThemeChangedInternal();
   NS_HIDDEN_(void) SysColorChangedInternal();
@@ -1320,18 +1319,17 @@ public:
   virtual NS_MUST_OVERRIDE size_t
         SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE {
     // XXX: several things hang off an nsRootPresContext and should be included
     // in this measurement.  Bug 671299 may do this.
     return nsPresContext::SizeOfExcludingThis(aMallocSizeOf);
   }
   virtual NS_MUST_OVERRIDE size_t
         SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const MOZ_OVERRIDE {
-    return aMallocSizeOf(this, sizeof(nsRootPresContext)) +
-           SizeOfExcludingThis(aMallocSizeOf);
+    return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
   }
 
 protected:
   class RunWillPaintObservers : public nsRunnable {
   public:
     RunWillPaintObservers(nsRootPresContext* aPresContext) : mPresContext(aPresContext) {}
     void Revoke() { mPresContext = nsnull; }
     NS_IMETHOD Run()
--- a/layout/base/nsPresShell.h
+++ b/layout/base/nsPresShell.h
@@ -133,20 +133,20 @@ public:
   void* Allocate(size_t aSize);
   void Push();
   void Pop();
 
   size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const {
     size_t n = 0;
     StackBlock *block = mBlocks;
     while (block) {
-      n += aMallocSizeOf(block, sizeof(StackBlock));
+      n += aMallocSizeOf(block);
       block = block->mNext;
     }
-    n += aMallocSizeOf(mMarks, mMarkLength * sizeof(StackMark));
+    n += aMallocSizeOf(mMarks);
     return n;
   }
 
 private:
   // our current position in memory
   size_t mPos;
 
   // a list of memory block. Usually there is only one
@@ -899,17 +899,17 @@ private:
   PRUint32 mPresArenaAllocCount;
 #endif
 
 public:
 
   size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const {
     size_t n = 0;
 
-    n += aMallocSizeOf(this, sizeof(PresShell));
+    n += aMallocSizeOf(this);
     n += mStackArena.SizeOfExcludingThis(aMallocSizeOf);
     n += mFrameArena.SizeOfExcludingThis(aMallocSizeOf);
 
     return n;
   }
 
   size_t SizeOfTextRuns(nsMallocSizeOfFun aMallocSizeOf);
 
--- a/layout/generic/nsTextRunTransformations.cpp
+++ b/layout/generic/nsTextRunTransformations.cpp
@@ -98,30 +98,25 @@ nsTransformedTextRun::SetPotentialLineBr
 
 size_t
 nsTransformedTextRun::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf)
 {
   size_t total = gfxTextRun::SizeOfExcludingThis(aMallocSizeOf);
   total += mStyles.SizeOfExcludingThis(aMallocSizeOf);
   total += mCapitalize.SizeOfExcludingThis(aMallocSizeOf);
   if (mOwnsFactory) {
-    // It's not worth the effort to get all the sub-class cases right for a
-    // small size in the fallback case.  So we use a |computedSize| of 0, which
-    // disables any usable vs. computedSize checking done by aMallocSizeOf.
-    total += aMallocSizeOf(mFactory, 0);
+    total += aMallocSizeOf(mFactory);
   }
   return total;
 }
 
 size_t
 nsTransformedTextRun::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
 {
-  return aMallocSizeOf(this, sizeof(nsTransformedTextRun) +
-                             GetLength() * sizeof(CompressedGlyph)) +
-         SizeOfExcludingThis(aMallocSizeOf);
+  return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }
 
 nsTransformedTextRun*
 nsTransformingTextRunFactory::MakeTextRun(const PRUnichar* aString, PRUint32 aLength,
                                           const gfxTextRunFactory::Parameters* aParams,
                                           gfxFontGroup* aFontGroup, PRUint32 aFlags,
                                           nsStyleContext** aStyles, bool aOwnsFactory)
 {
--- a/layout/style/AnimationCommon.cpp
+++ b/layout/style/AnimationCommon.cpp
@@ -131,18 +131,17 @@ CommonAnimationManager::SizeOfExcludingT
 {
   // XXX: could measure mProperytValuePairs here.  Bug 671299 may do this.
   return 0;
 }
 
 /* virtual */ size_t
 CommonAnimationManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
-  return aMallocSizeOf(this, sizeof(CommonAnimationManager)) +
-         SizeOfExcludingThis(aMallocSizeOf);
+  return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }
 
 /* static */ bool
 CommonAnimationManager::ExtractComputedValueForTransition(
                           nsCSSProperty aProperty,
                           nsStyleContext* aStyleContext,
                           nsStyleAnimation::Value& aComputedValue)
 {
--- a/layout/style/nsAnimationManager.cpp
+++ b/layout/style/nsAnimationManager.cpp
@@ -438,18 +438,17 @@ nsAnimationManager::SizeOfExcludingThis(
   // XXX: various other members in nsAnimationManager could be measured here.
   // Bug 671299 may do this.
   return CommonAnimationManager::SizeOfExcludingThis(aMallocSizeOf);
 }
 
 /* virtual */ size_t
 nsAnimationManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
-  return aMallocSizeOf(this, sizeof(nsAnimationManager)) +
-         SizeOfExcludingThis(aMallocSizeOf);
+  return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }
 
 nsIStyleRule*
 nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
                                        mozilla::dom::Element* aElement)
 {
   if (!mPresContext->IsProcessingAnimationStyleChange()) {
     // Everything that causes our animation data to change triggers a
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -792,18 +792,17 @@ RuleHash::SizeOfExcludingThis(nsMallocSi
   n += mUniversalRules.SizeOfExcludingThis(aMallocSizeOf);
 
   return n;
 }
 
 size_t
 RuleHash::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
-  return aMallocSizeOf(this, sizeof(RuleHash)) +
-         SizeOfExcludingThis(aMallocSizeOf);
+  return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }
 
 //--------------------------------
 
 // A hash table mapping atoms to lists of selectors
 struct AtomSelectorEntry : public PLDHashEntryHdr {
   nsIAtom *mAtom;
   // Auto length 2, because a decent fraction of these arrays ends up
@@ -955,17 +954,17 @@ SizeOfSelectorsEntry(PLDHashEntryHdr* aH
 {
   AtomSelectorEntry* entry = static_cast<AtomSelectorEntry*>(aHdr);
   return entry->mSelectors.SizeOfExcludingThis(aMallocSizeOf);
 }
 
 size_t
 RuleCascadeData::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
-  size_t n = aMallocSizeOf(this, sizeof(RuleCascadeData));
+  size_t n = aMallocSizeOf(this);
 
   n += mRuleHash.SizeOfExcludingThis(aMallocSizeOf);
   for (PRUint32 i = 0; i < ArrayLength(mPseudoElementRuleHashes); ++i) {
     if (mPseudoElementRuleHashes[i])
       n += mPseudoElementRuleHashes[i]->SizeOfIncludingThis(aMallocSizeOf);
   }
 
   n += mStateSelectors.SizeOfExcludingThis(aMallocSizeOf);
@@ -2583,18 +2582,17 @@ nsCSSRuleProcessor::SizeOfExcludingThis(
   }
 
   return n;
 }
 
 /* virtual */ size_t
 nsCSSRuleProcessor::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
-  return aMallocSizeOf(this, sizeof(nsCSSRuleProcessor)) +
-         SizeOfExcludingThis(aMallocSizeOf);
+  return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }
 
 // Append all the currently-active font face rules to aArray.  Return
 // true for success and false for failure.
 bool
 nsCSSRuleProcessor::AppendFontFaceRules(
                               nsPresContext *aPresContext,
                               nsTArray<nsFontFaceRuleContainer>& aArray)
--- a/layout/style/nsHTMLCSSStyleSheet.cpp
+++ b/layout/style/nsHTMLCSSStyleSheet.cpp
@@ -167,18 +167,17 @@ nsHTMLCSSStyleSheet::MediumFeaturesChang
 nsHTMLCSSStyleSheet::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
   return 0;
 }
 
 /* virtual */ size_t
 nsHTMLCSSStyleSheet::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
-  return aMallocSizeOf(this, sizeof(nsHTMLCSSStyleSheet)) +
-         SizeOfExcludingThis(aMallocSizeOf);
+  return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }
 
 void
 nsHTMLCSSStyleSheet::Reset(nsIURI* aURL)
 {
   mURL = aURL;
 }
 
--- a/layout/style/nsStyleSet.cpp
+++ b/layout/style/nsStyleSet.cpp
@@ -143,17 +143,17 @@ nsStyleSet::nsStyleSet()
     mInReconstruct(false),
     mDirty(0)
 {
 }
 
 size_t
 nsStyleSet::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
-  size_t n = aMallocSizeOf(this, sizeof(nsStyleSet));
+  size_t n = aMallocSizeOf(this);
 
   for (int i = 0; i < eSheetTypeCount; i++) {
     if (mRuleProcessors[i]) {
       n += mRuleProcessors[i]->SizeOfIncludingThis(aMallocSizeOf);
     }
   }
 
   return n;
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -719,18 +719,17 @@ nsTransitionManager::RulesMatching(XULTr
 nsTransitionManager::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
   return CommonAnimationManager::SizeOfExcludingThis(aMallocSizeOf);
 }
 
 /* virtual */ size_t
 nsTransitionManager::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
-  return aMallocSizeOf(this, sizeof(nsTransitionManager)) +
-         SizeOfExcludingThis(aMallocSizeOf);
+  return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
 }
 
 struct TransitionEventInfo {
   nsCOMPtr<nsIContent> mElement;
   nsTransitionEvent mEvent;
 
   TransitionEventInfo(nsIContent *aElement, nsCSSProperty aProperty,
                       TimeDuration aDuration)
--- a/memory/mozalloc/mozalloc.cpp
+++ b/memory/mozalloc/mozalloc.cpp
@@ -266,19 +266,18 @@ moz_malloc_usable_size(void *ptr)
     return malloc_usable_size(ptr);
 #elif defined(XP_WIN)
     return _msize(ptr);
 #else
     return 0;
 #endif
 }
 
-size_t moz_malloc_size_of(const void *ptr, size_t computedSize)
+size_t moz_malloc_size_of(const void *ptr)
 {
-    size_t usable = moz_malloc_usable_size((void *)ptr);
-    return usable ? usable : computedSize;
+    return moz_malloc_usable_size((void *)ptr);
 }
 
 namespace mozilla {
 
 const fallible_t fallible = fallible_t();
 
 } // namespace mozilla
--- a/memory/mozalloc/mozalloc.h
+++ b/memory/mozalloc/mozalloc.h
@@ -130,17 +130,17 @@ MOZALLOC_EXPORT void* moz_realloc(void* 
 MOZALLOC_EXPORT char* moz_xstrdup(const char* str)
     NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
 
 MOZALLOC_EXPORT char* moz_strdup(const char* str)
     NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
 
 MOZALLOC_EXPORT size_t moz_malloc_usable_size(void *ptr);
 
-MOZALLOC_EXPORT size_t moz_malloc_size_of(const void *ptr, size_t computedSize);
+MOZALLOC_EXPORT size_t moz_malloc_size_of(const void *ptr);
 
 #if defined(HAVE_STRNDUP)
 MOZALLOC_EXPORT char* moz_xstrndup(const char* str, size_t strsize)
     NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
 
 MOZALLOC_EXPORT char* moz_strndup(const char* str, size_t strsize)
     NS_ATTR_MALLOC NS_WARN_UNUSED_RESULT;
 #endif /* if defined(HAVE_STRNDUP) */
--- a/netwerk/cache/nsDiskCacheMap.cpp
+++ b/netwerk/cache/nsDiskCacheMap.cpp
@@ -164,18 +164,17 @@ nsDiskCacheMap::Open(nsILocalFile *  cac
     // set dirty bit and flush header
     mHeader.mIsDirty    = true;
     rv = FlushHeader();
     if (NS_FAILED(rv))  goto error_exit;
     
     {
         // extra scope so the compiler doesn't barf on the above gotos jumping
         // past this declaration down here
-        PRUint32 overhead =
-            moz_malloc_size_of(mRecordArray, mHeader.mRecordCount * sizeof(nsDiskCacheRecord));
+        PRUint32 overhead = moz_malloc_size_of(mRecordArray);
         mozilla::Telemetry::Accumulate(mozilla::Telemetry::HTTP_DISK_CACHE_OVERHEAD,
                 overhead);
     }
 
     return NS_OK;
     
 error_exit:
     (void) Close(false);
--- a/startupcache/StartupCache.cpp
+++ b/startupcache/StartupCache.cpp
@@ -362,17 +362,17 @@ StartupCache::SizeOfMapping()
     return mArchive ? mArchive->SizeOfMapping() : 0;
 }
 
 size_t
 StartupCache::HeapSizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
 {
     // This function could measure more members, but they haven't been found by
     // DMD to be significant.  They can be added later if necessary.
-    return aMallocSizeOf(this, sizeof(StartupCache)) +
+    return aMallocSizeOf(this) +
            mTable.SizeOfExcludingThis(SizeOfEntryExcludingThis, aMallocSizeOf);
 }
 
 /* static */ size_t
 StartupCache::SizeOfEntryExcludingThis(const nsACString& key, const nsAutoPtr<CacheEntry>& data,
                                        nsMallocSizeOfFun mallocSizeOf, void *)
 {
     return data->SizeOfExcludingThis(mallocSizeOf);
--- a/startupcache/StartupCache.h
+++ b/startupcache/StartupCache.h
@@ -110,17 +110,17 @@ struct CacheEntry
   // Takes possession of buf
   CacheEntry(char* buf, PRUint32 len) : data(buf), size(len) { }
 
   ~CacheEntry()
   {
   }
 
   size_t SizeOfExcludingThis(nsMallocSizeOfFun mallocSizeOf) {
-    return mallocSizeOf(data, size);
+    return mallocSizeOf(data);
   }
 };
 
 // We don't want to refcount StartupCache, and ObserverService wants to
 // refcount its listeners, so we'll let it refcount this instead.
 class StartupCacheListener : public nsIObserver
 {
   NS_DECL_ISUPPORTS
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -1700,17 +1700,17 @@ History::FetchPageInfo(VisitData& _place
 History::SizeOfEntryExcludingThis(KeyClass* aEntry, nsMallocSizeOfFun aMallocSizeOf, void *)
 {
   return aEntry->array.SizeOfExcludingThis(aMallocSizeOf);
 }
 
 size_t
 History::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOfThis)
 {
-  return aMallocSizeOfThis(this, sizeof(History)) +
+  return aMallocSizeOfThis(this) +
          mObservers.SizeOfExcludingThis(SizeOfEntryExcludingThis, aMallocSizeOfThis);
 }
 
 /* static */
 History*
 History::GetService()
 {
   if (gService) {
--- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
@@ -345,17 +345,17 @@ nsUrlClassifierPrefixSet::Contains(PRUin
   return NS_OK;
 }
 
 size_t
 nsUrlClassifierPrefixSet::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
 {
   MutexAutoLock lock(mPrefixSetLock);
   size_t n = 0;
-  n += aMallocSizeOf(this, sizeof(nsUrlClassifierPrefixSet));
+  n += aMallocSizeOf(this);
   n += mDeltas.SizeOfExcludingThis(aMallocSizeOf);
   n += mIndexPrefixes.SizeOfExcludingThis(aMallocSizeOf);
   n += mIndexStarts.SizeOfExcludingThis(aMallocSizeOf);
   return n;
 }
 
 NS_IMETHODIMP
 nsUrlClassifierPrefixSet::IsEmpty(bool * aEmpty)
--- a/xpcom/base/nsIMemoryReporter.idl
+++ b/xpcom/base/nsIMemoryReporter.idl
@@ -340,45 +340,42 @@ nsresult NS_UnregisterMemoryMultiReporte
 #endif
 #include "dmd.h"
 #endif
 
 namespace mozilla {
 
 /*
  * Functions generated via this macro should be used by all traversal-based
- * memory reporters.  Such functions return moz_malloc_usable_size(ptr),
- * which will be 0 on obscure platforms that don't implement
- * malloc_usable_size() or an equivalent.
- *
- * XXX: bug 715453 will remove the unused |computedSize| argument.
+ * memory reporters.  Such functions return |moz_malloc_size_of(ptr)|;  this
+ * will always be zero on some obscure platforms.
  *
  * You might be wondering why we have a macro that creates multiple functions
  * distinguished only by |name|, instead of a single MemoryReporterMallocSizeOf
  * function.  It's mostly to help with DMD integration, though it sometimes
  * also helps with debugging and temporary ad hoc profiling.  The |name| chosen
  * doesn't matter greatly, but it's best to make it similar to the path used by
  * the relevant memory reporter(s).
  */
 #define NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN(fn, name)                        \
-  size_t fn(const void *ptr, size_t computedSize)                             \
+  size_t fn(const void *ptr)                                                  \
   {                                                                           \
-      size_t usable = moz_malloc_usable_size((void*)ptr);                     \
+      size_t usable = moz_malloc_size_of(ptr);                                \
       VALGRIND_DMD_REPORT(ptr, usable, name);                                 \
       return usable;                                                          \
   }
 
 /*
  * Like NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN, but the created function sends an
  * "unreport" message to DMD.
  */
 #define NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN_UN(fn)                           \
-  size_t fn(const void *ptr, size_t computedSize)                             \
+  size_t fn(const void *ptr)                                                  \
   {                                                                           \
-      size_t usable = moz_malloc_usable_size((void*)ptr);                     \
+      size_t usable = moz_malloc_size_of(ptr);                                \
       VALGRIND_DMD_UNREPORT(ptr);                                             \
       return usable;                                                          \
   }
 
 #ifdef MOZ_DMD
 
 /*
  * This runs all the memory reporters but does nothing with the results;  i.e.
--- a/xpcom/base/nscore.h
+++ b/xpcom/base/nscore.h
@@ -53,21 +53,20 @@
 #endif
 
 /**
  * Incorporate the core NSPR data types which XPCOM uses.
  */
 #include "prtypes.h"
 
 /*
- * This is for functions that are like malloc_usable_size but also take a
- * computed size as a fallback.  Such functions are used for measuring the size
- * of data structures.
+ * This is for functions that are like malloc_usable_size.  Such functions are
+ * used for measuring the size of data structures.
  */
-typedef size_t(*nsMallocSizeOfFun)(const void *p, size_t computedSize);
+typedef size_t(*nsMallocSizeOfFun)(const void *p);
 
 /* Core XPCOM declarations. */
 
 /*----------------------------------------------------------------------*/
 /* Import/export defines */
 
 /**
  * Using the visibility("hidden") attribute allows the compiler to use
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -448,17 +448,17 @@ NS_IMETHODIMP_(bool)
 AtomImpl::IsStaticAtom()
 {
   return IsPermanent();
 }
 
 size_t
 AtomImpl::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const
 {
-  return aMallocSizeOf(this, sizeof(AtomImpl)) +
+  return aMallocSizeOf(this) +
          nsStringBuffer::FromData(mString)->
            SizeOfIncludingThisIfUnshared(aMallocSizeOf);
 }
 
 //----------------------------------------------------------------------
 
 static size_t
 SizeOfAtomTableEntryExcludingThis(PLDHashEntryHdr *aHdr,
--- a/xpcom/glue/nsTArray.h
+++ b/xpcom/glue/nsTArray.h
@@ -517,26 +517,23 @@ public:
     return *this;
   }
 
   // @return The amount of memory used by this nsTArray, excluding
   // sizeof(*this).
   size_t SizeOfExcludingThis(nsMallocSizeOfFun mallocSizeOf) const {
     if (this->UsesAutoArrayBuffer() || Hdr() == EmptyHdr())
       return 0;
-    return mallocSizeOf(this->Hdr(), 
-                        sizeof(nsTArrayHeader) +
-                        this->Capacity() * sizeof(elem_type));
+    return mallocSizeOf(this->Hdr());
   }
 
   // @return The amount of memory used by this nsTArray, including
   // sizeof(*this).
   size_t SizeOfIncludingThis(nsMallocSizeOfFun mallocSizeOf) const {
-    return mallocSizeOf(this, sizeof(nsTArray)) +
-           SizeOfExcludingThis(mallocSizeOf);
+    return mallocSizeOf(this) + SizeOfExcludingThis(mallocSizeOf);
   }
 
   //
   // Accessor methods
   //
 
   // This method provides direct access to the array elements.
   // @return A pointer to the first element of the array.  If the array is
--- a/xpcom/glue/pldhash.cpp
+++ b/xpcom/glue/pldhash.cpp
@@ -813,35 +813,33 @@ SizeOfEntryExcludingThisEnumerator(PLDHa
 
 size_t
 PL_DHashTableSizeOfExcludingThis(const PLDHashTable *table,
                                  PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis,
                                  nsMallocSizeOfFun mallocSizeOf,
                                  void *arg /* = NULL */)
 {
     size_t n = 0;
-    n += mallocSizeOf(table->entryStore,
-                      PL_DHASH_TABLE_SIZE(table) * table->entrySize +
-                      ENTRY_STORE_EXTRA);
+    n += mallocSizeOf(table->entryStore);
     if (sizeOfEntryExcludingThis) {
         SizeOfEntryExcludingThisArg arg2 = { 0, sizeOfEntryExcludingThis, mallocSizeOf, arg };
         PL_DHashTableEnumerate(const_cast<PLDHashTable *>(table),
                                SizeOfEntryExcludingThisEnumerator, &arg2);
         n += arg2.total;
     }
     return n;
 }
 
 size_t
 PL_DHashTableSizeOfIncludingThis(const PLDHashTable *table,
                                  PLDHashSizeOfEntryExcludingThisFun sizeOfEntryExcludingThis,
                                  nsMallocSizeOfFun mallocSizeOf,
                                  void *arg /* = NULL */)
 {
-    return mallocSizeOf(table, sizeof(PLDHashTable)) +
+    return mallocSizeOf(table) +
            PL_DHashTableSizeOfExcludingThis(table, sizeOfEntryExcludingThis,
                                             mallocSizeOf, arg);
 }
 
 #ifdef DEBUG
 void
 PL_DHashMarkTableImmutable(PLDHashTable *table)
 {
--- a/xpcom/string/src/nsSubstring.cpp
+++ b/xpcom/string/src/nsSubstring.cpp
@@ -307,17 +307,17 @@ nsStringBuffer::ToString(PRUint32 len, n
     accessor->set(data, len, flags);
   }
 
 size_t
 nsStringBuffer::SizeOfIncludingThisIfUnshared(nsMallocSizeOfFun aMallocSizeOf) const
   {
     if (!IsReadonly())
       {
-        return aMallocSizeOf(this, sizeof(nsStringBuffer) + mStorageSize);
+        return aMallocSizeOf(this);
       }
     return 0;
   }
 
 // ---------------------------------------------------------------------------
 
 
   // define nsSubstring
--- a/xpcom/typelib/xpt/public/xpt_arena.h
+++ b/xpcom/typelib/xpt/public/xpt_arena.h
@@ -78,17 +78,17 @@ XPT_ArenaStrDup(XPTArena *arena, const c
 
 XPT_PUBLIC_API(void)
 XPT_NotifyDoneLoading(XPTArena *arena);
 
 XPT_PUBLIC_API(void)
 XPT_ArenaFree(XPTArena *arena, void* block);
 
 /* A synonym of |nsMallocSizeOfFun|, because we don't #include nscore.h. */
-typedef size_t(*xptMallocSizeOfFun)(const void *p, size_t computedSize);
+typedef size_t(*xptMallocSizeOfFun)(const void *p);
 
 XPT_PUBLIC_API(size_t)
 XPT_SizeOfArena(XPTArena *arena, xptMallocSizeOfFun mallocSizeOf);
 
 /* --------------------------------------------------------- */
 
 #define XPT_MALLOC(_arena, _bytes) \
     XPT_ArenaMalloc((_arena), (_bytes))
--- a/xpcom/typelib/xpt/src/xpt_arena.c
+++ b/xpcom/typelib/xpt/src/xpt_arena.c
@@ -335,27 +335,27 @@ XPT_AssertFailed(const char *s, const ch
             s, file, lineno);
     abort();
 }        
 #endif
 
 XPT_PUBLIC_API(size_t)
 XPT_SizeOfArena(XPTArena *arena, xptMallocSizeOfFun mallocSizeOf)
 {
-    size_t n = mallocSizeOf(arena, sizeof(XPTArena));
+    size_t n = mallocSizeOf(arena);
 
     /*
      * We don't measure arena->name separately because it's allocated out of
      * the arena itself.
      */
 
     BLK_HDR* cur;
     BLK_HDR* next;
         
     cur = arena->first;
     while (cur) {
         next = cur->next;
-        n += mallocSizeOf(cur, cur->size);
+        n += mallocSizeOf(cur);
         cur = next;
     }
 
     return n;
 }