Bug 939993 - Add assert that hash key is still valid in HashTable::relookupOrAdd r=sfink
authorJon Coppeard <jcoppeard@mozilla.com>
Sat, 07 Dec 2013 12:50:52 +0000
changeset 159367 72c344b0e588abd2e340ca2dc278a9a27b559cab
parent 159366 8b341b232aa25db64897076420709966fe558bf6
child 159368 162e0b8608a14cb3643249f9bae34fd1d05cc089
push id25787
push userphilringnalda@gmail.com
push dateSat, 07 Dec 2013 23:09:36 +0000
treeherdermozilla-central@edac8cba9f78 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssfink
bugs939993
milestone28.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 939993 - Add assert that hash key is still valid in HashTable::relookupOrAdd r=sfink
js/public/HashTable.h
--- a/js/public/HashTable.h
+++ b/js/public/HashTable.h
@@ -1518,16 +1518,17 @@ class HashTable : private AllocPolicy
     // Note: |l| may be a reference to a piece of |u|, so this function
     // must take care not to use |l| after moving |u|.
     template <class U>
     bool relookupOrAdd(AddPtr& p, const Lookup &l, U &&u)
     {
         p.mutationCount = mutationCount;
         {
             mozilla::ReentrancyGuard g(*this);
+            JS_ASSERT(prepareHash(l) == p.keyHash); // l has not been destroyed
             p.entry_ = &lookup(l, p.keyHash, sCollisionBit);
         }
         return p.found() || add(p, mozilla::Forward<U>(u));
     }
 
     void remove(Ptr p)
     {
         JS_ASSERT(table);