Bug 820652 (part 2) - DMD: Embriefen the hash policy of LiveBlockGroup and DoubleReportBlockGroup. r=jlebar.
authorNicholas Nethercote <nnethercote@mozilla.com>
Tue, 11 Dec 2012 19:46:53 -0800
changeset 116005 a77821dd8903272559f491197d5acd1f0c2fb26e
parent 116004 f5fbf4fc5df282891115bee516bfdb1f373fed03
child 116006 f54a6f692591a32581373200fbe4618cc13a3854
push id24034
push useremorley@mozilla.com
push dateFri, 14 Dec 2012 15:28:57 +0000
treeherdermozilla-central@50d8f411d305 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlebar
bugs820652
milestone20.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 820652 (part 2) - DMD: Embriefen the hash policy of LiveBlockGroup and DoubleReportBlockGroup. r=jlebar.
memory/replace/dmd/DMD.cpp
--- a/memory/replace/dmd/DMD.cpp
+++ b/memory/replace/dmd/DMD.cpp
@@ -680,33 +680,35 @@ public:
 
   bool IsReported() const
   {
     MOZ_ASSERT(IsSane());
     bool isRep = mReporterName != gUnreportedName;
     return isRep;
   }
 
-  // Quasi-hash policy (used by LiveBlockGroup's hash policy).
+  // Hash policy.
   //
-  // Hash() and Match() both assume that identical reporter names have
+  // hash() and match() both assume that identical reporter names have
   // identical pointers.  In practice this always happens because they are
   // static strings (as specified in the NS_MEMORY_REPORTER_MALLOC_SIZEOF_FUN
   // macro).  This is true even for multi-reporters.  (If it ever became
   // untrue, the worst that would happen is that some blocks that should be in
   // the same block group would end up in separate block groups.)
 
-  static uint32_t Hash(const LiveBlockKey& aKey)
+  typedef LiveBlockKey Lookup;
+
+  static uint32_t hash(const LiveBlockKey& aKey)
   {
     return mozilla::HashGeneric(aKey.mAllocStackTrace,
                                 aKey.mReportStackTrace,
                                 aKey.mReporterName);
   }
 
-  static bool Match(const LiveBlockKey& aA, const LiveBlockKey& aB)
+  static bool match(const LiveBlockKey& aA, const LiveBlockKey& aB)
   {
     return aA.mAllocStackTrace  == aB.mAllocStackTrace &&
            aA.mReportStackTrace == aB.mReportStackTrace &&
            aA.mReporterName     == aB.mReporterName;
   }
 };
 
 // This is used by DoubleReportBlockGroups.
@@ -742,31 +744,33 @@ public:
   {
     return mAllocStackTrace &&
            mReportStackTrace1 &&
            mReportStackTrace2 &&
            mReporterName1 != gUnreportedName &&
            mReporterName2 != gUnreportedName;
   }
 
-  // Quasi-hash policy (used by DoubleReportBlockGroup's hash policy).
+  // Hash policy.
   //
-  // Hash() and Match() both assume that identical reporter names have
+  // hash() and match() both assume that identical reporter names have
   // identical pointers.  See LiveBlockKey for more.
 
-  static uint32_t Hash(const DoubleReportBlockKey& aKey)
+  typedef DoubleReportBlockKey Lookup;
+
+  static uint32_t hash(const DoubleReportBlockKey& aKey)
   {
     return mozilla::HashGeneric(aKey.mAllocStackTrace,
                                 aKey.mReportStackTrace1,
                                 aKey.mReportStackTrace2,
                                 aKey.mReporterName1,
                                 aKey.mReporterName2);
   }
 
-  static bool Match(const DoubleReportBlockKey& aA,
+  static bool match(const DoubleReportBlockKey& aA,
                     const DoubleReportBlockKey& aB)
   {
     return aA.mAllocStackTrace   == aB.mAllocStackTrace &&
            aA.mReportStackTrace1 == aB.mReportStackTrace1 &&
            aA.mReportStackTrace2 == aB.mReportStackTrace2 &&
            aA.mReporterName1     == aB.mReporterName1 &&
            aA.mReporterName2     == aB.mReporterName2;
   }
@@ -1091,30 +1095,16 @@ public:
   {
     const LiveBlockGroup* const a =
       *static_cast<const LiveBlockGroup* const*>(aA);
     const LiveBlockGroup* const b =
       *static_cast<const LiveBlockGroup* const*>(aB);
 
     return BlockSize::Cmp(a->mCombinedSize, b->mCombinedSize);
   }
-
-  // Hash policy
-
-  typedef LiveBlockKey Lookup;
-
-  static uint32_t hash(const LiveBlockKey& aKey)
-  {
-    return LiveBlockKey::Hash(aKey);
-  }
-
-  static bool match(const LiveBlockGroup& aBg, const LiveBlockKey& aKey)
-  {
-    return LiveBlockKey::Match(aBg, aKey);
-  }
 };
 
 typedef js::HashSet<LiveBlockGroup, LiveBlockGroup, InfallibleAllocPolicy>
         LiveBlockGroupTable;
 
 void
 LiveBlockGroup::Print(const Writer& aWriter, uint32_t aM, uint32_t aN,
                       const char* aStr, const char* astr,
@@ -1172,31 +1162,16 @@ public:
   {
     const DoubleReportBlockGroup* const a =
       *static_cast<const DoubleReportBlockGroup* const*>(aA);
     const DoubleReportBlockGroup* const b =
       *static_cast<const DoubleReportBlockGroup* const*>(aB);
 
     return BlockSize::Cmp(a->mCombinedSize, b->mCombinedSize);
   }
-
-  // Hash policy
-
-  typedef DoubleReportBlockKey Lookup;
-
-  static uint32_t hash(const DoubleReportBlockKey& aKey)
-  {
-    return DoubleReportBlockKey::Hash(aKey);
-  }
-
-  static bool match(const DoubleReportBlockGroup& aBg,
-                    const DoubleReportBlockKey& aKey)
-  {
-    return DoubleReportBlockKey::Match(aBg, aKey);
-  }
 };
 
 typedef js::HashSet<DoubleReportBlockGroup, DoubleReportBlockGroup,
                     InfallibleAllocPolicy> DoubleReportBlockGroupTable;
 DoubleReportBlockGroupTable* gDoubleReportBlockGroupTable = nullptr;
 
 void
 DoubleReportBlockGroup::Print(const Writer& aWriter, uint32_t aM, uint32_t aN,