Title: [219347] trunk/Source/WTF
- Revision
- 219347
- Author
- [email protected]
- Date
- 2017-07-11 11:20:57 -0700 (Tue, 11 Jul 2017)
Log Message
[WTF] Drop unnecessary AtomicString constructor since we have constexpr hash function
https://bugs.webkit.org/show_bug.cgi?id=174347
Reviewed by Alex Christensen.
Previously, we calculate hash value in perl script and generate source code with that value.
This AtomicString constructor takes this pre-calculated hash value to efficiently construct
itself. But now, we have constexpr hash function, then we do not need to specify hash value
directly in this way. Thus we drop this functionality.
* wtf/text/AtomicString.h:
* wtf/text/AtomicStringImpl.cpp:
(WTF::HashAndCharactersTranslator::hash): Deleted.
(WTF::HashAndCharactersTranslator::equal): Deleted.
(WTF::HashAndCharactersTranslator::translate): Deleted.
* wtf/text/AtomicStringImpl.h:
(WTF::AtomicStringImpl::add):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (219346 => 219347)
--- trunk/Source/WTF/ChangeLog 2017-07-11 18:13:44 UTC (rev 219346)
+++ trunk/Source/WTF/ChangeLog 2017-07-11 18:20:57 UTC (rev 219347)
@@ -1,3 +1,23 @@
+2017-07-11 Yusuke Suzuki <[email protected]>
+
+ [WTF] Drop unnecessary AtomicString constructor since we have constexpr hash function
+ https://bugs.webkit.org/show_bug.cgi?id=174347
+
+ Reviewed by Alex Christensen.
+
+ Previously, we calculate hash value in perl script and generate source code with that value.
+ This AtomicString constructor takes this pre-calculated hash value to efficiently construct
+ itself. But now, we have constexpr hash function, then we do not need to specify hash value
+ directly in this way. Thus we drop this functionality.
+
+ * wtf/text/AtomicString.h:
+ * wtf/text/AtomicStringImpl.cpp:
+ (WTF::HashAndCharactersTranslator::hash): Deleted.
+ (WTF::HashAndCharactersTranslator::equal): Deleted.
+ (WTF::HashAndCharactersTranslator::translate): Deleted.
+ * wtf/text/AtomicStringImpl.h:
+ (WTF::AtomicStringImpl::add):
+
2017-07-10 Per Arne Vollan <[email protected]>
[Win] Link error when building WTF from WTF.proj project file.
Modified: trunk/Source/WTF/wtf/text/AtomicString.h (219346 => 219347)
--- trunk/Source/WTF/wtf/text/AtomicString.h 2017-07-11 18:13:44 UTC (rev 219346)
+++ trunk/Source/WTF/wtf/text/AtomicString.h 2017-07-11 18:20:57 UTC (rev 219347)
@@ -48,7 +48,6 @@
AtomicString(const char*);
AtomicString(const LChar*, unsigned length);
AtomicString(const UChar*, unsigned length);
- AtomicString(const UChar*, unsigned length, unsigned existingHash);
AtomicString(const UChar*);
template<size_t inlineCapacity>
@@ -249,11 +248,6 @@
{
}
-inline AtomicString::AtomicString(const UChar* s, unsigned length, unsigned existingHash)
- : m_string(AtomicStringImpl::add(s, length, existingHash))
-{
-}
-
inline AtomicString::AtomicString(const UChar* s)
: m_string(AtomicStringImpl::add(s))
{
Modified: trunk/Source/WTF/wtf/text/AtomicStringImpl.cpp (219346 => 219347)
--- trunk/Source/WTF/wtf/text/AtomicStringImpl.cpp 2017-07-11 18:13:44 UTC (rev 219346)
+++ trunk/Source/WTF/wtf/text/AtomicStringImpl.cpp 2017-07-11 18:20:57 UTC (rev 219347)
@@ -149,34 +149,6 @@
}
};
-template<typename CharacterType>
-struct HashAndCharacters {
- unsigned hash;
- const CharacterType* characters;
- unsigned length;
-};
-
-template<typename CharacterType>
-struct HashAndCharactersTranslator {
- static unsigned hash(const HashAndCharacters<CharacterType>& buffer)
- {
- ASSERT(buffer.hash == StringHasher::computeHashAndMaskTop8Bits(buffer.characters, buffer.length));
- return buffer.hash;
- }
-
- static bool equal(StringImpl* const& string, const HashAndCharacters<CharacterType>& buffer)
- {
- return WTF::equal(string, buffer.characters, buffer.length);
- }
-
- static void translate(StringImpl*& location, const HashAndCharacters<CharacterType>& buffer, unsigned hash)
- {
- location = &StringImpl::create(buffer.characters, buffer.length).leakRef();
- location->setHash(hash);
- location->setIsAtomic(true);
- }
-};
-
struct HashAndUTF8Characters {
unsigned hash;
const char* characters;
@@ -257,18 +229,6 @@
return addToStringTable<UCharBuffer, UCharBufferTranslator>(buffer);
}
-Ref<AtomicStringImpl> AtomicStringImpl::add(const UChar* s, unsigned length, unsigned existingHash)
-{
- ASSERT(s);
- ASSERT(existingHash);
-
- if (!length)
- return *static_cast<AtomicStringImpl*>(StringImpl::empty());
-
- HashAndCharacters<UChar> buffer = { existingHash, s, length };
- return addToStringTable<HashAndCharacters<UChar>, HashAndCharactersTranslator<UChar>>(buffer);
-}
-
RefPtr<AtomicStringImpl> AtomicStringImpl::add(const UChar* s)
{
if (!s)
Modified: trunk/Source/WTF/wtf/text/AtomicStringImpl.h (219346 => 219347)
--- trunk/Source/WTF/wtf/text/AtomicStringImpl.h 2017-07-11 18:13:44 UTC (rev 219346)
+++ trunk/Source/WTF/wtf/text/AtomicStringImpl.h 2017-07-11 18:20:57 UTC (rev 219347)
@@ -45,7 +45,6 @@
WTF_EXPORT_STRING_API static RefPtr<AtomicStringImpl> add(const LChar*, unsigned length);
WTF_EXPORT_STRING_API static RefPtr<AtomicStringImpl> add(const UChar*, unsigned length);
ALWAYS_INLINE static RefPtr<AtomicStringImpl> add(const char* s, unsigned length) { return add(reinterpret_cast<const LChar*>(s), length); };
- WTF_EXPORT_STRING_API static Ref<AtomicStringImpl> add(const UChar*, unsigned length, unsigned existingHash);
WTF_EXPORT_STRING_API static RefPtr<AtomicStringImpl> add(const UChar*);
WTF_EXPORT_STRING_API static RefPtr<AtomicStringImpl> add(StringImpl*, unsigned offset, unsigned length);
ALWAYS_INLINE static RefPtr<AtomicStringImpl> add(StringImpl* string)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes