Ignore:
Timestamp:
Jun 30, 2008, 8:58:27 AM (17 years ago)
Author:
Adam Roben
Message:

Fix <rdar://5954749> Assertion failure due to HashTable's use of operator&

JavaScriptCore:

Fix <rdar://5954749> Assertion failure due to HashTable's use of
operator&

HashTable was passing &value to constructDeletedValue, which in
classes like WebCore::COMPtr would cause an assertion. We now pass
value by reference instead of by address so that the HashTraits
implementations have more flexibility in constructing the deleted
value.

Reviewed by Ada Chan.

  • VM/CodeGenerator.h: Updated for changes to HashTraits.
  • wtf/HashTable.h: (WTF::::deleteBucket): Changed to pass bucket by reference instead of by address. (WTF::::checkKey): Ditto.
  • wtf/HashTraits.h: (WTF::): Updated HashTraits for HashTable change.

WebCore:

Fix <rdar://5954749> Assertion failure due to HashTable's use of
operator&

Reviewed by Ada Chan.

  • bindings/js/JSSVGPODTypeWrapper.h:
  • dom/Document.h:
  • dom/StyledElement.cpp:
  • platform/graphics/FontCache.cpp:
  • platform/graphics/IntSizeHash.h: (WTF::):
  • platform/text/StringHash.h:
  • platform/win/COMPtr.h:
  • svg/SVGAnimatedTemplate.h: Updated all custom HashTraits for HashTable changes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/wtf/HashTraits.h

    r32650 r34891  
    8787        static const bool emptyValueIsZero = true;
    8888        static const bool needsDestruction = false;
    89         static void constructDeletedValue(T* slot) { *slot = static_cast<T>(-1); }
     89        static void constructDeletedValue(T& slot) { slot = static_cast<T>(-1); }
    9090        static bool isDeletedValue(T value) { return value == static_cast<T>(-1); }
    9191    };
     
    101101        static const bool needsDestruction = false;
    102102        static T emptyValue() { return std::numeric_limits<T>::infinity(); }
    103         static void constructDeletedValue(T* slot) { *slot = -std::numeric_limits<T>::infinity(); }
     103        static void constructDeletedValue(T& slot) { slot = -std::numeric_limits<T>::infinity(); }
    104104        static bool isDeletedValue(T value) { return value == -std::numeric_limits<T>::infinity(); }
    105105    };
     
    111111        static const bool emptyValueIsZero = true;
    112112        static const bool needsDestruction = false;
    113         static void constructDeletedValue(P** slot) { *slot = reinterpret_cast<P*>(-1); }
     113        static void constructDeletedValue(P*& slot) { slot = reinterpret_cast<P*>(-1); }
    114114        static bool isDeletedValue(P* value) { return value == reinterpret_cast<P*>(-1); }
    115115    };
     
    117117    template<typename P> struct HashTraits<RefPtr<P> > : GenericHashTraits<RefPtr<P> > {
    118118        static const bool emptyValueIsZero = true;
    119         static void constructDeletedValue(RefPtr<P>* slot) { new (slot) RefPtr<P>(HashTableDeletedValue); }
     119        static void constructDeletedValue(RefPtr<P>& slot) { new (&slot) RefPtr<P>(HashTableDeletedValue); }
    120120        static bool isDeletedValue(const RefPtr<P>& value) { return value.isHashTableDeletedValue(); }
    121121    };
     
    134134        static const bool needsDestruction = FirstTraits::needsDestruction || SecondTraits::needsDestruction;
    135135
    136         static void constructDeletedValue(TraitType* slot) { FirstTraits::constructDeletedValue(&slot->first); }
     136        static void constructDeletedValue(TraitType& slot) { FirstTraits::constructDeletedValue(slot.first); }
    137137        static bool isDeletedValue(const TraitType& value) { return FirstTraits::isDeletedValue(value.first); }
    138138    };
Note: See TracChangeset for help on using the changeset viewer.