Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Unified Diff: Source/wtf/text/StringImpl.h

Issue 21274008: Remove ASCIILiteral optimization from StringImpl (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/text/AtomicString.cpp ('k') | Source/wtf/text/StringImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/text/StringImpl.h
diff --git a/Source/wtf/text/StringImpl.h b/Source/wtf/text/StringImpl.h
index b2f455952d87979983ea6f60afceb8f864a01d57..7d44a80906c43c4ae1dd7d066e9670f1d6aca8d0 100644
--- a/Source/wtf/text/StringImpl.h
+++ b/Source/wtf/text/StringImpl.h
@@ -158,20 +158,6 @@ private:
STRING_STATS_ADD_16BIT_STRING(m_length);
}
- enum ConstructFromLiteralTag { ConstructFromLiteral };
- StringImpl(const char* characters, unsigned length, ConstructFromLiteralTag)
- : m_data8(reinterpret_cast<const LChar*>(characters))
- , m_refCount(s_refCountIncrement)
- , m_length(length)
- , m_hashAndFlags(s_hashFlag8BitBuffer)
- {
- ASSERT(m_data8);
- ASSERT(m_length);
- ASSERT(!characters[length]);
-
- STRING_STATS_ADD_8BIT_STRING(0);
- }
-
public:
~StringImpl();
@@ -188,17 +174,6 @@ public:
static PassRefPtr<StringImpl> create(const LChar*);
ALWAYS_INLINE static PassRefPtr<StringImpl> create(const char* s) { return create(reinterpret_cast<const LChar*>(s)); }
- static PassRefPtr<StringImpl> createFromLiteral(const char* characters, unsigned length);
- template<unsigned charactersCount>
- ALWAYS_INLINE static PassRefPtr<StringImpl> createFromLiteral(const char (&characters)[charactersCount])
- {
- COMPILE_ASSERT(charactersCount > 1, StringImplFromLiteralNotEmpty);
- COMPILE_ASSERT((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImpl)) / sizeof(LChar))), StringImplFromLiteralCannotOverflow);
-
- return createFromLiteral(characters, charactersCount - 1);
- }
- static PassRefPtr<StringImpl> createFromLiteral(const char* characters);
-
static PassRefPtr<StringImpl> createUninitialized(unsigned length, LChar*& data);
static PassRefPtr<StringImpl> createUninitialized(unsigned length, UChar*& data);
template <typename T> static ALWAYS_INLINE PassRefPtr<StringImpl> tryCreateUninitialized(unsigned length, T*& output)
@@ -235,7 +210,6 @@ public:
void truncateAssumingIsolated(unsigned length)
{
ASSERT(hasOneRef());
- ASSERT(!isASCIILiteral());
ASSERT(length <= m_length);
m_length = length;
}
@@ -467,11 +441,6 @@ public:
#endif
private:
- bool isASCIILiteral() const
- {
- return is8Bit() && length() && reinterpret_cast<const void*>(m_data8) != reinterpret_cast<const void*>(this + 1);
- }
-
// This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings.
static const unsigned s_copyCharsInlineCutOff = 20;
@@ -797,8 +766,6 @@ static inline bool isSpaceOrNewline(UChar c)
inline PassRefPtr<StringImpl> StringImpl::isolatedCopy() const
{
- if (isASCIILiteral())
- return StringImpl::createFromLiteral(reinterpret_cast<const char*>(m_data8), m_length);
if (is8Bit())
return create(m_data8, m_length);
return create(m_data16, m_length);
« no previous file with comments | « Source/wtf/text/AtomicString.cpp ('k') | Source/wtf/text/StringImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698