Bug 1488453 - Use release mode assertions in HashTable, r=mccr8.
authorBrian Hackett <bhackett1024@gmail.com>
Sat, 20 Oct 2018 09:22:11 -0600
changeset 491283 16d26c24fa86c7f5c4e6f2634ace2b06181fd294
parent 491282 e55f02b20a9ced3c912ab4642c32a77e4337c11b
child 491284 5a812d8c724e4d85f5deec93b0f1972efb325f03
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersmccr8
bugs1488453
milestone65.0a1
Bug 1488453 - Use release mode assertions in HashTable, r=mccr8.
toolkit/recordreplay/HashTable.cpp
--- a/toolkit/recordreplay/HashTable.cpp
+++ b/toolkit/recordreplay/HashTable.cpp
@@ -82,17 +82,17 @@ class StableHashTableInfo
 
   // Buffer with executable memory for use in binding functions.
   uint8_t* mCallbackStorage;
   static const size_t CallbackStorageCapacity = 4096;
 
   // Get an existing key in the table.
   KeyInfo* FindKeyInfo(HashNumber aOriginalHash, const void* aKey, HashInfo** aHashInfo = nullptr) {
     HashToKeyMap::iterator iter = mHashToKey.find(aOriginalHash);
-    MOZ_ASSERT(iter != mHashToKey.end());
+    MOZ_RELEASE_ASSERT(iter != mHashToKey.end());
 
     HashInfo* hashInfo = iter->second.get();
     for (KeyInfo& keyInfo : hashInfo->mKeys) {
       if (keyInfo.mKey == aKey) {
         if (aHashInfo) {
           *aHashInfo = hashInfo;
         }
         return &keyInfo;
@@ -109,17 +109,17 @@ public:
     , mHashGenerator(0)
     , mCallbackStorage(nullptr)
   {
     // Use AllocateMemory, as the result will have RWX permissions.
     mCallbackStorage = (uint8_t*) AllocateMemory(CallbackStorageCapacity, MemoryKind::Tracked);
   }
 
   ~StableHashTableInfo() {
-    MOZ_ASSERT(mHashToKey.empty());
+    MOZ_RELEASE_ASSERT(mHashToKey.empty());
     DeallocateMemory(mCallbackStorage, CallbackStorageCapacity, MemoryKind::Tracked);
   }
 
   bool AppearsValid() {
     return mMagic == MagicNumber;
   }
 
   void AddKey(HashNumber aOriginalHash, const void* aKey, HashNumber aNewHash) {
@@ -170,17 +170,17 @@ public:
         }
       }
     }
     return false;
   }
 
   HashNumber GetOriginalHashNumber(const void* aKey) {
     KeyToHashMap::iterator iter = mKeyToHash.find(aKey);
-    MOZ_ASSERT(iter != mKeyToHash.end());
+    MOZ_RELEASE_ASSERT(iter != mKeyToHash.end());
     return iter->second;
   }
 
   class Assembler : public recordreplay::Assembler {
   public:
     explicit Assembler(StableHashTableInfo& aInfo)
       : recordreplay::Assembler(aInfo.mCallbackStorage, CallbackStorageCapacity)
     {}
@@ -207,17 +207,17 @@ public:
     return mLastNewHash;
   }
 
   bool HasLastKey() {
     return !!mLastKey;
   }
 
   HashNumber GetLastNewHash(const void* aKey) {
-    MOZ_ASSERT(aKey == mLastKey);
+    MOZ_RELEASE_ASSERT(aKey == mLastKey);
     return mLastNewHash;
   }
 
   bool IsEmpty() { return mHashToKey.empty(); }
 
   // Move aOther's contents into this one and clear aOther out. Callbacks for
   // the tables are left alone.
   void MoveContentsFrom(StableHashTableInfo& aOther) {
@@ -297,17 +297,17 @@ WrapPLHashAllocEntry(void* aAllocPrivate
   if (info->HasLastKey()) {
     uint32_t originalHash = info->mKeyHash(aKey);
     info->AddKey(originalHash, aKey, info->GetLastNewHash(aKey));
   } else {
     // A few PLHashTables are manipulated directly by Gecko code, in which case
     // the hashes are supplied directly to the table and we don't have a chance
     // to modify them. Fortunately, none of these tables are iterated in a way
     // that can cause the replay to diverge, so just punt in these cases.
-    MOZ_ASSERT(info->IsEmpty());
+    MOZ_RELEASE_ASSERT(info->IsEmpty());
   }
 
   return info->mAllocOps
          ? info->mAllocOps->allocEntry(info->mAllocPrivate, aKey)
          : (PLHashEntry*) malloc(sizeof(PLHashEntry));
 }
 
 static void