diff --git a/js/public/GCHashTable.h b/js/public/GCHashTable.h index 0a91ce8922bf..9d2b83a626a2 100644 --- a/js/public/GCHashTable.h +++ b/js/public/GCHashTable.h @@ -65,10 +65,7 @@ class GCHashMap : public HashMap, return; for (typename Base::Enum e(*this); !e.empty(); e.popFront()) { GCPolicy::ValuePolicy::trace(trc, &e.front().value(), "hashmap value"); - Key key = e.front().key(); - GCPolicy::KeyPolicy::trace(trc, &key, "hashmap key"); - if (key != e.front().key()) - e.rekeyFront(key); + GCPolicy::KeyPolicy::trace(trc, &e.front().mutableKey(), "hashmap key"); } } @@ -210,12 +207,8 @@ class GCHashSet : public HashSet, void trace(JSTracer* trc) { if (!this->initialized()) return; - for (typename Base::Enum e(*this); !e.empty(); e.popFront()) { - T elem = e.front(); - GCPolicy::trace(trc, &elem, "hashset element"); - if (elem != e.front()) - e.rekeyFront(elem); - } + for (typename Base::Enum e(*this); !e.empty(); e.popFront()) + GCPolicy::trace(trc, &e.mutableFront(), "hashset element"); } void sweep() {