Diff
Modified: trunk/Source/_javascript_Core/runtime/Identifier.cpp (158473 => 158474)
--- trunk/Source/_javascript_Core/runtime/Identifier.cpp 2013-11-02 01:38:01 UTC (rev 158473)
+++ trunk/Source/_javascript_Core/runtime/Identifier.cpp 2013-11-02 01:45:10 UTC (rev 158474)
@@ -62,7 +62,7 @@
static void translate(StringImpl*& location, const LChar* c, unsigned hash)
{
size_t length = strlen(reinterpret_cast<const char*>(c));
- location = StringImpl::createFromLiteral(reinterpret_cast<const char*>(c), length).leakRef();
+ location = &StringImpl::createFromLiteral(reinterpret_cast<const char*>(c), length).leakRef();
location->setHash(hash);
}
};
Modified: trunk/Source/WTF/ChangeLog (158473 => 158474)
--- trunk/Source/WTF/ChangeLog 2013-11-02 01:38:01 UTC (rev 158473)
+++ trunk/Source/WTF/ChangeLog 2013-11-02 01:45:10 UTC (rev 158474)
@@ -1,5 +1,15 @@
2013-11-01 Andreas Kling <akl...@apple.com>
+ Make more StringImpl construction helpers return PassRef.
+ <https://webkit.org/b/123652>
+
+ Tweak another handful of StringImpl constructor functions to return
+ PassRef<StringImpl> instead of PassRefPtr.
+
+ Reviewed by Anders Carlsson.
+
+2013-11-01 Andreas Kling <akl...@apple.com>
+
Neuter WTF_MAKE_FAST_ALLOCATED in GLOBAL_FASTMALLOC_NEW builds.
<https://webkit.org/b/123639>
Modified: trunk/Source/WTF/wtf/text/AtomicString.cpp (158473 => 158474)
--- trunk/Source/WTF/wtf/text/AtomicString.cpp 2013-11-02 01:38:01 UTC (rev 158473)
+++ trunk/Source/WTF/wtf/text/AtomicString.cpp 2013-11-02 01:45:10 UTC (rev 158474)
@@ -97,7 +97,7 @@
static void translate(StringImpl*& location, const LChar* const& c, unsigned hash)
{
- location = StringImpl::create(c).leakRef();
+ location = &StringImpl::create(c).leakRef();
location->setHash(hash);
location->setIsAtomic(true);
}
@@ -352,7 +352,7 @@
static void translate(StringImpl*& location, const CharBuffer& buf, unsigned hash)
{
- location = StringImpl::createFromLiteral(buf.s, buf.length).leakRef();
+ location = &StringImpl::createFromLiteral(buf.s, buf.length).leakRef();
location->setHash(hash);
location->setIsAtomic(true);
}
Modified: trunk/Source/WTF/wtf/text/StringImpl.cpp (158473 => 158474)
--- trunk/Source/WTF/wtf/text/StringImpl.cpp 2013-11-02 01:38:01 UTC (rev 158473)
+++ trunk/Source/WTF/wtf/text/StringImpl.cpp 2013-11-02 01:45:10 UTC (rev 158474)
@@ -149,14 +149,14 @@
fastFree(stringImpl);
}
-PassRefPtr<StringImpl> StringImpl::createFromLiteral(const char* characters, unsigned length)
+PassRef<StringImpl> StringImpl::createFromLiteral(const char* characters, unsigned length)
{
ASSERT_WITH_MESSAGE(length, "Use StringImpl::empty() to create an empty string");
ASSERT(charactersAreAllASCII<LChar>(reinterpret_cast<const LChar*>(characters), length));
- return adoptRef(new StringImpl(reinterpret_cast<const LChar*>(characters), length, ConstructWithoutCopying));
+ return adoptRef(*new StringImpl(reinterpret_cast<const LChar*>(characters), length, ConstructWithoutCopying));
}
-PassRefPtr<StringImpl> StringImpl::createFromLiteral(const char* characters)
+PassRef<StringImpl> StringImpl::createFromLiteral(const char* characters)
{
return createFromLiteral(characters, strlen(characters));
}
@@ -292,10 +292,10 @@
return StringImpl::create8BitIfPossible(string, lengthOfNullTerminatedString(string));
}
-PassRefPtr<StringImpl> StringImpl::create(const LChar* string)
+PassRef<StringImpl> StringImpl::create(const LChar* string)
{
if (!string)
- return empty();
+ return *empty();
size_t length = strlen(reinterpret_cast<const char*>(string));
if (length > numeric_limits<unsigned>::max())
CRASH();
Modified: trunk/Source/WTF/wtf/text/StringImpl.h (158473 => 158474)
--- trunk/Source/WTF/wtf/text/StringImpl.h 2013-11-02 01:38:01 UTC (rev 158473)
+++ trunk/Source/WTF/wtf/text/StringImpl.h 2013-11-02 01:45:10 UTC (rev 158474)
@@ -348,9 +348,9 @@
}
WTF_EXPORT_STRING_API static PassRef<StringImpl> create8BitIfPossible(const UChar*);
- ALWAYS_INLINE static PassRefPtr<StringImpl> create(const char* s, unsigned length) { return create(reinterpret_cast<const LChar*>(s), length); }
- WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> create(const LChar*);
- ALWAYS_INLINE static PassRefPtr<StringImpl> create(const char* s) { return create(reinterpret_cast<const LChar*>(s)); }
+ ALWAYS_INLINE static PassRef<StringImpl> create(const char* s, unsigned length) { return create(reinterpret_cast<const LChar*>(s), length); }
+ 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 PassRefPtr<StringImpl> create8(PassRefPtr<StringImpl> rep, unsigned offset, unsigned length)
{
@@ -380,7 +380,7 @@
}
template<unsigned charactersCount>
- ALWAYS_INLINE static PassRefPtr<StringImpl> createFromLiteral(const char (&characters)[charactersCount])
+ ALWAYS_INLINE static PassRef<StringImpl> createFromLiteral(const char (&characters)[charactersCount])
{
COMPILE_ASSERT(charactersCount > 1, StringImplFromLiteralNotEmpty);
COMPILE_ASSERT((charactersCount - 1 <= ((unsigned(~0) - sizeof(StringImpl)) / sizeof(LChar))), StringImplFromLiteralCannotOverflow);
@@ -389,8 +389,8 @@
}
// FIXME: Transition off of these functions to createWithoutCopying instead.
- WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> createFromLiteral(const char* characters, unsigned length);
- WTF_EXPORT_STRING_API static PassRefPtr<StringImpl> createFromLiteral(const char* characters);
+ WTF_EXPORT_STRING_API static PassRef<StringImpl> createFromLiteral(const char* characters, unsigned length);
+ WTF_EXPORT_STRING_API static PassRef<StringImpl> createFromLiteral(const char* characters);
WTF_EXPORT_STRING_API static PassRef<StringImpl> createWithoutCopying(const UChar* characters, unsigned length);
WTF_EXPORT_STRING_API static PassRef<StringImpl> createWithoutCopying(const LChar* characters, unsigned length);
Modified: trunk/Source/WTF/wtf/text/WTFString.cpp (158473 => 158474)
--- trunk/Source/WTF/wtf/text/WTFString.cpp 2013-11-02 01:38:01 UTC (rev 158473)
+++ trunk/Source/WTF/wtf/text/WTFString.cpp 2013-11-02 01:45:10 UTC (rev 158474)
@@ -75,13 +75,15 @@
// Construct a string with latin1 data, from a null-terminated source.
String::String(const LChar* characters)
- : m_impl(characters ? StringImpl::create(characters) : 0)
{
+ if (characters)
+ m_impl = StringImpl::create(characters);
}
String::String(const char* characters)
- : m_impl(characters ? StringImpl::create(reinterpret_cast<const LChar*>(characters)) : 0)
{
+ if (characters)
+ m_impl = StringImpl::create(reinterpret_cast<const LChar*>(characters));
}
String::String(ASCIILiteral characters)