Changeset 34891 in webkit for trunk/JavaScriptCore/wtf
- Timestamp:
- Jun 30, 2008, 8:58:27 AM (17 years ago)
- Location:
- trunk/JavaScriptCore/wtf
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/wtf/HashTable.h
r32877 r34891 365 365 366 366 static void initializeBucket(ValueType& bucket) { new (&bucket) ValueType(Traits::emptyValue()); } 367 static void deleteBucket(ValueType& bucket) { bucket.~ValueType(); Traits::constructDeletedValue( &bucket); }367 static void deleteBucket(ValueType& bucket) { bucket.~ValueType(); Traits::constructDeletedValue(bucket); } 368 368 369 369 FullLookupType makeLookupResult(ValueType* position, bool found, unsigned hash) … … 445 445 ValueType deletedValue = Traits::emptyValue(); 446 446 deletedValue.~ValueType(); 447 Traits::constructDeletedValue( &deletedValue);447 Traits::constructDeletedValue(deletedValue); 448 448 ASSERT(!HashTranslator::equal(Extractor::extract(deletedValue), key)); 449 449 new (&deletedValue) ValueType(Traits::emptyValue()); -
trunk/JavaScriptCore/wtf/HashTraits.h
r32650 r34891 87 87 static const bool emptyValueIsZero = true; 88 88 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); } 90 90 static bool isDeletedValue(T value) { return value == static_cast<T>(-1); } 91 91 }; … … 101 101 static const bool needsDestruction = false; 102 102 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(); } 104 104 static bool isDeletedValue(T value) { return value == -std::numeric_limits<T>::infinity(); } 105 105 }; … … 111 111 static const bool emptyValueIsZero = true; 112 112 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); } 114 114 static bool isDeletedValue(P* value) { return value == reinterpret_cast<P*>(-1); } 115 115 }; … … 117 117 template<typename P> struct HashTraits<RefPtr<P> > : GenericHashTraits<RefPtr<P> > { 118 118 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); } 120 120 static bool isDeletedValue(const RefPtr<P>& value) { return value.isHashTableDeletedValue(); } 121 121 }; … … 134 134 static const bool needsDestruction = FirstTraits::needsDestruction || SecondTraits::needsDestruction; 135 135 136 static void constructDeletedValue(TraitType * slot) { FirstTraits::constructDeletedValue(&slot->first); }136 static void constructDeletedValue(TraitType& slot) { FirstTraits::constructDeletedValue(slot.first); } 137 137 static bool isDeletedValue(const TraitType& value) { return FirstTraits::isDeletedValue(value.first); } 138 138 };
Note:
See TracChangeset
for help on using the changeset viewer.