Title: [163410] trunk/Source
Revision
163410
Author
ander...@apple.com
Date
2014-02-04 15:40:42 -0800 (Tue, 04 Feb 2014)

Log Message

Rename the substring sharing StringImpl::create variants to better indicate what they do
https://bugs.webkit.org/show_bug.cgi?id=128214

Reviewed by Geoffrey Garen.

Source/_javascript_Core:

* runtime/JSString.h:
(JSC::jsSingleCharacterSubstring):
(JSC::jsSubstring8):
(JSC::jsSubstring):
* runtime/SmallStrings.cpp:
(JSC::SmallStringsStorage::SmallStringsStorage):
* runtime/StringPrototype.cpp:
(JSC::jsSpliceSubstrings):
(JSC::jsSpliceSubstringsWithSeparators):
(JSC::replaceUsingStringSearch):

Source/WTF:

* wtf/text/AtomicString.cpp:
(WTF::SubstringTranslator::translate):
* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::reifyString):
(WTF::StringBuilder::resize):
* wtf/text/StringImpl.h:
(WTF::StringImpl::createSubstringSharingImpl8):
(WTF::StringImpl::createSubstringSharingImpl):
* wtf/text/WTFString.cpp:
(WTF::String::substringSharingImpl):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (163409 => 163410)


--- trunk/Source/_javascript_Core/ChangeLog	2014-02-04 23:33:55 UTC (rev 163409)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-02-04 23:40:42 UTC (rev 163410)
@@ -1,5 +1,23 @@
 2014-02-04  Anders Carlsson  <ander...@apple.com>
 
+        Rename the substring sharing StringImpl::create variants to better indicate what they do
+        https://bugs.webkit.org/show_bug.cgi?id=128214
+
+        Reviewed by Geoffrey Garen.
+
+        * runtime/JSString.h:
+        (JSC::jsSingleCharacterSubstring):
+        (JSC::jsSubstring8):
+        (JSC::jsSubstring):
+        * runtime/SmallStrings.cpp:
+        (JSC::SmallStringsStorage::SmallStringsStorage):
+        * runtime/StringPrototype.cpp:
+        (JSC::jsSpliceSubstrings):
+        (JSC::jsSpliceSubstringsWithSeparators):
+        (JSC::replaceUsingStringSearch):
+
+2014-02-04  Anders Carlsson  <ander...@apple.com>
+
         Rename StringImpl::getCharacters to StringImpl::characters
         https://bugs.webkit.org/show_bug.cgi?id=128205
 

Modified: trunk/Source/_javascript_Core/runtime/JSString.h (163409 => 163410)


--- trunk/Source/_javascript_Core/runtime/JSString.h	2014-02-04 23:33:55 UTC (rev 163409)
+++ trunk/Source/_javascript_Core/runtime/JSString.h	2014-02-04 23:40:42 UTC (rev 163410)
@@ -360,7 +360,7 @@
         UChar c = s.characterAt(offset);
         if (c <= maxSingleCharacterString)
             return vm->smallStrings.singleCharacterString(c);
-        return JSString::create(*vm, StringImpl::create(s.impl(), offset, 1));
+        return JSString::create(*vm, StringImpl::createSubstringSharingImpl(s.impl(), offset, 1));
     }
 
     inline JSString* jsNontrivialString(VM* vm, const String& s)
@@ -428,7 +428,7 @@
             if (c <= maxSingleCharacterString)
                 return vm->smallStrings.singleCharacterString(c);
         }
-        return JSString::createHasOtherOwner(*vm, StringImpl::create8(s.impl(), offset, length));
+        return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl8(s.impl(), offset, length));
     }
 
     inline JSString* jsSubstring(VM* vm, const String& s, unsigned offset, unsigned length)
@@ -443,7 +443,7 @@
             if (c <= maxSingleCharacterString)
                 return vm->smallStrings.singleCharacterString(c);
         }
-        return JSString::createHasOtherOwner(*vm, StringImpl::create(s.impl(), offset, length));
+        return JSString::createHasOtherOwner(*vm, StringImpl::createSubstringSharingImpl(s.impl(), offset, length));
     }
 
     inline JSString* jsOwnedString(VM* vm, const String& s)

Modified: trunk/Source/_javascript_Core/runtime/SmallStrings.cpp (163409 => 163410)


--- trunk/Source/_javascript_Core/runtime/SmallStrings.cpp	2014-02-04 23:33:55 UTC (rev 163409)
+++ trunk/Source/_javascript_Core/runtime/SmallStrings.cpp	2014-02-04 23:40:42 UTC (rev 163410)
@@ -58,7 +58,7 @@
     RefPtr<StringImpl> baseString = StringImpl::createUninitialized(singleCharacterStringCount, characterBuffer);
     for (unsigned i = 0; i < singleCharacterStringCount; ++i) {
         characterBuffer[i] = i;
-        m_reps[i] = StringImpl::create(baseString, i, 1);
+        m_reps[i] = StringImpl::createSubstringSharingImpl(baseString, i, 1);
     }
 }
 

Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.cpp (163409 => 163410)


--- trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2014-02-04 23:33:55 UTC (rev 163409)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.cpp	2014-02-04 23:40:42 UTC (rev 163410)
@@ -265,7 +265,7 @@
         if (position <= 0 && length >= sourceSize)
             return sourceVal;
         // We could call String::substringSharingImpl(), but this would result in redundant checks.
-        return jsString(exec, StringImpl::create(source.impl(), std::max(0, position), std::min(sourceSize, length)));
+        return jsString(exec, StringImpl::createSubstringSharingImpl(source.impl(), std::max(0, position), std::min(sourceSize, length)));
     }
 
     int totalLength = 0;
@@ -320,7 +320,7 @@
         if (position <= 0 && length >= sourceSize)
             return sourceVal;
         // We could call String::substringSharingImpl(), but this would result in redundant checks.
-        return jsString(exec, StringImpl::create(source.impl(), std::max(0, position), std::min(sourceSize, length)));
+        return jsString(exec, StringImpl::createSubstringSharingImpl(source.impl(), std::max(0, position), std::min(sourceSize, length)));
     }
 
     Checked<int, RecordOverflow> totalLength = 0;
@@ -650,14 +650,14 @@
         return JSValue::encode(jsUndefined());
 
     StringImpl* stringImpl = string.impl();
-    String leftPart(StringImpl::create(stringImpl, 0, matchStart));
+    String leftPart(StringImpl::createSubstringSharingImpl(stringImpl, 0, matchStart));
 
     size_t matchEnd = matchStart + searchString.impl()->length();
     int ovector[2] = { static_cast<int>(matchStart),  static_cast<int>(matchEnd)};
     String middlePart = substituteBackreferences(replaceString, string, ovector, 0);
 
     size_t leftLength = stringImpl->length() - matchEnd;
-    String rightPart(StringImpl::create(stringImpl, matchEnd, leftLength));
+    String rightPart(StringImpl::createSubstringSharingImpl(stringImpl, matchEnd, leftLength));
     return JSValue::encode(JSC::jsString(exec, leftPart, middlePart, rightPart));
 }
 

Modified: trunk/Source/WTF/ChangeLog (163409 => 163410)


--- trunk/Source/WTF/ChangeLog	2014-02-04 23:33:55 UTC (rev 163409)
+++ trunk/Source/WTF/ChangeLog	2014-02-04 23:40:42 UTC (rev 163410)
@@ -1,3 +1,21 @@
+2014-02-04  Anders Carlsson  <ander...@apple.com>
+
+        Rename the substring sharing StringImpl::create variants to better indicate what they do
+        https://bugs.webkit.org/show_bug.cgi?id=128214
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/text/AtomicString.cpp:
+        (WTF::SubstringTranslator::translate):
+        * wtf/text/StringBuilder.cpp:
+        (WTF::StringBuilder::reifyString):
+        (WTF::StringBuilder::resize):
+        * wtf/text/StringImpl.h:
+        (WTF::StringImpl::createSubstringSharingImpl8):
+        (WTF::StringImpl::createSubstringSharingImpl):
+        * wtf/text/WTFString.cpp:
+        (WTF::String::substringSharingImpl):
+
 2014-02-04  Alexey Proskuryakov  <a...@apple.com>
 
         WebCrypto HMAC verification uses a non-constant-time memcmp

Modified: trunk/Source/WTF/wtf/text/AtomicString.cpp (163409 => 163410)


--- trunk/Source/WTF/wtf/text/AtomicString.cpp	2014-02-04 23:33:55 UTC (rev 163409)
+++ trunk/Source/WTF/wtf/text/AtomicString.cpp	2014-02-04 23:40:42 UTC (rev 163410)
@@ -293,7 +293,7 @@
 
     static void translate(StringImpl*& location, const SubstringLocation& buffer, unsigned hash)
     {
-        location = &StringImpl::create(buffer.baseString, buffer.start, buffer.length).leakRef();
+        location = &StringImpl::createSubstringSharingImpl(buffer.baseString, buffer.start, buffer.length).leakRef();
         location->setHash(hash);
         location->setIsAtomic(true);
     }

Modified: trunk/Source/WTF/wtf/text/StringBuilder.cpp (163409 => 163410)


--- trunk/Source/WTF/wtf/text/StringBuilder.cpp	2014-02-04 23:33:55 UTC (rev 163409)
+++ trunk/Source/WTF/wtf/text/StringBuilder.cpp	2014-02-04 23:40:42 UTC (rev 163410)
@@ -58,7 +58,7 @@
     if (m_length == m_buffer->length())
         m_string = m_buffer.get();
     else
-        m_string = StringImpl::create(m_buffer, 0, m_length);
+        m_string = StringImpl::createSubstringSharingImpl(m_buffer, 0, m_length);
 
     if (m_buffer->has16BitShadow() && m_valid16BitShadowLength < m_length)
         m_buffer->upconvertCharacters(m_valid16BitShadowLength, m_length);
@@ -92,7 +92,7 @@
     ASSERT(m_length == m_string.length());
     ASSERT(newSize < m_string.length());
     m_length = newSize;
-    m_string = StringImpl::create(m_string.impl(), 0, newSize);
+    m_string = StringImpl::createSubstringSharingImpl(m_string.impl(), 0, newSize);
 }
 
 // Allocate a new 8 bit buffer, copying in currentCharacters (these may come from either m_string

Modified: trunk/Source/WTF/wtf/text/StringImpl.h (163409 => 163410)


--- trunk/Source/WTF/wtf/text/StringImpl.h	2014-02-04 23:33:55 UTC (rev 163409)
+++ trunk/Source/WTF/wtf/text/StringImpl.h	2014-02-04 23:40:42 UTC (rev 163410)
@@ -342,7 +342,7 @@
     WTF_EXPORT_STRING_API static PassRef<StringImpl> create(const LChar*);
     ALWAYS_INLINE static PassRef<StringImpl> create(const char* s) { return create(reinterpret_cast<const LChar*>(s)); }
 
-    static ALWAYS_INLINE PassRef<StringImpl> create8(PassRefPtr<StringImpl> rep, unsigned offset, unsigned length)
+    static ALWAYS_INLINE PassRef<StringImpl> createSubstringSharingImpl8(PassRefPtr<StringImpl> rep, unsigned offset, unsigned length)
     {
         ASSERT(rep);
         ASSERT(length <= rep->length());
@@ -355,7 +355,7 @@
         return adoptRef(*new StringImpl(rep->m_data8 + offset, length, ownerRep));
     }
 
-    static ALWAYS_INLINE PassRef<StringImpl> create(PassRefPtr<StringImpl> rep, unsigned offset, unsigned length)
+    static ALWAYS_INLINE PassRef<StringImpl> createSubstringSharingImpl(PassRefPtr<StringImpl> rep, unsigned offset, unsigned length)
     {
         ASSERT(rep);
         ASSERT(length <= rep->length());

Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (163409 => 163410)


--- trunk/Source/WTF/wtf/text/WTFString.cpp	2014-02-04 23:33:55 UTC (rev 163409)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp	2014-02-04 23:40:42 UTC (rev 163410)
@@ -317,7 +317,7 @@
 
     if (!offset && length == stringLength)
         return *this;
-    return String(StringImpl::create(m_impl, offset, length));
+    return String(StringImpl::createSubstringSharingImpl(m_impl, offset, length));
 }
 
 String String::lower() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to