Move AtomicStringImpl table related operations from AtomicString to AtomicStringImpl
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 May 2015 04:19:14 +0000 (04:19 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 May 2015 04:19:14 +0000 (04:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=145109

Reviewed by Darin Adler.

Source/JavaScriptCore:

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::nameForRegister):
* runtime/Identifier.cpp:
(JSC::Identifier::add):
(JSC::Identifier::add8):
* runtime/Identifier.h:
(JSC::Identifier::add):
* runtime/IdentifierInlines.h:
(JSC::Identifier::Identifier):
(JSC::Identifier::add):
* runtime/JSString.cpp:
(JSC::JSRopeString::resolveRopeToExistingAtomicString):
* runtime/JSString.h:
(JSC::JSString::toExistingAtomicString):
* runtime/SmallStrings.cpp:
(JSC::SmallStringsStorage::SmallStringsStorage):
* runtime/TypeSet.cpp:
(JSC::StructureShape::propertyHash):

Source/WebCore:

* dom/TreeScope.cpp:
(WebCore::TreeScope::getElementById):

Source/WTF:

Now AtomicStringImpl table operations are located in AtomicString.
But they should be under AtomicStringImpl.
This patch simply moves these operations to AtomicStringImpl.

And this patch renames static AtomicString::find to static AtomicStringImpl::lookUp
because it conflicts with AtomicStringImpl's member function name.

* WTF.vcxproj/WTF.vcxproj:
* WTF.vcxproj/WTF.vcxproj.filters:
* WTF.vcxproj/copy-files.cmd:
* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/PlatformMac.cmake:
* wtf/PlatformWin.cmake:
* wtf/text/AtomicString.cpp:
(WTF::AtomicString::lower):
(WTF::AtomicString::convertToASCIILowercase):
(WTF::AtomicString::fromUTF8Internal):
(WTF::AtomicStringTableLocker::AtomicStringTableLocker): Deleted.
(WTF::stringTable): Deleted.
(WTF::addToStringTable): Deleted.
(WTF::CStringTranslator::hash): Deleted.
(WTF::CStringTranslator::equal): Deleted.
(WTF::CStringTranslator::translate): Deleted.
(WTF::AtomicString::add): Deleted.
(WTF::UCharBufferTranslator::hash): Deleted.
(WTF::UCharBufferTranslator::equal): Deleted.
(WTF::UCharBufferTranslator::translate): Deleted.
(WTF::HashAndCharactersTranslator::hash): Deleted.
(WTF::HashAndCharactersTranslator::equal): Deleted.
(WTF::HashAndCharactersTranslator::translate): Deleted.
(WTF::HashAndUTF8CharactersTranslator::hash): Deleted.
(WTF::HashAndUTF8CharactersTranslator::equal): Deleted.
(WTF::HashAndUTF8CharactersTranslator::translate): Deleted.
(WTF::SubstringTranslator::translate): Deleted.
(WTF::SubstringTranslator8::hash): Deleted.
(WTF::SubstringTranslator8::equal): Deleted.
(WTF::SubstringTranslator16::hash): Deleted.
(WTF::SubstringTranslator16::equal): Deleted.
(WTF::LCharBufferTranslator::hash): Deleted.
(WTF::LCharBufferTranslator::equal): Deleted.
(WTF::LCharBufferTranslator::translate): Deleted.
(WTF::CharBufferFromLiteralDataTranslator::hash): Deleted.
(WTF::CharBufferFromLiteralDataTranslator::equal): Deleted.
(WTF::CharBufferFromLiteralDataTranslator::translate): Deleted.
(WTF::AtomicString::addFromLiteralData): Deleted.
(WTF::AtomicString::addSlowCase): Deleted.
(WTF::AtomicString::remove): Deleted.
(WTF::AtomicString::findSlowCase): Deleted.
(WTF::AtomicString::findInternal): Deleted.
(WTF::AtomicString::isInAtomicStringTable): Deleted.
* wtf/text/AtomicString.h:
(WTF::AtomicString::AtomicString):
(WTF::AtomicString::fromUTF8):
(WTF::AtomicString::find): Deleted.
(WTF::AtomicString::add): Deleted.
(WTF::AtomicString::addWithStringTableProvider): Deleted.
* wtf/text/AtomicStringImpl.cpp: Copied from Source/WTF/wtf/text/AtomicString.cpp.
(WTF::AtomicStringTableLocker::AtomicStringTableLocker):
(WTF::stringTable):
(WTF::addToStringTable):
(WTF::CStringTranslator::hash):
(WTF::CStringTranslator::equal):
(WTF::CStringTranslator::translate):
(WTF::AtomicStringImpl::add):
(WTF::UCharBufferTranslator::hash):
(WTF::UCharBufferTranslator::equal):
(WTF::UCharBufferTranslator::translate):
(WTF::HashAndCharactersTranslator::hash):
(WTF::HashAndCharactersTranslator::equal):
(WTF::HashAndCharactersTranslator::translate):
(WTF::HashAndUTF8CharactersTranslator::hash):
(WTF::HashAndUTF8CharactersTranslator::equal):
(WTF::HashAndUTF8CharactersTranslator::translate):
(WTF::SubstringTranslator::translate):
(WTF::SubstringTranslator8::hash):
(WTF::SubstringTranslator8::equal):
(WTF::SubstringTranslator16::hash):
(WTF::SubstringTranslator16::equal):
(WTF::LCharBufferTranslator::hash):
(WTF::LCharBufferTranslator::equal):
(WTF::LCharBufferTranslator::translate):
(WTF::CharBufferFromLiteralDataTranslator::hash):
(WTF::CharBufferFromLiteralDataTranslator::equal):
(WTF::CharBufferFromLiteralDataTranslator::translate):
(WTF::AtomicStringImpl::addLiteral):
(WTF::AtomicStringImpl::addSlowCase):
(WTF::AtomicStringImpl::remove):
(WTF::AtomicStringImpl::lookUpSlowCase):
(WTF::AtomicStringImpl::addUTF8):
(WTF::AtomicStringImpl::lookUpInternal):
(WTF::AtomicStringImpl::isInAtomicStringTable):
* wtf/text/AtomicStringImpl.h:
(WTF::AtomicStringImpl::lookUp):
(WTF::AtomicStringImpl::add):
(WTF::AtomicStringImpl::addWithStringTableProvider):
(WTF::AtomicStringImpl::AtomicStringImpl): Deleted.
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::~StringImpl):
* wtf/text/StringImpl.h:
* wtf/text/WTFString.h:
(WTF::String::String):
* wtf/text/cf/AtomicStringCF.cpp:
(WTF::AtomicString::add): Deleted.
* wtf/text/cf/AtomicStringImplCF.cpp: Renamed from Source/WTF/wtf/text/cf/AtomicStringCF.cpp.
(WTF::AtomicStringImpl::add):

Tools:

* TestWebKitAPI/Tests/WTF/StringImpl.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184612 268f45cc-cd09-0410-ab3c-d52691b4dbfc

29 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/CodeBlock.cpp
Source/JavaScriptCore/runtime/Identifier.cpp
Source/JavaScriptCore/runtime/Identifier.h
Source/JavaScriptCore/runtime/IdentifierInlines.h
Source/JavaScriptCore/runtime/JSString.cpp
Source/JavaScriptCore/runtime/JSString.h
Source/JavaScriptCore/runtime/SmallStrings.cpp
Source/JavaScriptCore/runtime/TypeSet.cpp
Source/WTF/ChangeLog
Source/WTF/WTF.vcxproj/WTF.vcxproj
Source/WTF/WTF.vcxproj/WTF.vcxproj.filters
Source/WTF/WTF.vcxproj/copy-files.cmd
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/PlatformMac.cmake
Source/WTF/wtf/PlatformWin.cmake
Source/WTF/wtf/text/AtomicString.cpp
Source/WTF/wtf/text/AtomicString.h
Source/WTF/wtf/text/AtomicStringImpl.cpp [new file with mode: 0644]
Source/WTF/wtf/text/AtomicStringImpl.h
Source/WTF/wtf/text/StringImpl.cpp
Source/WTF/wtf/text/StringImpl.h
Source/WTF/wtf/text/WTFString.h
Source/WTF/wtf/text/cf/AtomicStringImplCF.cpp [moved from Source/WTF/wtf/text/cf/AtomicStringCF.cpp with 95% similarity]
Source/WebCore/ChangeLog
Source/WebCore/dom/TreeScope.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp

index 5c9912399012de4c93c2eb14b1e4a3b651cf2a9a..df582ddcb461953b83a63a9edabc758d61ff5acd 100644 (file)
@@ -1,3 +1,29 @@
+2015-05-19  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Move AtomicStringImpl table related operations from AtomicString to AtomicStringImpl
+        https://bugs.webkit.org/show_bug.cgi?id=145109
+
+        Reviewed by Darin Adler.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::nameForRegister):
+        * runtime/Identifier.cpp:
+        (JSC::Identifier::add):
+        (JSC::Identifier::add8):
+        * runtime/Identifier.h:
+        (JSC::Identifier::add):
+        * runtime/IdentifierInlines.h:
+        (JSC::Identifier::Identifier):
+        (JSC::Identifier::add):
+        * runtime/JSString.cpp:
+        (JSC::JSRopeString::resolveRopeToExistingAtomicString):
+        * runtime/JSString.h:
+        (JSC::JSString::toExistingAtomicString):
+        * runtime/SmallStrings.cpp:
+        (JSC::SmallStringsStorage::SmallStringsStorage):
+        * runtime/TypeSet.cpp:
+        (JSC::StructureShape::propertyHash):
+
 2015-05-19  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Improve Preview for NodeList / array like collections
index edcbc75c326db2aeb811d610c9c7eb56bfd5e83e..8ffdec22c5aa2446eac5b4511be14a6653c6591d 100644 (file)
@@ -3839,7 +3839,7 @@ String CodeBlock::nameForRegister(VirtualRegister virtualRegister)
         if (ptr->value.varOffset() == VarOffset(virtualRegister)) {
             // FIXME: This won't work from the compilation thread.
             // https://bugs.webkit.org/show_bug.cgi?id=115300
-            return String(ptr->key);
+            return ptr->key.get();
         }
     }
     if (virtualRegister == thisRegister())
index e0816d21730ff2558ce6ec1e766087e50d22e03e..d26d9567c6830fe7f31ef12a7a45c011247f86df 100644 (file)
@@ -45,7 +45,7 @@ Ref<StringImpl> Identifier::add(VM* vm, const char* c)
     if (!c[1])
         return *vm->smallStrings.singleCharacterStringRep(c[0]);
 
-    return *AtomicString::add(c);
+    return *AtomicStringImpl::add(c);
 }
 
 Ref<StringImpl> Identifier::add(ExecState* exec, const char* c)
@@ -64,7 +64,7 @@ Ref<StringImpl> Identifier::add8(VM* vm, const UChar* s, int length)
     if (!length)
         return *StringImpl::empty();
 
-    return *AtomicString::add(s, length);
+    return *AtomicStringImpl::add(s, length);
 }
 
 Identifier Identifier::from(ExecState* exec, unsigned value)
index e29c49774b53e8334571d935ea24e3a9ca2e4adb..291cdbe19076739d7bef198e9b678285d101dc77 100644 (file)
@@ -221,7 +221,7 @@ Ref<StringImpl> Identifier::add(VM* vm, const T* s, int length)
     if (!length)
         return *StringImpl::empty();
 
-    return *AtomicString::add(s, length);
+    return *AtomicStringImpl::add(s, length);
 }
 
 inline bool operator==(const Identifier& a, const Identifier& b)
index 406221a63aad965f4730e4688347367c3b26704b..506fa7a216ae9a998133c296a4146fca7e76dda0 100644 (file)
@@ -37,7 +37,7 @@ inline Identifier::Identifier(ExecState* exec, AtomicStringImpl* string)
 #ifndef NDEBUG
     checkCurrentAtomicStringTable(exec);
     if (string)
-        ASSERT_WITH_MESSAGE(!string->length() || string->isSymbol() || AtomicString::isInAtomicStringTable(string), "The atomic string comes from an other thread!");
+        ASSERT_WITH_MESSAGE(!string->length() || string->isSymbol() || AtomicStringImpl::isInAtomicStringTable(string), "The atomic string comes from an other thread!");
 #else
     UNUSED_PARAM(exec);
 #endif
@@ -49,7 +49,7 @@ inline Identifier::Identifier(ExecState* exec, const AtomicString& string)
 #ifndef NDEBUG
     checkCurrentAtomicStringTable(exec);
     if (!string.isNull())
-        ASSERT_WITH_MESSAGE(!string.length() || string.impl()->isSymbol() || AtomicString::isInAtomicStringTable(string.impl()), "The atomic string comes from an other thread!");
+        ASSERT_WITH_MESSAGE(!string.length() || string.impl()->isSymbol() || AtomicStringImpl::isInAtomicStringTable(string.impl()), "The atomic string comes from an other thread!");
 #else
     UNUSED_PARAM(exec);
 #endif
@@ -60,14 +60,14 @@ inline Ref<StringImpl> Identifier::add(ExecState* exec, StringImpl* r)
 #ifndef NDEBUG
     checkCurrentAtomicStringTable(exec);
 #endif
-    return *AtomicString::addWithStringTableProvider(*exec, r);
+    return *AtomicStringImpl::addWithStringTableProvider(*exec, r);
 }
 inline Ref<StringImpl> Identifier::add(VM* vm, StringImpl* r)
 {
 #ifndef NDEBUG
     checkCurrentAtomicStringTable(vm);
 #endif
-    return *AtomicString::addWithStringTableProvider(*vm, r);
+    return *AtomicStringImpl::addWithStringTableProvider(*vm, r);
 }
 
 inline Identifier Identifier::fromUid(VM* vm, StringImpl* uid)
index 15780a45cae6f1a58f721687c0a8783f7cefd0ca..63228e0e8dc55e2264a7ecc10d5e2d87842e224d 100644 (file)
@@ -194,7 +194,7 @@ AtomicStringImpl* JSRopeString::resolveRopeToExistingAtomicString(ExecState* exe
 {
     if (m_length > maxLengthForOnStackResolve) {
         resolveRope(exec);
-        if (AtomicStringImpl* existingAtomicString = AtomicString::find(m_value.impl())) {
+        if (AtomicStringImpl* existingAtomicString = AtomicStringImpl::lookUp(m_value.impl())) {
             m_value = *existingAtomicString;
             setIs8Bit(m_value.impl()->is8Bit());
             clearFibers();
@@ -206,7 +206,7 @@ AtomicStringImpl* JSRopeString::resolveRopeToExistingAtomicString(ExecState* exe
     if (is8Bit()) {
         LChar buffer[maxLengthForOnStackResolve];
         resolveRopeInternal8(buffer);
-        if (AtomicStringImpl* existingAtomicString = AtomicString::find(buffer, m_length)) {
+        if (AtomicStringImpl* existingAtomicString = AtomicStringImpl::lookUp(buffer, m_length)) {
             m_value = *existingAtomicString;
             setIs8Bit(m_value.impl()->is8Bit());
             clearFibers();
@@ -215,7 +215,7 @@ AtomicStringImpl* JSRopeString::resolveRopeToExistingAtomicString(ExecState* exe
     } else {
         UChar buffer[maxLengthForOnStackResolve];
         resolveRopeInternal16(buffer);
-        if (AtomicStringImpl* existingAtomicString = AtomicString::find(buffer, m_length)) {
+        if (AtomicStringImpl* existingAtomicString = AtomicStringImpl::lookUp(buffer, m_length)) {
             m_value = *existingAtomicString;
             setIs8Bit(m_value.impl()->is8Bit());
             clearFibers();
index e48d05a8c5005e233531377c6a3674aa0c95128c..0eb7608205b19d2f595a263c805f2620ac5f1aa6 100644 (file)
@@ -484,7 +484,7 @@ ALWAYS_INLINE AtomicStringImpl* JSString::toExistingAtomicString(ExecState* exec
         return static_cast<const JSRopeString*>(this)->resolveRopeToExistingAtomicString(exec);
     if (m_value.impl()->isAtomic())
         return static_cast<AtomicStringImpl*>(m_value.impl());
-    return AtomicString::find(m_value.impl());
+    return AtomicStringImpl::lookUp(m_value.impl());
 }
 
 inline const String& JSString::value(ExecState* exec) const
index 91a3368464ce68799c59937c810f78fe806ddbcc..9c6a43ae2138f4eefeba6e1d02bc2ead19e4de51 100644 (file)
@@ -57,7 +57,7 @@ SmallStringsStorage::SmallStringsStorage()
     RefPtr<StringImpl> baseString = StringImpl::createUninitialized(singleCharacterStringCount, characterBuffer);
     for (unsigned i = 0; i < singleCharacterStringCount; ++i) {
         characterBuffer[i] = i;
-        m_reps[i] = AtomicString::add(PassRefPtr<StringImpl>(StringImpl::createSubstringSharingImpl(baseString, i, 1)).get());
+        m_reps[i] = AtomicStringImpl::add(PassRefPtr<StringImpl>(StringImpl::createSubstringSharingImpl(baseString, i, 1)).get());
     }
 }
 
index 0f57ec4b5edbb1b9f78dae69cd74e1c67c373c55..4997bf58b43bf0ef172a86c84e3d98ad3a8e7310 100644 (file)
@@ -352,7 +352,7 @@ String StructureShape::propertyHash()
     builder.append(':');
     
     for (auto iter = m_fields.begin(), end = m_fields.end(); iter != end; ++iter) {
-        String property = String((*iter));
+        String property = iter->get();
         property.replace(":", "\\:"); // Ensure that hash({"foo:", "bar"}) != hash({"foo", ":bar"}) because we're using colons as a separator and colons are legal characters in field names in JS.
         builder.append(property);
     }
index c54bd411cf9cfe08a1cbf4d729dca1956d14b33f..2156ef4a3146c3c8f8142953360cf70f177bee05 100644 (file)
@@ -1,3 +1,117 @@
+2015-05-19  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Move AtomicStringImpl table related operations from AtomicString to AtomicStringImpl
+        https://bugs.webkit.org/show_bug.cgi?id=145109
+
+        Reviewed by Darin Adler.
+
+        Now AtomicStringImpl table operations are located in AtomicString.
+        But they should be under AtomicStringImpl.
+        This patch simply moves these operations to AtomicStringImpl.
+
+        And this patch renames static AtomicString::find to static AtomicStringImpl::lookUp
+        because it conflicts with AtomicStringImpl's member function name.
+
+        * WTF.vcxproj/WTF.vcxproj:
+        * WTF.vcxproj/WTF.vcxproj.filters:
+        * WTF.vcxproj/copy-files.cmd:
+        * WTF.xcodeproj/project.pbxproj:
+        * wtf/CMakeLists.txt:
+        * wtf/PlatformMac.cmake:
+        * wtf/PlatformWin.cmake:
+        * wtf/text/AtomicString.cpp:
+        (WTF::AtomicString::lower):
+        (WTF::AtomicString::convertToASCIILowercase):
+        (WTF::AtomicString::fromUTF8Internal):
+        (WTF::AtomicStringTableLocker::AtomicStringTableLocker): Deleted.
+        (WTF::stringTable): Deleted.
+        (WTF::addToStringTable): Deleted.
+        (WTF::CStringTranslator::hash): Deleted.
+        (WTF::CStringTranslator::equal): Deleted.
+        (WTF::CStringTranslator::translate): Deleted.
+        (WTF::AtomicString::add): Deleted.
+        (WTF::UCharBufferTranslator::hash): Deleted.
+        (WTF::UCharBufferTranslator::equal): Deleted.
+        (WTF::UCharBufferTranslator::translate): Deleted.
+        (WTF::HashAndCharactersTranslator::hash): Deleted.
+        (WTF::HashAndCharactersTranslator::equal): Deleted.
+        (WTF::HashAndCharactersTranslator::translate): Deleted.
+        (WTF::HashAndUTF8CharactersTranslator::hash): Deleted.
+        (WTF::HashAndUTF8CharactersTranslator::equal): Deleted.
+        (WTF::HashAndUTF8CharactersTranslator::translate): Deleted.
+        (WTF::SubstringTranslator::translate): Deleted.
+        (WTF::SubstringTranslator8::hash): Deleted.
+        (WTF::SubstringTranslator8::equal): Deleted.
+        (WTF::SubstringTranslator16::hash): Deleted.
+        (WTF::SubstringTranslator16::equal): Deleted.
+        (WTF::LCharBufferTranslator::hash): Deleted.
+        (WTF::LCharBufferTranslator::equal): Deleted.
+        (WTF::LCharBufferTranslator::translate): Deleted.
+        (WTF::CharBufferFromLiteralDataTranslator::hash): Deleted.
+        (WTF::CharBufferFromLiteralDataTranslator::equal): Deleted.
+        (WTF::CharBufferFromLiteralDataTranslator::translate): Deleted.
+        (WTF::AtomicString::addFromLiteralData): Deleted.
+        (WTF::AtomicString::addSlowCase): Deleted.
+        (WTF::AtomicString::remove): Deleted.
+        (WTF::AtomicString::findSlowCase): Deleted.
+        (WTF::AtomicString::findInternal): Deleted.
+        (WTF::AtomicString::isInAtomicStringTable): Deleted.
+        * wtf/text/AtomicString.h:
+        (WTF::AtomicString::AtomicString):
+        (WTF::AtomicString::fromUTF8):
+        (WTF::AtomicString::find): Deleted.
+        (WTF::AtomicString::add): Deleted.
+        (WTF::AtomicString::addWithStringTableProvider): Deleted.
+        * wtf/text/AtomicStringImpl.cpp: Copied from Source/WTF/wtf/text/AtomicString.cpp.
+        (WTF::AtomicStringTableLocker::AtomicStringTableLocker):
+        (WTF::stringTable):
+        (WTF::addToStringTable):
+        (WTF::CStringTranslator::hash):
+        (WTF::CStringTranslator::equal):
+        (WTF::CStringTranslator::translate):
+        (WTF::AtomicStringImpl::add):
+        (WTF::UCharBufferTranslator::hash):
+        (WTF::UCharBufferTranslator::equal):
+        (WTF::UCharBufferTranslator::translate):
+        (WTF::HashAndCharactersTranslator::hash):
+        (WTF::HashAndCharactersTranslator::equal):
+        (WTF::HashAndCharactersTranslator::translate):
+        (WTF::HashAndUTF8CharactersTranslator::hash):
+        (WTF::HashAndUTF8CharactersTranslator::equal):
+        (WTF::HashAndUTF8CharactersTranslator::translate):
+        (WTF::SubstringTranslator::translate):
+        (WTF::SubstringTranslator8::hash):
+        (WTF::SubstringTranslator8::equal):
+        (WTF::SubstringTranslator16::hash):
+        (WTF::SubstringTranslator16::equal):
+        (WTF::LCharBufferTranslator::hash):
+        (WTF::LCharBufferTranslator::equal):
+        (WTF::LCharBufferTranslator::translate):
+        (WTF::CharBufferFromLiteralDataTranslator::hash):
+        (WTF::CharBufferFromLiteralDataTranslator::equal):
+        (WTF::CharBufferFromLiteralDataTranslator::translate):
+        (WTF::AtomicStringImpl::addLiteral):
+        (WTF::AtomicStringImpl::addSlowCase):
+        (WTF::AtomicStringImpl::remove):
+        (WTF::AtomicStringImpl::lookUpSlowCase):
+        (WTF::AtomicStringImpl::addUTF8):
+        (WTF::AtomicStringImpl::lookUpInternal):
+        (WTF::AtomicStringImpl::isInAtomicStringTable):
+        * wtf/text/AtomicStringImpl.h:
+        (WTF::AtomicStringImpl::lookUp):
+        (WTF::AtomicStringImpl::add):
+        (WTF::AtomicStringImpl::addWithStringTableProvider):
+        (WTF::AtomicStringImpl::AtomicStringImpl): Deleted.
+        * wtf/text/StringImpl.cpp:
+        (WTF::StringImpl::~StringImpl):
+        * wtf/text/StringImpl.h:
+        * wtf/text/WTFString.h:
+        (WTF::String::String):
+        * wtf/text/cf/AtomicStringCF.cpp:
+        (WTF::AtomicString::add): Deleted.
+        * wtf/text/cf/AtomicStringImplCF.cpp: Renamed from Source/WTF/wtf/text/cf/AtomicStringCF.cpp.
+        (WTF::AtomicStringImpl::add):
+
 2015-05-19  Ting-Wei Lan  <lantw44@gmail.com>
 
         [SOUP] Use st_birthtime to get creation time of files on systems support it
index 46690b8c6274a1a74d2f6ed26ad190d722ae109e..6c026ddc2f8c6fd14245c377fecf63e03c53956b 100644 (file)
     <ClCompile Include="..\wtf\StackBounds.cpp" />
     <ClCompile Include="..\wtf\StringPrintStream.cpp" />
     <ClCompile Include="..\wtf\text\AtomicString.cpp" />
+    <ClCompile Include="..\wtf\text\AtomicStringImpl.cpp" />
     <ClCompile Include="..\wtf\text\AtomicStringTable.cpp" />
     <ClCompile Include="..\wtf\text\Base64.cpp" />
     <ClCompile Include="..\wtf\text\CString.cpp" />
     <ClCompile Include="..\wtf\text\StringView.cpp" />
     <ClCompile Include="..\wtf\text\SymbolRegistry.cpp" />
     <ClCompile Include="..\wtf\text\WTFString.cpp" />
-    <ClCompile Include="..\wtf\text\cf\AtomicStringCF.cpp" />
+    <ClCompile Include="..\wtf\text\cf\AtomicStringImplCF.cpp" />
     <ClCompile Include="..\wtf\text\cf\StringCF.cpp" />
     <ClCompile Include="..\wtf\text\cf\StringImplCF.cpp" />
     <ClCompile Include="..\wtf\text\cf\StringViewCF.cpp" />
index cd92a31cd7b7bb44daf15dfad8d3e519cbf2821e..648a6a0910cd6752e70d2cd801e1917b396ffb7a 100644 (file)
@@ -66,6 +66,9 @@
     <ClCompile Include="..\wtf\text\AtomicString.cpp">
       <Filter>text</Filter>
     </ClCompile>
+    <ClCompile Include="..\wtf\text\AtomicStringImpl.cpp">
+      <Filter>text</Filter>
+    </ClCompile>
     <ClCompile Include="..\wtf\text\Base64.cpp">
       <Filter>text</Filter>
     </ClCompile>
@@ -84,7 +87,7 @@
     <ClCompile Include="..\wtf\text\WTFString.cpp">
       <Filter>text</Filter>
     </ClCompile>
-    <ClCompile Include="..\wtf\text\cf\AtomicStringCF.cpp">
+    <ClCompile Include="..\wtf\text\cf\AtomicStringImplCF.cpp">
       <Filter>text</Filter>
     </ClCompile>
     <ClCompile Include="..\wtf\text\cf\StringCF.cpp">
index ed7baaf86e93f0371d4955c83c000afdf692d0d6..e7e659e8ff677a560af7d7039934bd3183178a4e 100755 (executable)
@@ -28,6 +28,7 @@ echo Copying other files...
 for %%f in (\r
     ..\JavaScriptCore\create_hash_table\r
     wtf\text\AtomicString.cpp\r
+    wtf\text\AtomicStringImpl.cpp\r
     wtf\text\StringBuilder.cpp\r
     wtf\text\StringImpl.cpp\r
     wtf\text\WTFString.cpp\r
index 220d58d3fbe2c794bfbd406db2c445a2b809df90..d5d46847261429e76d15c38390c1a9807ae1b3bb 100644 (file)
@@ -76,6 +76,7 @@
                430B47891AAAAC1A001223DA /* StringCommon.h in Headers */ = {isa = PBXBuildFile; fileRef = 430B47871AAAAC1A001223DA /* StringCommon.h */; };
                70A993FE1AD7151300FA615B /* SymbolRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70A993FC1AD7151300FA615B /* SymbolRegistry.cpp */; };
                70A993FF1AD7151300FA615B /* SymbolRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 70A993FD1AD7151300FA615B /* SymbolRegistry.h */; };
+               70ECA60D1B02426800449739 /* AtomicStringImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70ECA60A1B02426800449739 /* AtomicStringImpl.cpp */; };
                7CBBA07419BB7FDC00BBF025 /* OSObjectPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CBBA07319BB7FDC00BBF025 /* OSObjectPtr.h */; };
                7CDD7FF8186D291E007433CD /* IteratorAdaptors.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDD7FF7186D291E007433CD /* IteratorAdaptors.h */; };
                7CDD7FFA186D2A54007433CD /* IteratorRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDD7FF9186D2A54007433CD /* IteratorRange.h */; };
@@ -94,7 +95,7 @@
                9BD8F40B176C2B470002D865 /* AtomicStringTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BD8F40A176C2AD80002D865 /* AtomicStringTable.h */; };
                A5BA15F3182433A900A82E69 /* StringMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F2182433A900A82E69 /* StringMac.mm */; };
                A5BA15F51824348000A82E69 /* StringImplMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F41824348000A82E69 /* StringImplMac.mm */; };
-               A5BA15FA182435A600A82E69 /* AtomicStringCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F7182435A600A82E69 /* AtomicStringCF.cpp */; };
+               A5BA15FA182435A600A82E69 /* AtomicStringImplCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F7182435A600A82E69 /* AtomicStringImplCF.cpp */; };
                A5BA15FB182435A600A82E69 /* StringCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F8182435A600A82E69 /* StringCF.cpp */; };
                A5BA15FC182435A600A82E69 /* StringImplCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A5BA15F9182435A600A82E69 /* StringImplCF.cpp */; };
                A70DA0841799F04D00529A9B /* Insertion.h in Headers */ = {isa = PBXBuildFile; fileRef = A70DA0821799F04D00529A9B /* Insertion.h */; };
                6541CAF41630DB26006D0DEC /* CopyWTFHeaders.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CopyWTFHeaders.xcconfig; sourceTree = "<group>"; };
                70A993FC1AD7151300FA615B /* SymbolRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolRegistry.cpp; sourceTree = "<group>"; };
                70A993FD1AD7151300FA615B /* SymbolRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolRegistry.h; sourceTree = "<group>"; };
+               70ECA60A1B02426800449739 /* AtomicStringImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AtomicStringImpl.cpp; sourceTree = "<group>"; };
                7CBBA07319BB7FDC00BBF025 /* OSObjectPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSObjectPtr.h; sourceTree = "<group>"; };
                7CDD7FF7186D291E007433CD /* IteratorAdaptors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IteratorAdaptors.h; sourceTree = "<group>"; };
                7CDD7FF9186D2A54007433CD /* IteratorRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IteratorRange.h; sourceTree = "<group>"; };
                9BD8F40A176C2AD80002D865 /* AtomicStringTable.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AtomicStringTable.h; sourceTree = "<group>"; };
                A5BA15F2182433A900A82E69 /* StringMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringMac.mm; path = mac/StringMac.mm; sourceTree = "<group>"; };
                A5BA15F41824348000A82E69 /* StringImplMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringImplMac.mm; path = mac/StringImplMac.mm; sourceTree = "<group>"; };
-               A5BA15F7182435A600A82E69 /* AtomicStringCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AtomicStringCF.cpp; path = cf/AtomicStringCF.cpp; sourceTree = "<group>"; };
+               A5BA15F7182435A600A82E69 /* AtomicStringImplCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AtomicStringImplCF.cpp; path = cf/AtomicStringImplCF.cpp; sourceTree = "<group>"; };
                A5BA15F8182435A600A82E69 /* StringCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringCF.cpp; path = cf/StringCF.cpp; sourceTree = "<group>"; };
                A5BA15F9182435A600A82E69 /* StringImplCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringImplCF.cpp; path = cf/StringImplCF.cpp; sourceTree = "<group>"; };
                A70DA0821799F04D00529A9B /* Insertion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Insertion.h; sourceTree = "<group>"; };
                A5BA15F61824359E00A82E69 /* cf */ = {
                        isa = PBXGroup;
                        children = (
-                               A5BA15F7182435A600A82E69 /* AtomicStringCF.cpp */,
+                               A5BA15F7182435A600A82E69 /* AtomicStringImplCF.cpp */,
                                A5BA15F8182435A600A82E69 /* StringCF.cpp */,
                                A5BA15F9182435A600A82E69 /* StringImplCF.cpp */,
                                93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */,
                                A8A4731D151A825B004123FF /* AtomicString.cpp */,
                                A8A4731E151A825B004123FF /* AtomicString.h */,
                                A8A4731F151A825B004123FF /* AtomicStringHash.h */,
+                               70ECA60A1B02426800449739 /* AtomicStringImpl.cpp */,
                                A8A47320151A825B004123FF /* AtomicStringImpl.h */,
                                9BC70F04176C379D00101DEC /* AtomicStringTable.cpp */,
                                9BD8F40A176C2AD80002D865 /* AtomicStringTable.h */,
                                E4A0AD3D1A96253C00536DF6 /* WorkQueueCocoa.cpp in Sources */,
                                A8A473B3151A825B004123FF /* fast-dtoa.cc in Sources */,
                                A8A473C3151A825B004123FF /* FastMalloc.cpp in Sources */,
-                               A5BA15FA182435A600A82E69 /* AtomicStringCF.cpp in Sources */,
+                               A5BA15FA182435A600A82E69 /* AtomicStringImplCF.cpp in Sources */,
                                E15556F518A0CC18006F48FB /* CryptographicUtilities.cpp in Sources */,
                                0F9D3360165DBA73005AD387 /* FilePrintStream.cpp in Sources */,
                                A8A473B5151A825B004123FF /* fixed-dtoa.cc in Sources */,
                                A748745217A0BDAE00FA04CB /* SixCharacterHash.cpp in Sources */,
                                A8A47425151A825B004123FF /* SizeLimits.cpp in Sources */,
                                A8A47427151A825B004123FF /* StackBounds.cpp in Sources */,
+                               70ECA60D1B02426800449739 /* AtomicStringImpl.cpp in Sources */,
                                FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */,
                                A8A4743C151A825B004123FF /* StringBuilder.cpp in Sources */,
                                A8A47440151A825B004123FF /* StringImpl.cpp in Sources */,
index ef3a1400c246740bf1ebddb60042681e58611ef9..e855f73ad49571eb6b8023d5d500f07441608f69 100644 (file)
@@ -187,6 +187,7 @@ set(WTF_SOURCES
     dtoa/strtod.cc
 
     text/AtomicString.cpp
+    text/AtomicStringImpl.cpp
     text/AtomicStringTable.cpp
     text/Base64.cpp
     text/CString.cpp
index 8d107c730eaac3715c9290e57553529ad3292995..f610619b185d3670ce721f49a0026dfdfd7904c9 100644 (file)
@@ -11,7 +11,7 @@ list(APPEND WTF_SOURCES
     mac/DeprecatedSymbolsUsedBySafari.mm
     mac/MainThreadMac.mm
 
-    text/cf/AtomicStringCF.cpp
+    text/cf/AtomicStringImplCF.cpp
     text/cf/StringCF.cpp
     text/cf/StringImplCF.cpp
     text/cf/StringViewCF.cpp
index f737b8cabc5ef94e8348bf38fbd6ec777888daa6..97f73995ed4892bcca0bc0faac9c95118443dd1e 100644 (file)
@@ -1,5 +1,5 @@
 list(APPEND WTF_SOURCES
-    text/cf/AtomicStringCF.cpp
+    text/cf/AtomicStringImplCF.cpp
     text/cf/StringCF.cpp
     text/cf/StringImplCF.cpp
     text/cf/StringViewCF.cpp
index 5ab4e1eb7dbeda6ea3735d54d2c5067852732847..bb55b946d766a3f89009ab478033c6ce19c527f9 100644 (file)
 #include "config.h"
 #include "AtomicString.h"
 
-#include "AtomicStringTable.h"
-#include "HashSet.h"
 #include "IntegerToStringConversion.h"
-#include "StringHash.h"
-#include "Threading.h"
-#include "WTFThreadData.h"
 #include "dtoa.h"
-#include <wtf/unicode/UTF8.h>
 
 #if USE(WEB_THREAD)
 #include "SpinLock.h"
 
 namespace WTF {
 
-using namespace Unicode;
-
-static_assert(sizeof(AtomicString) == sizeof(String), "AtomicString and String must be same size!");
-
-#if USE(WEB_THREAD)
-
-class AtomicStringTableLocker : public SpinLockHolder {
-    WTF_MAKE_NONCOPYABLE(AtomicStringTableLocker);
-
-    static StaticSpinLock s_stringTableLock;
-public:
-    AtomicStringTableLocker()
-        : SpinLockHolder(&s_stringTableLock)
-    {
-    }
-};
-
-StaticSpinLock AtomicStringTableLocker::s_stringTableLock;
-
-#else
-
-class AtomicStringTableLocker {
-    WTF_MAKE_NONCOPYABLE(AtomicStringTableLocker);
-public:
-    AtomicStringTableLocker() { }
-};
-
-#endif // USE(WEB_THREAD)
-
-static ALWAYS_INLINE HashSet<StringImpl*>& stringTable()
-{
-    return wtfThreadData().atomicStringTable()->table();
-}
-
-template<typename T, typename HashTranslator>
-static inline Ref<StringImpl> addToStringTable(const T& value)
-{
-    AtomicStringTableLocker locker;
-
-    HashSet<StringImpl*>::AddResult addResult = stringTable().add<HashTranslator>(value);
-
-    // If the string is newly-translated, then we need to adopt it.
-    // The boolean in the pair tells us if that is so.
-    if (addResult.isNewEntry)
-        return adoptRef(**addResult.iterator);
-    return **addResult.iterator;
-}
-
-struct CStringTranslator {
-    static unsigned hash(const LChar* c)
-    {
-        return StringHasher::computeHashAndMaskTop8Bits(c);
-    }
-
-    static inline bool equal(StringImpl* r, const LChar* s)
-    {
-        return WTF::equal(r, s);
-    }
-
-    static void translate(StringImpl*& location, const LChar* const& c, unsigned hash)
-    {
-        location = &StringImpl::create(c).leakRef();
-        location->setHash(hash);
-        location->setIsAtomic(true);
-    }
-};
-
-RefPtr<StringImpl> AtomicString::add(const LChar* c)
-{
-    if (!c)
-        return nullptr;
-    if (!*c)
-        return StringImpl::empty();
-
-    return addToStringTable<const LChar*, CStringTranslator>(c);
-}
-
-template<typename CharacterType>
-struct HashTranslatorCharBuffer {
-    const CharacterType* s;
-    unsigned length;
-};
-
-typedef HashTranslatorCharBuffer<UChar> UCharBuffer;
-struct UCharBufferTranslator {
-    static unsigned hash(const UCharBuffer& buf)
-    {
-        return StringHasher::computeHashAndMaskTop8Bits(buf.s, buf.length);
-    }
-
-    static bool equal(StringImpl* const& str, const UCharBuffer& buf)
-    {
-        return WTF::equal(str, buf.s, buf.length);
-    }
-
-    static void translate(StringImpl*& location, const UCharBuffer& buf, unsigned hash)
-    {
-        location = &StringImpl::create8BitIfPossible(buf.s, buf.length).leakRef();
-        location->setHash(hash);
-        location->setIsAtomic(true);
-    }
-};
-
-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;
-    unsigned length;
-    unsigned utf16Length;
-};
-
-struct HashAndUTF8CharactersTranslator {
-    static unsigned hash(const HashAndUTF8Characters& buffer)
-    {
-        return buffer.hash;
-    }
-
-    static bool equal(StringImpl* const& string, const HashAndUTF8Characters& buffer)
-    {
-        if (buffer.utf16Length != string->length())
-            return false;
-
-        // If buffer contains only ASCII characters UTF-8 and UTF16 length are the same.
-        if (buffer.utf16Length != buffer.length) {
-            if (string->is8Bit())
-                return equalLatin1WithUTF8(string->characters8(), buffer.characters, buffer.characters + buffer.length);
-
-            return equalUTF16WithUTF8(string->characters16(), buffer.characters, buffer.characters + buffer.length);
-        }
-
-        if (string->is8Bit()) {
-            const LChar* stringCharacters = string->characters8();
-
-            for (unsigned i = 0; i < buffer.length; ++i) {
-                ASSERT(isASCII(buffer.characters[i]));
-                if (stringCharacters[i] != buffer.characters[i])
-                    return false;
-            }
-
-            return true;
-        }
-
-        const UChar* stringCharacters = string->characters16();
-
-        for (unsigned i = 0; i < buffer.length; ++i) {
-            ASSERT(isASCII(buffer.characters[i]));
-            if (stringCharacters[i] != buffer.characters[i])
-                return false;
-        }
-
-        return true;
-    }
-
-    static void translate(StringImpl*& location, const HashAndUTF8Characters& buffer, unsigned hash)
-    {
-        UChar* target;
-        RefPtr<StringImpl> newString = StringImpl::createUninitialized(buffer.utf16Length, target);
-
-        bool isAllASCII;
-        const char* source = buffer.characters;
-        if (convertUTF8ToUTF16(&source, source + buffer.length, &target, target + buffer.utf16Length, &isAllASCII) != conversionOK)
-            ASSERT_NOT_REACHED();
-
-        if (isAllASCII)
-            newString = StringImpl::create(buffer.characters, buffer.length);
-
-        location = newString.release().leakRef();
-        location->setHash(hash);
-        location->setIsAtomic(true);
-    }
-};
-
-RefPtr<StringImpl> AtomicString::add(const UChar* s, unsigned length)
-{
-    if (!s)
-        return nullptr;
-
-    if (!length)
-        return StringImpl::empty();
-    
-    UCharBuffer buffer = { s, length };
-    return addToStringTable<UCharBuffer, UCharBufferTranslator>(buffer);
-}
-
-Ref<StringImpl> AtomicString::add(const UChar* s, unsigned length, unsigned existingHash)
-{
-    ASSERT(s);
-    ASSERT(existingHash);
-
-    if (!length)
-        return *StringImpl::empty();
-
-    HashAndCharacters<UChar> buffer = { existingHash, s, length };
-    return addToStringTable<HashAndCharacters<UChar>, HashAndCharactersTranslator<UChar>>(buffer);
-}
-
-RefPtr<StringImpl> AtomicString::add(const UChar* s)
-{
-    if (!s)
-        return nullptr;
-
-    unsigned length = 0;
-    while (s[length] != UChar(0))
-        ++length;
-
-    if (!length)
-        return StringImpl::empty();
-
-    UCharBuffer buffer = { s, length };
-    return addToStringTable<UCharBuffer, UCharBufferTranslator>(buffer);
-}
-
-struct SubstringLocation {
-    StringImpl* baseString;
-    unsigned start;
-    unsigned length;
-};
-
-struct SubstringTranslator {
-    static void translate(StringImpl*& location, const SubstringLocation& buffer, unsigned hash)
-    {
-        location = &StringImpl::createSubstringSharingImpl(buffer.baseString, buffer.start, buffer.length).leakRef();
-        location->setHash(hash);
-        location->setIsAtomic(true);
-    }
-};
-
-struct SubstringTranslator8 : SubstringTranslator {
-    static unsigned hash(const SubstringLocation& buffer)
-    {
-        return StringHasher::computeHashAndMaskTop8Bits(buffer.baseString->characters8() + buffer.start, buffer.length);
-    }
-
-    static bool equal(StringImpl* const& string, const SubstringLocation& buffer)
-    {
-        return WTF::equal(string, buffer.baseString->characters8() + buffer.start, buffer.length);
-    }
-};
-
-struct SubstringTranslator16 : SubstringTranslator {
-    static unsigned hash(const SubstringLocation& buffer)
-    {
-        return StringHasher::computeHashAndMaskTop8Bits(buffer.baseString->characters16() + buffer.start, buffer.length);
-    }
-
-    static bool equal(StringImpl* const& string, const SubstringLocation& buffer)
-    {
-        return WTF::equal(string, buffer.baseString->characters16() + buffer.start, buffer.length);
-    }
-};
-
-RefPtr<StringImpl> AtomicString::add(StringImpl* baseString, unsigned start, unsigned length)
-{
-    if (!baseString)
-        return nullptr;
-
-    if (!length || start >= baseString->length())
-        return StringImpl::empty();
-
-    unsigned maxLength = baseString->length() - start;
-    if (length >= maxLength) {
-        if (!start)
-            return add(baseString);
-        length = maxLength;
-    }
-
-    SubstringLocation buffer = { baseString, start, length };
-    if (baseString->is8Bit())
-        return addToStringTable<SubstringLocation, SubstringTranslator8>(buffer);
-    return addToStringTable<SubstringLocation, SubstringTranslator16>(buffer);
-}
-    
-typedef HashTranslatorCharBuffer<LChar> LCharBuffer;
-struct LCharBufferTranslator {
-    static unsigned hash(const LCharBuffer& buf)
-    {
-        return StringHasher::computeHashAndMaskTop8Bits(buf.s, buf.length);
-    }
-
-    static bool equal(StringImpl* const& str, const LCharBuffer& buf)
-    {
-        return WTF::equal(str, buf.s, buf.length);
-    }
-
-    static void translate(StringImpl*& location, const LCharBuffer& buf, unsigned hash)
-    {
-        location = &StringImpl::create(buf.s, buf.length).leakRef();
-        location->setHash(hash);
-        location->setIsAtomic(true);
-    }
-};
-
-typedef HashTranslatorCharBuffer<char> CharBuffer;
-struct CharBufferFromLiteralDataTranslator {
-    static unsigned hash(const CharBuffer& buf)
-    {
-        return StringHasher::computeHashAndMaskTop8Bits(reinterpret_cast<const LChar*>(buf.s), buf.length);
-    }
-
-    static bool equal(StringImpl* const& str, const CharBuffer& buf)
-    {
-        return WTF::equal(str, buf.s, buf.length);
-    }
-
-    static void translate(StringImpl*& location, const CharBuffer& buf, unsigned hash)
-    {
-        location = &StringImpl::createFromLiteral(buf.s, buf.length).leakRef();
-        location->setHash(hash);
-        location->setIsAtomic(true);
-    }
-};
-
-RefPtr<StringImpl> AtomicString::add(const LChar* s, unsigned length)
-{
-    if (!s)
-        return nullptr;
-
-    if (!length)
-        return StringImpl::empty();
-
-    LCharBuffer buffer = { s, length };
-    return addToStringTable<LCharBuffer, LCharBufferTranslator>(buffer);
-}
-
-Ref<StringImpl> AtomicString::addFromLiteralData(const char* characters, unsigned length)
-{
-    ASSERT(characters);
-    ASSERT(length);
-
-    CharBuffer buffer = { characters, length };
-    return addToStringTable<CharBuffer, CharBufferFromLiteralDataTranslator>(buffer);
-}
-
-Ref<StringImpl> AtomicString::addSlowCase(StringImpl& string)
-{
-    if (!string.length())
-        return *StringImpl::empty();
-
-    if (string.isSymbol()) {
-        if (string.is8Bit())
-            return *add(string.characters8(), string.length());
-        return *add(string.characters16(), string.length());
-    }
-
-    ASSERT_WITH_MESSAGE(!string.isAtomic(), "AtomicString should not hit the slow case if the string is already atomic.");
-
-    AtomicStringTableLocker locker;
-    auto addResult = stringTable().add(&string);
-
-    if (addResult.isNewEntry) {
-        ASSERT(*addResult.iterator == &string);
-        string.setIsAtomic(true);
-    }
-
-    return **addResult.iterator;
-}
-
-Ref<StringImpl> AtomicString::addSlowCase(AtomicStringTable& stringTable, StringImpl& string)
-{
-    if (!string.length())
-        return *StringImpl::empty();
-
-    if (string.isSymbol()) {
-        if (string.is8Bit())
-            return *add(string.characters8(), string.length());
-        return *add(string.characters16(), string.length());
-    }
-
-    ASSERT_WITH_MESSAGE(!string.isAtomic(), "AtomicString should not hit the slow case if the string is already atomic.");
-
-    AtomicStringTableLocker locker;
-    auto addResult = stringTable.table().add(&string);
-
-    if (addResult.isNewEntry) {
-        ASSERT(*addResult.iterator == &string);
-        string.setIsAtomic(true);
-    }
-
-    return **addResult.iterator;
-}
-
-void AtomicString::remove(StringImpl* string)
-{
-    ASSERT(string->isAtomic());
-    AtomicStringTableLocker locker;
-    HashSet<StringImpl*>& atomicStringTable = stringTable();
-    HashSet<StringImpl*>::iterator iterator = atomicStringTable.find(string);
-    ASSERT_WITH_MESSAGE(iterator != atomicStringTable.end(), "The string being removed is atomic in the string table of an other thread!");
-    atomicStringTable.remove(iterator);
-}
-
 AtomicString AtomicString::lower() const
 {
     // Note: This is a hot function in the Dromaeo benchmark.
@@ -468,7 +44,7 @@ AtomicString AtomicString::lower() const
         return *this;
 
     AtomicString result;
-    result.m_string = addSlowCase(*lowercasedString);
+    result.m_string = AtomicStringImpl::add(lowercasedString.get());
     return result;
 }
 
@@ -507,45 +83,10 @@ SlowPath:
         return *this;
 
     AtomicString result;
-    result.m_string = addSlowCase(*convertedString);
+    result.m_string = AtomicStringImpl::add(convertedString.get());
     return result;
 }
 
-AtomicStringImpl* AtomicString::findSlowCase(StringImpl& string)
-{
-    ASSERT_WITH_MESSAGE(!string.isAtomic(), "AtomicStringImpls should return from the fast case.");
-
-    if (!string.length())
-        return static_cast<AtomicStringImpl*>(StringImpl::empty());
-
-    if (string.isSymbol()) {
-        if (string.is8Bit())
-            return findInternal(string.characters8(), string.length());
-        return findInternal(string.characters16(), string.length());
-    }
-
-    AtomicStringTableLocker locker;
-    HashSet<StringImpl*>& atomicStringTable = stringTable();
-    auto iterator = atomicStringTable.find(&string);
-    if (iterator != atomicStringTable.end())
-        return static_cast<AtomicStringImpl*>(*iterator);
-    return nullptr;
-}
-
-AtomicString AtomicString::fromUTF8Internal(const char* charactersStart, const char* charactersEnd)
-{
-    HashAndUTF8Characters buffer;
-    buffer.characters = charactersStart;
-    buffer.hash = calculateStringHashAndLengthFromUTF8MaskingTop8Bits(charactersStart, charactersEnd, buffer.length, buffer.utf16Length);
-
-    if (!buffer.hash)
-        return nullAtom;
-
-    AtomicString atomicString;
-    atomicString.m_string = addToStringTable<HashAndUTF8Characters, HashAndUTF8CharactersTranslator>(buffer);
-    return atomicString;
-}
-
 AtomicString AtomicString::number(int number)
 {
     return numberToStringSigned<AtomicString>(number);
@@ -562,37 +103,13 @@ AtomicString AtomicString::number(double number)
     return String(numberToFixedPrecisionString(number, 6, buffer, true));
 }
 
-AtomicStringImpl* AtomicString::findInternal(const LChar* characters, unsigned length)
-{
-    AtomicStringTableLocker locker;
-    auto& table = stringTable();
-
-    LCharBuffer buffer = { characters, length };
-    auto iterator = table.find<LCharBufferTranslator>(buffer);
-    if (iterator != table.end())
-        return static_cast<AtomicStringImpl*>(*iterator);
-    return nullptr;
-}
-
-AtomicStringImpl* AtomicString::findInternal(const UChar* characters, unsigned length)
-{
-    AtomicStringTableLocker locker;
-    auto& table = stringTable();
-
-    UCharBuffer buffer = { characters, length };
-    auto iterator = table.find<UCharBufferTranslator>(buffer);
-    if (iterator != table.end())
-        return static_cast<AtomicStringImpl*>(*iterator);
-    return nullptr;
-}
-
-#if !ASSERT_DISABLED
-bool AtomicString::isInAtomicStringTable(StringImpl* string)
+AtomicString AtomicString::fromUTF8Internal(const char* charactersStart, const char* charactersEnd)
 {
-    AtomicStringTableLocker locker;
-    return stringTable().contains(string);
+    auto impl = AtomicStringImpl::addUTF8(charactersStart, charactersEnd);
+    if (!impl)
+        return nullAtom;
+    return impl.get();
 }
-#endif
 
 #ifndef NDEBUG
 void AtomicString::show() const
index a685a31d072ba5089c347c9c4afc50be6edfac34..96563c3c2edfd49282ba71b0ca0a14324d02f186 100644 (file)
 
 namespace WTF {
 
-class AtomicStringTable;
 struct AtomicStringHash;
 
 class AtomicString {
 public:
     WTF_EXPORT_PRIVATE static void init();
 
-    AtomicString() { }
-    AtomicString(const LChar* s) : m_string(add(s)) { }
-    AtomicString(const char* s) : m_string(add(s)) { }
-    AtomicString(const LChar* s, unsigned length) : m_string(add(s, length)) { }
-    AtomicString(const UChar* s, unsigned length) : m_string(add(s, length)) { }
-    AtomicString(const UChar* s, unsigned length, unsigned existingHash) : m_string(add(s, length, existingHash)) { }
-    AtomicString(const UChar* s) : m_string(add(s)) { }
+    AtomicString();
+    AtomicString(const LChar*);
+    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>
     explicit AtomicString(const Vector<UChar, inlineCapacity>& characters)
-        : m_string(add(characters.data(), characters.size()))
+        : m_string(AtomicStringImpl::add(characters.data(), characters.size()))
     {
     }
 
-    ATOMICSTRING_CONVERSION AtomicString(StringImpl* imp) : m_string(add(imp)) { }
-    AtomicString(AtomicStringImpl* imp) : m_string(imp) { }
-    ATOMICSTRING_CONVERSION AtomicString(const String& s) : m_string(add(s.impl())) { }
-    AtomicString(StringImpl* baseString, unsigned start, unsigned length) : m_string(add(baseString, start, length)) { }
+    AtomicString(AtomicStringImpl*);
+    ATOMICSTRING_CONVERSION AtomicString(StringImpl*);
+    ATOMICSTRING_CONVERSION AtomicString(const String&);
+    AtomicString(StringImpl* baseString, unsigned start, unsigned length);
 
     enum ConstructFromLiteralTag { ConstructFromLiteral };
     AtomicString(const char* characters, unsigned length, ConstructFromLiteralTag)
-        : m_string(addFromLiteralData(characters, length))
+        : m_string(AtomicStringImpl::addLiteral(characters, length))
     {
     }
 
     template<unsigned charactersCount>
     ALWAYS_INLINE AtomicString(const char (&characters)[charactersCount], ConstructFromLiteralTag)
-        : m_string(addFromLiteralData(characters, charactersCount - 1))
+        : m_string(AtomicStringImpl::addLiteral(characters, charactersCount - 1))
     {
         COMPILE_ASSERT(charactersCount > 1, AtomicStringFromLiteralNotEmpty);
         COMPILE_ASSERT((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImpl)) / sizeof(LChar))), AtomicStringFromLiteralCannotOverflow);
@@ -86,21 +85,6 @@ public:
     AtomicString(WTF::HashTableDeletedValueType) : m_string(WTF::HashTableDeletedValue) { }
     bool isHashTableDeletedValue() const { return m_string.isHashTableDeletedValue(); }
 
-    static AtomicStringImpl* find(LChar* characters, unsigned length)
-    {
-        return findInternal(characters, length);
-    }
-    static AtomicStringImpl* find(UChar* characters, unsigned length)
-    {
-        return findInternal(characters, length);
-    }
-    static AtomicStringImpl* find(StringImpl* string)
-    {
-        if (!string || string->isAtomic())
-            return static_cast<AtomicStringImpl*>(string);
-        return findSlowCase(*string);
-    }
-
     operator const String&() const { return m_string; }
     const String& string() const { return m_string; };
 
@@ -110,7 +94,7 @@ public:
     const LChar* characters8() const { return m_string.characters8(); }
     const UChar* characters16() const { return m_string.characters16(); }
     unsigned length() const { return m_string.length(); }
-    
+
     UChar operator[](unsigned int i) const { return m_string[i]; }
 
     WTF_EXPORT_STRING_API static AtomicString number(int);
@@ -163,7 +147,7 @@ public:
     template<unsigned matchLength>
     bool endsWith(const char (&prefix)[matchLength], bool caseSensitive = true) const
         { return m_string.endsWith<matchLength>(prefix, caseSensitive); }
-    
+
     WTF_EXPORT_STRING_API AtomicString convertToASCIILowercase() const;
     WTF_EXPORT_STRING_API AtomicString lower() const;
     AtomicString upper() const { return AtomicString(impl()->upper()); }
@@ -176,13 +160,11 @@ public:
     bool isNull() const { return m_string.isNull(); }
     bool isEmpty() const { return m_string.isEmpty(); }
 
-    static void remove(StringImpl*);
-    
 #if USE(CF)
-    AtomicString(CFStringRef s) :  m_string(add(s)) { }
-#endif    
+    AtomicString(CFStringRef);
+#endif
 #ifdef __OBJC__
-    AtomicString(NSString* s) : m_string(add((CFStringRef)s)) { }
+    AtomicString(NSString*);
     operator NSString*() const { return m_string; }
 #endif
 
@@ -195,71 +177,17 @@ public:
     void show() const;
 #endif
 
-    WTF_EXPORT_STRING_API static RefPtr<StringImpl> add(const LChar*);
-    ALWAYS_INLINE static RefPtr<StringImpl> add(const char* s) { return add(reinterpret_cast<const LChar*>(s)); };
-    WTF_EXPORT_STRING_API static RefPtr<StringImpl> add(const LChar*, unsigned length);
-    WTF_EXPORT_STRING_API static RefPtr<StringImpl> add(const UChar*, unsigned length);
-    ALWAYS_INLINE static RefPtr<StringImpl> add(const char* s, unsigned length) { return add(reinterpret_cast<const LChar*>(s), length); };
-    WTF_EXPORT_STRING_API static Ref<StringImpl> add(const UChar*, unsigned length, unsigned existingHash);
-    WTF_EXPORT_STRING_API static RefPtr<StringImpl> add(const UChar*);
-    WTF_EXPORT_STRING_API static RefPtr<StringImpl> add(StringImpl*, unsigned offset, unsigned length);
-    ALWAYS_INLINE static RefPtr<StringImpl> add(StringImpl* string)
-    {
-        if (!string)
-            return string;
-        return add(*string);
-    }
-    WTF_EXPORT_STRING_API static Ref<StringImpl> addFromLiteralData(const char* characters, unsigned length);
-#if USE(CF)
-    WTF_EXPORT_STRING_API static RefPtr<StringImpl> add(CFStringRef);
-#endif
-
-    template<typename StringTableProvider>
-    ALWAYS_INLINE static RefPtr<StringImpl> addWithStringTableProvider(StringTableProvider& stringTableProvider, StringImpl* string)
-    {
-        if (!string)
-            return string;
-        return add(*stringTableProvider.atomicStringTable(), *string);
-    }
-
-#if !ASSERT_DISABLED
-    WTF_EXPORT_STRING_API static bool isInAtomicStringTable(StringImpl*);
-#endif
-
 private:
     // The explicit constructors with AtomicString::ConstructFromLiteral must be used for literals.
     AtomicString(ASCIILiteral);
 
-    String m_string;
-
-    ALWAYS_INLINE static Ref<StringImpl> add(StringImpl& string)
-    {
-        if (string.isAtomic()) {
-            ASSERT_WITH_MESSAGE(!string.length() || isInAtomicStringTable(&string), "The atomic string comes from an other thread!");
-            return string;
-        }
-        return addSlowCase(string);
-    }
-
-    ALWAYS_INLINE static Ref<StringImpl> add(AtomicStringTable& stringTable, StringImpl& string)
-    {
-        if (string.isAtomic()) {
-            ASSERT_WITH_MESSAGE(!string.length() || isInAtomicStringTable(&string), "The atomic string comes from an other thread!");
-            return string;
-        }
-        return addSlowCase(stringTable, string);
-    }
-
-    WTF_EXPORT_STRING_API static Ref<StringImpl> addSlowCase(StringImpl&);
-    WTF_EXPORT_STRING_API static Ref<StringImpl> addSlowCase(AtomicStringTable&, StringImpl&);
-
-    WTF_EXPORT_STRING_API static AtomicStringImpl* findSlowCase(StringImpl&);
     WTF_EXPORT_STRING_API static AtomicString fromUTF8Internal(const char*, const char*);
 
-    WTF_EXPORT_STRING_API static AtomicStringImpl* findInternal(const LChar*, unsigned length);
-    WTF_EXPORT_STRING_API static AtomicStringImpl* findInternal(const UChar*, unsigned length);
+    String m_string;
 };
 
+static_assert(sizeof(AtomicString) == sizeof(String), "AtomicString and String must be same size!");
+
 inline bool operator==(const AtomicString& a, const AtomicString& b) { return a.impl() == b.impl(); }
 bool operator==(const AtomicString&, const LChar*);
 inline bool operator==(const AtomicString& a, const char* b) { return WTF::equal(a.impl(), reinterpret_cast<const LChar*>(b)); }
@@ -293,6 +221,74 @@ inline bool equalIgnoringASCIICase(const String& a, const AtomicString& b) { ret
 template <unsigned charactersCount>
 inline bool equalIgnoringASCIICase(const AtomicString& a, const char (&b)[charactersCount]) { return equalIgnoringASCIICase<charactersCount>(a.impl(), b); }
 
+inline AtomicString::AtomicString()
+{
+}
+
+inline AtomicString::AtomicString(const LChar* s)
+    : m_string(AtomicStringImpl::add(s))
+{
+}
+
+inline AtomicString::AtomicString(const char* s)
+    : m_string(AtomicStringImpl::add(s))
+{
+}
+
+inline AtomicString::AtomicString(const LChar* s, unsigned length)
+    : m_string(AtomicStringImpl::add(s, length))
+{
+}
+
+inline AtomicString::AtomicString(const UChar* s, unsigned length)
+    : m_string(AtomicStringImpl::add(s, length))
+{
+}
+
+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))
+{
+}
+
+inline AtomicString::AtomicString(AtomicStringImpl* imp)
+    : m_string(imp)
+{
+}
+
+inline AtomicString::AtomicString(StringImpl* imp)
+    : m_string(AtomicStringImpl::add(imp))
+{
+}
+
+inline AtomicString::AtomicString(const String& s)
+    : m_string(AtomicStringImpl::add(s.impl()))
+{
+}
+
+inline AtomicString::AtomicString(StringImpl* baseString, unsigned start, unsigned length)
+    : m_string(AtomicStringImpl::add(baseString, start, length))
+{
+}
+
+#if USE(CF)
+inline AtomicString::AtomicString(CFStringRef s)
+    :  m_string(AtomicStringImpl::add(s))
+{
+}
+#endif
+
+#ifdef __OBJC__
+inline AtomicString::AtomicString(NSString* s)
+    : m_string(AtomicStringImpl::add((CFStringRef)s))
+{
+}
+#endif
+
 // Define external global variables for the commonly used atomic strings.
 // These are only usable from the main thread.
 #ifndef ATOMICSTRING_HIDE_GLOBALS
@@ -320,7 +316,7 @@ inline AtomicString AtomicString::fromUTF8(const char* characters)
         return nullAtom;
     if (!*characters)
         return emptyAtom;
-    return fromUTF8Internal(characters, 0);
+    return fromUTF8Internal(characters, nullptr);
 }
 #endif
 
diff --git a/Source/WTF/wtf/text/AtomicStringImpl.cpp b/Source/WTF/wtf/text/AtomicStringImpl.cpp
new file mode 100644 (file)
index 0000000..b1fe7e9
--- /dev/null
@@ -0,0 +1,522 @@
+/*
+ * Copyright (C) 2004-2008, 2013-2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ * Copyright (C) 2015 Yusuke Suzuki<utatane.tea@gmail.com>. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "AtomicStringImpl.h"
+
+#include "AtomicStringTable.h"
+#include "HashSet.h"
+#include "IntegerToStringConversion.h"
+#include "StringHash.h"
+#include "Threading.h"
+#include "WTFThreadData.h"
+#include <wtf/unicode/UTF8.h>
+
+#if USE(WEB_THREAD)
+#include "SpinLock.h"
+#endif
+
+namespace WTF {
+
+using namespace Unicode;
+
+#if USE(WEB_THREAD)
+
+class AtomicStringTableLocker : public SpinLockHolder {
+    WTF_MAKE_NONCOPYABLE(AtomicStringTableLocker);
+
+    static StaticSpinLock s_stringTableLock;
+public:
+    AtomicStringTableLocker()
+        : SpinLockHolder(&s_stringTableLock)
+    {
+    }
+};
+
+StaticSpinLock AtomicStringTableLocker::s_stringTableLock;
+
+#else
+
+class AtomicStringTableLocker {
+    WTF_MAKE_NONCOPYABLE(AtomicStringTableLocker);
+public:
+    AtomicStringTableLocker() { }
+};
+
+#endif // USE(WEB_THREAD)
+
+static ALWAYS_INLINE HashSet<StringImpl*>& stringTable()
+{
+    return wtfThreadData().atomicStringTable()->table();
+}
+
+template<typename T, typename HashTranslator>
+static inline Ref<AtomicStringImpl> addToStringTable(const T& value)
+{
+    AtomicStringTableLocker locker;
+
+    HashSet<StringImpl*>::AddResult addResult = stringTable().add<HashTranslator>(value);
+
+    // If the string is newly-translated, then we need to adopt it.
+    // The boolean in the pair tells us if that is so.
+    if (addResult.isNewEntry)
+        return adoptRef(static_cast<AtomicStringImpl&>(**addResult.iterator));
+    return *static_cast<AtomicStringImpl*>(*addResult.iterator);
+}
+
+struct CStringTranslator {
+    static unsigned hash(const LChar* c)
+    {
+        return StringHasher::computeHashAndMaskTop8Bits(c);
+    }
+
+    static inline bool equal(StringImpl* r, const LChar* s)
+    {
+        return WTF::equal(r, s);
+    }
+
+    static void translate(StringImpl*& location, const LChar* const& c, unsigned hash)
+    {
+        location = &StringImpl::create(c).leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+RefPtr<AtomicStringImpl> AtomicStringImpl::add(const LChar* c)
+{
+    if (!c)
+        return nullptr;
+    if (!*c)
+        return static_cast<AtomicStringImpl*>(StringImpl::empty());
+
+    return addToStringTable<const LChar*, CStringTranslator>(c);
+}
+
+template<typename CharacterType>
+struct HashTranslatorCharBuffer {
+    const CharacterType* s;
+    unsigned length;
+};
+
+typedef HashTranslatorCharBuffer<UChar> UCharBuffer;
+struct UCharBufferTranslator {
+    static unsigned hash(const UCharBuffer& buf)
+    {
+        return StringHasher::computeHashAndMaskTop8Bits(buf.s, buf.length);
+    }
+
+    static bool equal(StringImpl* const& str, const UCharBuffer& buf)
+    {
+        return WTF::equal(str, buf.s, buf.length);
+    }
+
+    static void translate(StringImpl*& location, const UCharBuffer& buf, unsigned hash)
+    {
+        location = &StringImpl::create8BitIfPossible(buf.s, buf.length).leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+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;
+    unsigned length;
+    unsigned utf16Length;
+};
+
+struct HashAndUTF8CharactersTranslator {
+    static unsigned hash(const HashAndUTF8Characters& buffer)
+    {
+        return buffer.hash;
+    }
+
+    static bool equal(StringImpl* const& string, const HashAndUTF8Characters& buffer)
+    {
+        if (buffer.utf16Length != string->length())
+            return false;
+
+        // If buffer contains only ASCII characters UTF-8 and UTF16 length are the same.
+        if (buffer.utf16Length != buffer.length) {
+            if (string->is8Bit())
+                return equalLatin1WithUTF8(string->characters8(), buffer.characters, buffer.characters + buffer.length);
+
+            return equalUTF16WithUTF8(string->characters16(), buffer.characters, buffer.characters + buffer.length);
+        }
+
+        if (string->is8Bit()) {
+            const LChar* stringCharacters = string->characters8();
+
+            for (unsigned i = 0; i < buffer.length; ++i) {
+                ASSERT(isASCII(buffer.characters[i]));
+                if (stringCharacters[i] != buffer.characters[i])
+                    return false;
+            }
+
+            return true;
+        }
+
+        const UChar* stringCharacters = string->characters16();
+
+        for (unsigned i = 0; i < buffer.length; ++i) {
+            ASSERT(isASCII(buffer.characters[i]));
+            if (stringCharacters[i] != buffer.characters[i])
+                return false;
+        }
+
+        return true;
+    }
+
+    static void translate(StringImpl*& location, const HashAndUTF8Characters& buffer, unsigned hash)
+    {
+        UChar* target;
+        RefPtr<StringImpl> newString = StringImpl::createUninitialized(buffer.utf16Length, target);
+
+        bool isAllASCII;
+        const char* source = buffer.characters;
+        if (convertUTF8ToUTF16(&source, source + buffer.length, &target, target + buffer.utf16Length, &isAllASCII) != conversionOK)
+            ASSERT_NOT_REACHED();
+
+        if (isAllASCII)
+            newString = StringImpl::create(buffer.characters, buffer.length);
+
+        location = newString.release().leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+RefPtr<AtomicStringImpl> AtomicStringImpl::add(const UChar* s, unsigned length)
+{
+    if (!s)
+        return nullptr;
+
+    if (!length)
+        return static_cast<AtomicStringImpl*>(StringImpl::empty());
+
+    UCharBuffer buffer = { s, length };
+    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)
+        return nullptr;
+
+    unsigned length = 0;
+    while (s[length] != UChar(0))
+        ++length;
+
+    if (!length)
+        return static_cast<AtomicStringImpl*>(StringImpl::empty());
+
+    UCharBuffer buffer = { s, length };
+    return addToStringTable<UCharBuffer, UCharBufferTranslator>(buffer);
+}
+
+struct SubstringLocation {
+    StringImpl* baseString;
+    unsigned start;
+    unsigned length;
+};
+
+struct SubstringTranslator {
+    static void translate(StringImpl*& location, const SubstringLocation& buffer, unsigned hash)
+    {
+        location = &StringImpl::createSubstringSharingImpl(buffer.baseString, buffer.start, buffer.length).leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+struct SubstringTranslator8 : SubstringTranslator {
+    static unsigned hash(const SubstringLocation& buffer)
+    {
+        return StringHasher::computeHashAndMaskTop8Bits(buffer.baseString->characters8() + buffer.start, buffer.length);
+    }
+
+    static bool equal(StringImpl* const& string, const SubstringLocation& buffer)
+    {
+        return WTF::equal(string, buffer.baseString->characters8() + buffer.start, buffer.length);
+    }
+};
+
+struct SubstringTranslator16 : SubstringTranslator {
+    static unsigned hash(const SubstringLocation& buffer)
+    {
+        return StringHasher::computeHashAndMaskTop8Bits(buffer.baseString->characters16() + buffer.start, buffer.length);
+    }
+
+    static bool equal(StringImpl* const& string, const SubstringLocation& buffer)
+    {
+        return WTF::equal(string, buffer.baseString->characters16() + buffer.start, buffer.length);
+    }
+};
+
+RefPtr<AtomicStringImpl> AtomicStringImpl::add(StringImpl* baseString, unsigned start, unsigned length)
+{
+    if (!baseString)
+        return nullptr;
+
+    if (!length || start >= baseString->length())
+        return static_cast<AtomicStringImpl*>(StringImpl::empty());
+
+    unsigned maxLength = baseString->length() - start;
+    if (length >= maxLength) {
+        if (!start)
+            return add(baseString);
+        length = maxLength;
+    }
+
+    SubstringLocation buffer = { baseString, start, length };
+    if (baseString->is8Bit())
+        return addToStringTable<SubstringLocation, SubstringTranslator8>(buffer);
+    return addToStringTable<SubstringLocation, SubstringTranslator16>(buffer);
+}
+    
+typedef HashTranslatorCharBuffer<LChar> LCharBuffer;
+struct LCharBufferTranslator {
+    static unsigned hash(const LCharBuffer& buf)
+    {
+        return StringHasher::computeHashAndMaskTop8Bits(buf.s, buf.length);
+    }
+
+    static bool equal(StringImpl* const& str, const LCharBuffer& buf)
+    {
+        return WTF::equal(str, buf.s, buf.length);
+    }
+
+    static void translate(StringImpl*& location, const LCharBuffer& buf, unsigned hash)
+    {
+        location = &StringImpl::create(buf.s, buf.length).leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+typedef HashTranslatorCharBuffer<char> CharBuffer;
+struct CharBufferFromLiteralDataTranslator {
+    static unsigned hash(const CharBuffer& buf)
+    {
+        return StringHasher::computeHashAndMaskTop8Bits(reinterpret_cast<const LChar*>(buf.s), buf.length);
+    }
+
+    static bool equal(StringImpl* const& str, const CharBuffer& buf)
+    {
+        return WTF::equal(str, buf.s, buf.length);
+    }
+
+    static void translate(StringImpl*& location, const CharBuffer& buf, unsigned hash)
+    {
+        location = &StringImpl::createFromLiteral(buf.s, buf.length).leakRef();
+        location->setHash(hash);
+        location->setIsAtomic(true);
+    }
+};
+
+RefPtr<AtomicStringImpl> AtomicStringImpl::add(const LChar* s, unsigned length)
+{
+    if (!s)
+        return nullptr;
+
+    if (!length)
+        return static_cast<AtomicStringImpl*>(StringImpl::empty());
+
+    LCharBuffer buffer = { s, length };
+    return addToStringTable<LCharBuffer, LCharBufferTranslator>(buffer);
+}
+
+Ref<AtomicStringImpl> AtomicStringImpl::addLiteral(const char* characters, unsigned length)
+{
+    ASSERT(characters);
+    ASSERT(length);
+
+    CharBuffer buffer = { characters, length };
+    return addToStringTable<CharBuffer, CharBufferFromLiteralDataTranslator>(buffer);
+}
+
+Ref<AtomicStringImpl> AtomicStringImpl::addSlowCase(StringImpl& string)
+{
+    if (!string.length())
+        return *static_cast<AtomicStringImpl*>(StringImpl::empty());
+
+    if (string.isSymbol()) {
+        if (string.is8Bit())
+            return *add(string.characters8(), string.length());
+        return *add(string.characters16(), string.length());
+    }
+
+    ASSERT_WITH_MESSAGE(!string.isAtomic(), "AtomicStringImpl should not hit the slow case if the string is already atomic.");
+
+    AtomicStringTableLocker locker;
+    auto addResult = stringTable().add(&string);
+
+    if (addResult.isNewEntry) {
+        ASSERT(*addResult.iterator == &string);
+        string.setIsAtomic(true);
+    }
+
+    return *static_cast<AtomicStringImpl*>(*addResult.iterator);
+}
+
+Ref<AtomicStringImpl> AtomicStringImpl::addSlowCase(AtomicStringTable& stringTable, StringImpl& string)
+{
+    if (!string.length())
+        return *static_cast<AtomicStringImpl*>(StringImpl::empty());
+
+    if (string.isSymbol()) {
+        if (string.is8Bit())
+            return *add(string.characters8(), string.length());
+        return *add(string.characters16(), string.length());
+    }
+
+    ASSERT_WITH_MESSAGE(!string.isAtomic(), "AtomicStringImpl should not hit the slow case if the string is already atomic.");
+
+    AtomicStringTableLocker locker;
+    auto addResult = stringTable.table().add(&string);
+
+    if (addResult.isNewEntry) {
+        ASSERT(*addResult.iterator == &string);
+        string.setIsAtomic(true);
+    }
+
+    return *static_cast<AtomicStringImpl*>(*addResult.iterator);
+}
+
+void AtomicStringImpl::remove(AtomicStringImpl* string)
+{
+    ASSERT(string->isAtomic());
+    AtomicStringTableLocker locker;
+    HashSet<StringImpl*>& atomicStringTable = stringTable();
+    HashSet<StringImpl*>::iterator iterator = atomicStringTable.find(string);
+    ASSERT_WITH_MESSAGE(iterator != atomicStringTable.end(), "The string being removed is atomic in the string table of an other thread!");
+    atomicStringTable.remove(iterator);
+}
+
+AtomicStringImpl* AtomicStringImpl::lookUpSlowCase(StringImpl& string)
+{
+    ASSERT_WITH_MESSAGE(!string.isAtomic(), "AtomicStringImpls should return from the fast case.");
+
+    if (!string.length())
+        return static_cast<AtomicStringImpl*>(StringImpl::empty());
+
+    if (string.isSymbol()) {
+        if (string.is8Bit())
+            return lookUpInternal(string.characters8(), string.length());
+        return lookUpInternal(string.characters16(), string.length());
+    }
+
+    AtomicStringTableLocker locker;
+    HashSet<StringImpl*>& atomicStringTable = stringTable();
+    auto iterator = atomicStringTable.find(&string);
+    if (iterator != atomicStringTable.end())
+        return static_cast<AtomicStringImpl*>(*iterator);
+    return nullptr;
+}
+
+RefPtr<AtomicStringImpl> AtomicStringImpl::addUTF8(const char* charactersStart, const char* charactersEnd)
+{
+    HashAndUTF8Characters buffer;
+    buffer.characters = charactersStart;
+    buffer.hash = calculateStringHashAndLengthFromUTF8MaskingTop8Bits(charactersStart, charactersEnd, buffer.length, buffer.utf16Length);
+
+    if (!buffer.hash)
+        return nullptr;
+
+    return addToStringTable<HashAndUTF8Characters, HashAndUTF8CharactersTranslator>(buffer);
+}
+
+AtomicStringImpl* AtomicStringImpl::lookUpInternal(const LChar* characters, unsigned length)
+{
+    AtomicStringTableLocker locker;
+    auto& table = stringTable();
+
+    LCharBuffer buffer = { characters, length };
+    auto iterator = table.find<LCharBufferTranslator>(buffer);
+    if (iterator != table.end())
+        return static_cast<AtomicStringImpl*>(*iterator);
+    return nullptr;
+}
+
+AtomicStringImpl* AtomicStringImpl::lookUpInternal(const UChar* characters, unsigned length)
+{
+    AtomicStringTableLocker locker;
+    auto& table = stringTable();
+
+    UCharBuffer buffer = { characters, length };
+    auto iterator = table.find<UCharBufferTranslator>(buffer);
+    if (iterator != table.end())
+        return static_cast<AtomicStringImpl*>(*iterator);
+    return nullptr;
+}
+
+#if !ASSERT_DISABLED
+bool AtomicStringImpl::isInAtomicStringTable(StringImpl* string)
+{
+    AtomicStringTableLocker locker;
+    return stringTable().contains(string);
+}
+#endif
+
+} // namespace WTF
index 62a90e06e538f663e4bf0e03be32eb64017c22c2..7e3cb42944f10fd9ddd22cb31379001de8e66ef4 100644 (file)
 
 namespace WTF {
 
-class AtomicStringImpl : public StringImpl
-{
+class AtomicStringTable;
+
+class AtomicStringImpl : public StringImpl {
 public:
-    AtomicStringImpl() : StringImpl(0) {}
+    static AtomicStringImpl* lookUp(LChar* characters, unsigned length)
+    {
+        return lookUpInternal(characters, length);
+    }
+    static AtomicStringImpl* lookUp(UChar* characters, unsigned length)
+    {
+        return lookUpInternal(characters, length);
+    }
+    static AtomicStringImpl* lookUp(StringImpl* string)
+    {
+        if (!string || string->isAtomic())
+            return static_cast<AtomicStringImpl*>(string);
+        return lookUpSlowCase(*string);
+    }
+
+    static void remove(AtomicStringImpl*);
+
+    WTF_EXPORT_STRING_API static RefPtr<AtomicStringImpl> add(const LChar*);
+    ALWAYS_INLINE static RefPtr<AtomicStringImpl> add(const char* s) { return add(reinterpret_cast<const LChar*>(s)); };
+    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)
+    {
+        if (!string)
+            return static_cast<AtomicStringImpl*>(string);
+        return add(*string);
+    }
+    WTF_EXPORT_STRING_API static Ref<AtomicStringImpl> addLiteral(const char* characters, unsigned length);
+
+    // Returns null if the input data contains an invalid UTF-8 sequence.
+    WTF_EXPORT_STRING_API static RefPtr<AtomicStringImpl> addUTF8(const char* start, const char* end);
+#if USE(CF)
+    WTF_EXPORT_STRING_API static RefPtr<AtomicStringImpl> add(CFStringRef);
+#endif
+
+    template<typename StringTableProvider>
+    ALWAYS_INLINE static RefPtr<AtomicStringImpl> addWithStringTableProvider(StringTableProvider& stringTableProvider, StringImpl* string)
+    {
+        if (!string)
+            return nullptr;
+        return add(*stringTableProvider.atomicStringTable(), *string);
+    }
+
+#if !ASSERT_DISABLED
+    WTF_EXPORT_STRING_API static bool isInAtomicStringTable(StringImpl*);
+#endif
+
+private:
+    AtomicStringImpl() = delete;
+
+    ALWAYS_INLINE static Ref<AtomicStringImpl> add(StringImpl& string)
+    {
+        if (string.isAtomic()) {
+            ASSERT_WITH_MESSAGE(!string.length() || isInAtomicStringTable(&string), "The atomic string comes from an other thread!");
+            return static_cast<AtomicStringImpl&>(string);
+        }
+        return addSlowCase(string);
+    }
+
+    ALWAYS_INLINE static Ref<AtomicStringImpl> add(AtomicStringTable& stringTable, StringImpl& string)
+    {
+        if (string.isAtomic()) {
+            ASSERT_WITH_MESSAGE(!string.length() || isInAtomicStringTable(&string), "The atomic string comes from an other thread!");
+            return static_cast<AtomicStringImpl&>(string);
+        }
+        return addSlowCase(stringTable, string);
+    }
+
+    WTF_EXPORT_STRING_API static Ref<AtomicStringImpl> addSlowCase(StringImpl&);
+    WTF_EXPORT_STRING_API static Ref<AtomicStringImpl> addSlowCase(AtomicStringTable&, StringImpl&);
+
+    WTF_EXPORT_STRING_API static AtomicStringImpl* lookUpSlowCase(StringImpl&);
+
+    WTF_EXPORT_STRING_API static AtomicStringImpl* lookUpInternal(const LChar*, unsigned length);
+    WTF_EXPORT_STRING_API static AtomicStringImpl* lookUpInternal(const UChar*, unsigned length);
 };
 
 #if !ASSERT_DISABLED
index b0197b24aae0e708f6e2440c1aed7d89f082f90d..8ff3f8bb7c9672558d58a23ed023e215ace18aa9 100644 (file)
@@ -111,7 +111,7 @@ StringImpl::~StringImpl()
     STRING_STATS_REMOVE_STRING(*this);
 
     if (isAtomic() && length() && !isSymbol())
-        AtomicString::remove(this);
+        AtomicStringImpl::remove(static_cast<AtomicStringImpl*>(this));
 
     if (isSymbol() && symbolRegistry())
         symbolRegistry()->remove(this);
index da29fbac2427a4c9cbfc0e2486c0b9a776bad6fc..1a1a1c8840fd6876e0e6131d6726da5db6cc910e 100644 (file)
@@ -131,7 +131,6 @@ class StringImpl {
     friend struct WTF::LCharBufferTranslator;
     friend struct WTF::SubstringTranslator;
     friend struct WTF::UCharBufferTranslator;
-    friend class AtomicStringImpl;
     friend class JSC::LLInt::Data;
     friend class JSC::LLIntOffsetsExtractor;
     
@@ -330,8 +329,6 @@ private:
         STRING_STATS_ADD_16BIT_STRING2(m_length, true);
     }
 
-    ~StringImpl();
-
 public:
     WTF_EXPORT_STRING_API static void destroy(StringImpl*);
 
@@ -807,6 +804,9 @@ public:
         return *reinterpret_cast<unsigned*>((tailPointer<SymbolRegistry*>() + 2));
     }
 
+protected:
+    ~StringImpl();
+
 private:
     bool requiresCopy() const
     {
index 5323b277ad9c874d1c46bc2141023b6e87c9400c..b4a164a5afdc00c943ce9a560413847f6a3ab8a0 100644 (file)
@@ -112,11 +112,14 @@ public:
     WTF_EXPORT_STRING_API String(const char* characters);
 
     // Construct a string referencing an existing StringImpl.
-    String(StringImpl& impl) : m_impl(&impl) { }
-    String(StringImpl* impl) : m_impl(impl) { }
-    String(PassRefPtr<StringImpl> impl) : m_impl(impl) { }
-    String(Ref<StringImpl>&& impl) : m_impl(WTF::move(impl)) { }
-    String(RefPtr<StringImpl>&& impl) : m_impl(impl) { }
+    String(StringImpl&);
+    String(StringImpl*);
+    String(PassRefPtr<StringImpl>);
+    String(Ref<StringImpl>&&);
+    String(RefPtr<StringImpl>&&);
+
+    String(Ref<AtomicStringImpl>&&);
+    String(RefPtr<AtomicStringImpl>&&);
 
     // Construct a string from a constant string literal.
     WTF_EXPORT_STRING_API String(ASCIILiteral characters);
@@ -528,6 +531,41 @@ inline void swap(String& a, String& b) { a.swap(b); }
 
 // Definitions of string operations
 
+inline String::String(StringImpl& impl)
+    : m_impl(&impl)
+{
+}
+
+inline String::String(StringImpl* impl)
+    : m_impl(impl)
+{
+}
+
+inline String::String(PassRefPtr<StringImpl> impl)
+    : m_impl(impl)
+{
+}
+
+inline String::String(Ref<StringImpl>&& impl)
+    : m_impl(WTF::move(impl))
+{
+}
+
+inline String::String(RefPtr<StringImpl>&& impl)
+    : m_impl(WTF::move(impl))
+{
+}
+
+inline String::String(Ref<AtomicStringImpl>&& impl)
+    : m_impl(WTF::move(impl))
+{
+}
+
+inline String::String(RefPtr<AtomicStringImpl>&& impl)
+    : m_impl(WTF::move(impl))
+{
+}
+
 template<size_t inlineCapacity, typename OverflowHandler>
 String::String(const Vector<UChar, inlineCapacity, OverflowHandler>& vector)
     : m_impl(vector.size() ? StringImpl::create(vector.data(), vector.size()) : Ref<StringImpl>(*StringImpl::empty()))
similarity index 95%
rename from Source/WTF/wtf/text/cf/AtomicStringCF.cpp
rename to Source/WTF/wtf/text/cf/AtomicStringImplCF.cpp
index 59c82bf3c49278d1e0223d25953edf71f2cd4b4d..4a3f15dae49847aa8ff28dc3a776b675c51f90c7 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include <wtf/text/AtomicString.h>
+#include <wtf/text/AtomicStringImpl.h>
 
 #if USE(CF)
 
@@ -33,7 +33,7 @@
 
 namespace WTF {
 
-RefPtr<StringImpl> AtomicString::add(CFStringRef string)
+RefPtr<AtomicStringImpl> AtomicStringImpl::add(CFStringRef string)
 {
     if (!string)
         return nullptr;
index 5f3cc4f2b0633d24a0b3a5fe279b5bcf6e453c39..2a565225f9597baf6e37c49c3d60381e6bf6de55 100644 (file)
@@ -1,3 +1,13 @@
+2015-05-19  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Move AtomicStringImpl table related operations from AtomicString to AtomicStringImpl
+        https://bugs.webkit.org/show_bug.cgi?id=145109
+
+        Reviewed by Darin Adler.
+
+        * dom/TreeScope.cpp:
+        (WebCore::TreeScope::getElementById):
+
 2015-05-19  Jon Lee  <jonlee@apple.com>
 
         [iOS] Optimized fullscreen placeholder is incorrectly sized
index 42ad921a4a410cb8524436c11854dce8d5ab6e1b..af11a1381b464abb477f73e4641f6a7954e39ff5 100644 (file)
@@ -112,7 +112,7 @@ Element* TreeScope::getElementById(const String& elementId) const
     if (!m_elementsById)
         return nullptr;
 
-    if (AtomicStringImpl* atomicElementId = AtomicString::find(elementId.impl()))
+    if (AtomicStringImpl* atomicElementId = AtomicStringImpl::lookUp(elementId.impl()))
         return m_elementsById->getElementById(*atomicElementId, *this);
 
     return nullptr;
index b9d8dd4d7ec0c01afb9384a43a0bae7250c3599d..0b668d5abf3e3169d01384d377e07af259a9a078 100644 (file)
@@ -1,3 +1,13 @@
+2015-05-19  Yusuke Suzuki  <utatane.tea@gmail.com>
+
+        Move AtomicStringImpl table related operations from AtomicString to AtomicStringImpl
+        https://bugs.webkit.org/show_bug.cgi?id=145109
+
+        Reviewed by Darin Adler.
+
+        * TestWebKitAPI/Tests/WTF/StringImpl.cpp:
+        (TestWebKitAPI::TEST):
+
 2015-05-19  Anders Carlsson  <andersca@apple.com>
 
         Add alternate menu items for performing operations on the default data store
index 83322c9c2bc93567cd68891f45e4906096842dcd..6dc9934098bd7d15507c12aea79dd4fa85b01971 100644 (file)
@@ -525,7 +525,7 @@ TEST(WTF, StringImplSymbolToAtomicString)
     ASSERT_TRUE(reference->isSymbol());
     ASSERT_FALSE(reference->isAtomic());
 
-    RefPtr<StringImpl> atomic = AtomicString::add(reference.get());
+    RefPtr<StringImpl> atomic = AtomicStringImpl::add(reference.get());
     ASSERT_TRUE(atomic->isAtomic());
     ASSERT_FALSE(atomic->isSymbol());
     ASSERT_TRUE(reference->isSymbol());
@@ -538,7 +538,7 @@ TEST(WTF, StringImplSymbolEmptyToAtomicString)
     ASSERT_TRUE(reference->isSymbol());
     ASSERT_FALSE(reference->isAtomic());
 
-    RefPtr<StringImpl> atomic = AtomicString::add(reference.get());
+    RefPtr<StringImpl> atomic = AtomicStringImpl::add(reference.get());
     ASSERT_TRUE(atomic->isAtomic());
     ASSERT_FALSE(atomic->isSymbol());
     ASSERT_TRUE(reference->isSymbol());