OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) | 4 * (C) 2001 Dirk Mueller ( mueller@kde.org ) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2013 Apple Inc. All |
6 * rights reserved. | 6 * rights reserved. |
7 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) | 7 * Copyright (C) 2006 Andrew Wellington (proton@wiretapped.net) |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 unsigned totalOverhead = m_totalNumberStrings * sizeof(StringImpl); | 276 unsigned totalOverhead = m_totalNumberStrings * sizeof(StringImpl); |
277 double overheadPercent = (double)totalOverhead / (double)totalDataBytes * 100; | 277 double overheadPercent = (double)totalOverhead / (double)totalDataBytes * 100; |
278 dataLogF(" StringImpl overheader: %8u (%5.2f%%)\n", totalOverhead, | 278 dataLogF(" StringImpl overheader: %8u (%5.2f%%)\n", totalOverhead, |
279 overheadPercent); | 279 overheadPercent); |
280 | 280 |
281 internal::callOnMainThread(&printLiveStringStats, nullptr); | 281 internal::callOnMainThread(&printLiveStringStats, nullptr); |
282 } | 282 } |
283 #endif | 283 #endif |
284 | 284 |
285 void* StringImpl::operator new(size_t size) { | 285 void* StringImpl::operator new(size_t size) { |
286 ASSERT(size == sizeof(StringImpl)); | 286 DCHECK_EQ(size, sizeof(StringImpl)); |
287 return Partitions::bufferMalloc(size, "WTF::StringImpl"); | 287 return Partitions::bufferMalloc(size, "WTF::StringImpl"); |
288 } | 288 } |
289 | 289 |
290 void StringImpl::operator delete(void* ptr) { | 290 void StringImpl::operator delete(void* ptr) { |
291 Partitions::bufferFree(ptr); | 291 Partitions::bufferFree(ptr); |
292 } | 292 } |
293 | 293 |
294 inline StringImpl::~StringImpl() { | 294 inline StringImpl::~StringImpl() { |
295 ASSERT(!isStatic()); | 295 DCHECK(!isStatic()); |
296 | 296 |
297 STRING_STATS_REMOVE_STRING(this); | 297 STRING_STATS_REMOVE_STRING(this); |
298 | 298 |
299 if (isAtomic()) | 299 if (isAtomic()) |
300 AtomicStringTable::instance().remove(this); | 300 AtomicStringTable::instance().remove(this); |
301 } | 301 } |
302 | 302 |
303 void StringImpl::destroyIfNotStatic() { | 303 void StringImpl::destroyIfNotStatic() { |
304 if (!isStatic()) | 304 if (!isStatic()) |
305 delete this; | 305 delete this; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 | 349 |
350 data = reinterpret_cast<UChar*>(string + 1); | 350 data = reinterpret_cast<UChar*>(string + 1); |
351 return adoptRef(new (string) StringImpl(length)); | 351 return adoptRef(new (string) StringImpl(length)); |
352 } | 352 } |
353 | 353 |
354 static StaticStringsTable& staticStrings() { | 354 static StaticStringsTable& staticStrings() { |
355 DEFINE_STATIC_LOCAL(StaticStringsTable, staticStrings, ()); | 355 DEFINE_STATIC_LOCAL(StaticStringsTable, staticStrings, ()); |
356 return staticStrings; | 356 return staticStrings; |
357 } | 357 } |
358 | 358 |
359 #if ENABLE(ASSERT) | 359 #if DCHECK_IS_ON() |
360 static bool s_allowCreationOfStaticStrings = true; | 360 static bool s_allowCreationOfStaticStrings = true; |
361 #endif | 361 #endif |
362 | 362 |
363 const StaticStringsTable& StringImpl::allStaticStrings() { | 363 const StaticStringsTable& StringImpl::allStaticStrings() { |
364 return staticStrings(); | 364 return staticStrings(); |
365 } | 365 } |
366 | 366 |
367 void StringImpl::freezeStaticStrings() { | 367 void StringImpl::freezeStaticStrings() { |
368 ASSERT(isMainThread()); | 368 DCHECK(isMainThread()); |
369 | 369 |
370 #if ENABLE(ASSERT) | 370 #if DCHECK_IS_ON() |
371 s_allowCreationOfStaticStrings = false; | 371 s_allowCreationOfStaticStrings = false; |
372 #endif | 372 #endif |
373 } | 373 } |
374 | 374 |
375 unsigned StringImpl::m_highestStaticStringLength = 0; | 375 unsigned StringImpl::m_highestStaticStringLength = 0; |
376 | 376 |
377 StringImpl* StringImpl::createStatic(const char* string, | 377 StringImpl* StringImpl::createStatic(const char* string, |
378 unsigned length, | 378 unsigned length, |
379 unsigned hash) { | 379 unsigned hash) { |
380 ASSERT(s_allowCreationOfStaticStrings); | 380 #if DCHECK_IS_ON() |
381 ASSERT(string); | 381 DCHECK(s_allowCreationOfStaticStrings); |
382 ASSERT(length); | 382 #endif |
| 383 DCHECK(string); |
| 384 DCHECK(length); |
383 | 385 |
384 StaticStringsTable::const_iterator it = staticStrings().find(hash); | 386 StaticStringsTable::const_iterator it = staticStrings().find(hash); |
385 if (it != staticStrings().end()) { | 387 if (it != staticStrings().end()) { |
386 ASSERT(!memcmp(string, it->value + 1, length * sizeof(LChar))); | 388 DCHECK(!memcmp(string, it->value + 1, length * sizeof(LChar))); |
387 return it->value; | 389 return it->value; |
388 } | 390 } |
389 | 391 |
390 // Allocate a single buffer large enough to contain the StringImpl | 392 // Allocate a single buffer large enough to contain the StringImpl |
391 // struct as well as the data which it contains. This removes one | 393 // struct as well as the data which it contains. This removes one |
392 // heap allocation from this call. | 394 // heap allocation from this call. |
393 RELEASE_ASSERT(length <= | 395 RELEASE_ASSERT(length <= |
394 ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / | 396 ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / |
395 sizeof(LChar))); | 397 sizeof(LChar))); |
396 size_t size = sizeof(StringImpl) + length * sizeof(LChar); | 398 size_t size = sizeof(StringImpl) + length * sizeof(LChar); |
397 | 399 |
398 WTF_INTERNAL_LEAK_SANITIZER_DISABLED_SCOPE; | 400 WTF_INTERNAL_LEAK_SANITIZER_DISABLED_SCOPE; |
399 StringImpl* impl = static_cast<StringImpl*>( | 401 StringImpl* impl = static_cast<StringImpl*>( |
400 Partitions::bufferMalloc(size, "WTF::StringImpl")); | 402 Partitions::bufferMalloc(size, "WTF::StringImpl")); |
401 | 403 |
402 LChar* data = reinterpret_cast<LChar*>(impl + 1); | 404 LChar* data = reinterpret_cast<LChar*>(impl + 1); |
403 impl = new (impl) StringImpl(length, hash, StaticString); | 405 impl = new (impl) StringImpl(length, hash, StaticString); |
404 memcpy(data, string, length * sizeof(LChar)); | 406 memcpy(data, string, length * sizeof(LChar)); |
405 #if ENABLE(ASSERT) | 407 #if DCHECK_IS_ON() |
406 impl->assertHashIsCorrect(); | 408 impl->assertHashIsCorrect(); |
407 #endif | 409 #endif |
408 | 410 |
409 ASSERT(isMainThread()); | 411 DCHECK(isMainThread()); |
410 m_highestStaticStringLength = std::max(m_highestStaticStringLength, length); | 412 m_highestStaticStringLength = std::max(m_highestStaticStringLength, length); |
411 staticStrings().add(hash, impl); | 413 staticStrings().add(hash, impl); |
412 WTF_ANNOTATE_BENIGN_RACE(impl, | 414 WTF_ANNOTATE_BENIGN_RACE(impl, |
413 "Benign race on the reference counter of a static " | 415 "Benign race on the reference counter of a static " |
414 "string created by StringImpl::createStatic"); | 416 "string created by StringImpl::createStatic"); |
415 | 417 |
416 return impl; | 418 return impl; |
417 } | 419 } |
418 | 420 |
419 void StringImpl::reserveStaticStringsCapacityForSize(unsigned size) { | 421 void StringImpl::reserveStaticStringsCapacityForSize(unsigned size) { |
420 ASSERT(s_allowCreationOfStaticStrings); | 422 #if DCHECK_IS_ON() |
| 423 DCHECK(s_allowCreationOfStaticStrings); |
| 424 #endif |
421 staticStrings().reserveCapacityForSize(size); | 425 staticStrings().reserveCapacityForSize(size); |
422 } | 426 } |
423 | 427 |
424 PassRefPtr<StringImpl> StringImpl::create(const UChar* characters, | 428 PassRefPtr<StringImpl> StringImpl::create(const UChar* characters, |
425 unsigned length) { | 429 unsigned length) { |
426 if (!characters || !length) | 430 if (!characters || !length) |
427 return empty(); | 431 return empty(); |
428 | 432 |
429 UChar* data; | 433 UChar* data; |
430 RefPtr<StringImpl> string = createUninitialized(length, data); | 434 RefPtr<StringImpl> string = createUninitialized(length, data); |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 if (replacement.isNull()) | 1727 if (replacement.isNull()) |
1724 return this; | 1728 return this; |
1725 if (replacement.is8Bit()) | 1729 if (replacement.is8Bit()) |
1726 return replace(pattern, replacement.characters8(), replacement.length()); | 1730 return replace(pattern, replacement.characters8(), replacement.length()); |
1727 return replace(pattern, replacement.characters16(), replacement.length()); | 1731 return replace(pattern, replacement.characters16(), replacement.length()); |
1728 } | 1732 } |
1729 | 1733 |
1730 PassRefPtr<StringImpl> StringImpl::replace(UChar pattern, | 1734 PassRefPtr<StringImpl> StringImpl::replace(UChar pattern, |
1731 const LChar* replacement, | 1735 const LChar* replacement, |
1732 unsigned repStrLength) { | 1736 unsigned repStrLength) { |
1733 ASSERT(replacement); | 1737 DCHECK(replacement); |
1734 | 1738 |
1735 size_t srcSegmentStart = 0; | 1739 size_t srcSegmentStart = 0; |
1736 unsigned matchCount = 0; | 1740 unsigned matchCount = 0; |
1737 | 1741 |
1738 // Count the matches. | 1742 // Count the matches. |
1739 while ((srcSegmentStart = find(pattern, srcSegmentStart)) != kNotFound) { | 1743 while ((srcSegmentStart = find(pattern, srcSegmentStart)) != kNotFound) { |
1740 ++matchCount; | 1744 ++matchCount; |
1741 ++srcSegmentStart; | 1745 ++srcSegmentStart; |
1742 } | 1746 } |
1743 | 1747 |
(...skipping 27 matching lines...) Expand all Loading... |
1771 dstOffset += srcSegmentLength; | 1775 dstOffset += srcSegmentLength; |
1772 memcpy(data + dstOffset, replacement, repStrLength * sizeof(LChar)); | 1776 memcpy(data + dstOffset, replacement, repStrLength * sizeof(LChar)); |
1773 dstOffset += repStrLength; | 1777 dstOffset += repStrLength; |
1774 srcSegmentStart = srcSegmentEnd + 1; | 1778 srcSegmentStart = srcSegmentEnd + 1; |
1775 } | 1779 } |
1776 | 1780 |
1777 srcSegmentLength = m_length - srcSegmentStart; | 1781 srcSegmentLength = m_length - srcSegmentStart; |
1778 memcpy(data + dstOffset, characters8() + srcSegmentStart, | 1782 memcpy(data + dstOffset, characters8() + srcSegmentStart, |
1779 srcSegmentLength * sizeof(LChar)); | 1783 srcSegmentLength * sizeof(LChar)); |
1780 | 1784 |
1781 ASSERT(dstOffset + srcSegmentLength == newImpl->length()); | 1785 DCHECK_EQ(dstOffset + srcSegmentLength, newImpl->length()); |
1782 | 1786 |
1783 return newImpl.release(); | 1787 return newImpl.release(); |
1784 } | 1788 } |
1785 | 1789 |
1786 UChar* data; | 1790 UChar* data; |
1787 RefPtr<StringImpl> newImpl = createUninitialized(newSize, data); | 1791 RefPtr<StringImpl> newImpl = createUninitialized(newSize, data); |
1788 | 1792 |
1789 while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != kNotFound) { | 1793 while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != kNotFound) { |
1790 srcSegmentLength = srcSegmentEnd - srcSegmentStart; | 1794 srcSegmentLength = srcSegmentEnd - srcSegmentStart; |
1791 memcpy(data + dstOffset, characters16() + srcSegmentStart, | 1795 memcpy(data + dstOffset, characters16() + srcSegmentStart, |
1792 srcSegmentLength * sizeof(UChar)); | 1796 srcSegmentLength * sizeof(UChar)); |
1793 | 1797 |
1794 dstOffset += srcSegmentLength; | 1798 dstOffset += srcSegmentLength; |
1795 for (unsigned i = 0; i < repStrLength; ++i) | 1799 for (unsigned i = 0; i < repStrLength; ++i) |
1796 data[i + dstOffset] = replacement[i]; | 1800 data[i + dstOffset] = replacement[i]; |
1797 | 1801 |
1798 dstOffset += repStrLength; | 1802 dstOffset += repStrLength; |
1799 srcSegmentStart = srcSegmentEnd + 1; | 1803 srcSegmentStart = srcSegmentEnd + 1; |
1800 } | 1804 } |
1801 | 1805 |
1802 srcSegmentLength = m_length - srcSegmentStart; | 1806 srcSegmentLength = m_length - srcSegmentStart; |
1803 memcpy(data + dstOffset, characters16() + srcSegmentStart, | 1807 memcpy(data + dstOffset, characters16() + srcSegmentStart, |
1804 srcSegmentLength * sizeof(UChar)); | 1808 srcSegmentLength * sizeof(UChar)); |
1805 | 1809 |
1806 ASSERT(dstOffset + srcSegmentLength == newImpl->length()); | 1810 DCHECK_EQ(dstOffset + srcSegmentLength, newImpl->length()); |
1807 | 1811 |
1808 return newImpl.release(); | 1812 return newImpl.release(); |
1809 } | 1813 } |
1810 | 1814 |
1811 PassRefPtr<StringImpl> StringImpl::replace(UChar pattern, | 1815 PassRefPtr<StringImpl> StringImpl::replace(UChar pattern, |
1812 const UChar* replacement, | 1816 const UChar* replacement, |
1813 unsigned repStrLength) { | 1817 unsigned repStrLength) { |
1814 ASSERT(replacement); | 1818 DCHECK(replacement); |
1815 | 1819 |
1816 size_t srcSegmentStart = 0; | 1820 size_t srcSegmentStart = 0; |
1817 unsigned matchCount = 0; | 1821 unsigned matchCount = 0; |
1818 | 1822 |
1819 // Count the matches. | 1823 // Count the matches. |
1820 while ((srcSegmentStart = find(pattern, srcSegmentStart)) != kNotFound) { | 1824 while ((srcSegmentStart = find(pattern, srcSegmentStart)) != kNotFound) { |
1821 ++matchCount; | 1825 ++matchCount; |
1822 ++srcSegmentStart; | 1826 ++srcSegmentStart; |
1823 } | 1827 } |
1824 | 1828 |
(...skipping 29 matching lines...) Expand all Loading... |
1854 memcpy(data + dstOffset, replacement, repStrLength * sizeof(UChar)); | 1858 memcpy(data + dstOffset, replacement, repStrLength * sizeof(UChar)); |
1855 | 1859 |
1856 dstOffset += repStrLength; | 1860 dstOffset += repStrLength; |
1857 srcSegmentStart = srcSegmentEnd + 1; | 1861 srcSegmentStart = srcSegmentEnd + 1; |
1858 } | 1862 } |
1859 | 1863 |
1860 srcSegmentLength = m_length - srcSegmentStart; | 1864 srcSegmentLength = m_length - srcSegmentStart; |
1861 for (unsigned i = 0; i < srcSegmentLength; ++i) | 1865 for (unsigned i = 0; i < srcSegmentLength; ++i) |
1862 data[i + dstOffset] = characters8()[i + srcSegmentStart]; | 1866 data[i + dstOffset] = characters8()[i + srcSegmentStart]; |
1863 | 1867 |
1864 ASSERT(dstOffset + srcSegmentLength == newImpl->length()); | 1868 DCHECK_EQ(dstOffset + srcSegmentLength, newImpl->length()); |
1865 | 1869 |
1866 return newImpl.release(); | 1870 return newImpl.release(); |
1867 } | 1871 } |
1868 | 1872 |
1869 UChar* data; | 1873 UChar* data; |
1870 RefPtr<StringImpl> newImpl = createUninitialized(newSize, data); | 1874 RefPtr<StringImpl> newImpl = createUninitialized(newSize, data); |
1871 | 1875 |
1872 while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != kNotFound) { | 1876 while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != kNotFound) { |
1873 srcSegmentLength = srcSegmentEnd - srcSegmentStart; | 1877 srcSegmentLength = srcSegmentEnd - srcSegmentStart; |
1874 memcpy(data + dstOffset, characters16() + srcSegmentStart, | 1878 memcpy(data + dstOffset, characters16() + srcSegmentStart, |
1875 srcSegmentLength * sizeof(UChar)); | 1879 srcSegmentLength * sizeof(UChar)); |
1876 | 1880 |
1877 dstOffset += srcSegmentLength; | 1881 dstOffset += srcSegmentLength; |
1878 memcpy(data + dstOffset, replacement, repStrLength * sizeof(UChar)); | 1882 memcpy(data + dstOffset, replacement, repStrLength * sizeof(UChar)); |
1879 | 1883 |
1880 dstOffset += repStrLength; | 1884 dstOffset += repStrLength; |
1881 srcSegmentStart = srcSegmentEnd + 1; | 1885 srcSegmentStart = srcSegmentEnd + 1; |
1882 } | 1886 } |
1883 | 1887 |
1884 srcSegmentLength = m_length - srcSegmentStart; | 1888 srcSegmentLength = m_length - srcSegmentStart; |
1885 memcpy(data + dstOffset, characters16() + srcSegmentStart, | 1889 memcpy(data + dstOffset, characters16() + srcSegmentStart, |
1886 srcSegmentLength * sizeof(UChar)); | 1890 srcSegmentLength * sizeof(UChar)); |
1887 | 1891 |
1888 ASSERT(dstOffset + srcSegmentLength == newImpl->length()); | 1892 DCHECK_EQ(dstOffset + srcSegmentLength, newImpl->length()); |
1889 | 1893 |
1890 return newImpl.release(); | 1894 return newImpl.release(); |
1891 } | 1895 } |
1892 | 1896 |
1893 PassRefPtr<StringImpl> StringImpl::replace(const StringView& pattern, | 1897 PassRefPtr<StringImpl> StringImpl::replace(const StringView& pattern, |
1894 const StringView& replacement) { | 1898 const StringView& replacement) { |
1895 if (pattern.isNull() || replacement.isNull()) | 1899 if (pattern.isNull() || replacement.isNull()) |
1896 return this; | 1900 return this; |
1897 | 1901 |
1898 unsigned patternLength = pattern.length(); | 1902 unsigned patternLength = pattern.length(); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1947 memcpy(data + dstOffset, replacement.characters8(), | 1951 memcpy(data + dstOffset, replacement.characters8(), |
1948 repStrLength * sizeof(LChar)); | 1952 repStrLength * sizeof(LChar)); |
1949 dstOffset += repStrLength; | 1953 dstOffset += repStrLength; |
1950 srcSegmentStart = srcSegmentEnd + patternLength; | 1954 srcSegmentStart = srcSegmentEnd + patternLength; |
1951 } | 1955 } |
1952 | 1956 |
1953 srcSegmentLength = m_length - srcSegmentStart; | 1957 srcSegmentLength = m_length - srcSegmentStart; |
1954 memcpy(data + dstOffset, characters8() + srcSegmentStart, | 1958 memcpy(data + dstOffset, characters8() + srcSegmentStart, |
1955 srcSegmentLength * sizeof(LChar)); | 1959 srcSegmentLength * sizeof(LChar)); |
1956 | 1960 |
1957 ASSERT(dstOffset + srcSegmentLength == newImpl->length()); | 1961 DCHECK_EQ(dstOffset + srcSegmentLength, newImpl->length()); |
1958 | 1962 |
1959 return newImpl.release(); | 1963 return newImpl.release(); |
1960 } | 1964 } |
1961 | 1965 |
1962 UChar* data; | 1966 UChar* data; |
1963 RefPtr<StringImpl> newImpl = createUninitialized(newSize, data); | 1967 RefPtr<StringImpl> newImpl = createUninitialized(newSize, data); |
1964 while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != kNotFound) { | 1968 while ((srcSegmentEnd = find(pattern, srcSegmentStart)) != kNotFound) { |
1965 srcSegmentLength = srcSegmentEnd - srcSegmentStart; | 1969 srcSegmentLength = srcSegmentEnd - srcSegmentStart; |
1966 if (srcIs8Bit) { | 1970 if (srcIs8Bit) { |
1967 // Case 3. | 1971 // Case 3. |
(...skipping 22 matching lines...) Expand all Loading... |
1990 if (srcIs8Bit) { | 1994 if (srcIs8Bit) { |
1991 // Case 3. | 1995 // Case 3. |
1992 for (unsigned i = 0; i < srcSegmentLength; ++i) | 1996 for (unsigned i = 0; i < srcSegmentLength; ++i) |
1993 data[i + dstOffset] = characters8()[i + srcSegmentStart]; | 1997 data[i + dstOffset] = characters8()[i + srcSegmentStart]; |
1994 } else { | 1998 } else { |
1995 // Cases 2 & 4. | 1999 // Cases 2 & 4. |
1996 memcpy(data + dstOffset, characters16() + srcSegmentStart, | 2000 memcpy(data + dstOffset, characters16() + srcSegmentStart, |
1997 srcSegmentLength * sizeof(UChar)); | 2001 srcSegmentLength * sizeof(UChar)); |
1998 } | 2002 } |
1999 | 2003 |
2000 ASSERT(dstOffset + srcSegmentLength == newImpl->length()); | 2004 DCHECK_EQ(dstOffset + srcSegmentLength, newImpl->length()); |
2001 | 2005 |
2002 return newImpl.release(); | 2006 return newImpl.release(); |
2003 } | 2007 } |
2004 | 2008 |
2005 PassRefPtr<StringImpl> StringImpl::upconvertedString() { | 2009 PassRefPtr<StringImpl> StringImpl::upconvertedString() { |
2006 if (is8Bit()) | 2010 if (is8Bit()) |
2007 return String::make16BitFrom8BitSource(characters8(), m_length) | 2011 return String::make16BitFrom8BitSource(characters8(), m_length) |
2008 .releaseImpl(); | 2012 .releaseImpl(); |
2009 return this; | 2013 return this; |
2010 } | 2014 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2092 if (!bc) | 2096 if (!bc) |
2093 return false; | 2097 return false; |
2094 if (aPtr[i] != bc) | 2098 if (aPtr[i] != bc) |
2095 return false; | 2099 return false; |
2096 } | 2100 } |
2097 | 2101 |
2098 return !b[length]; | 2102 return !b[length]; |
2099 } | 2103 } |
2100 | 2104 |
2101 bool equalNonNull(const StringImpl* a, const StringImpl* b) { | 2105 bool equalNonNull(const StringImpl* a, const StringImpl* b) { |
2102 ASSERT(a && b); | 2106 DCHECK(a); |
| 2107 DCHECK(b); |
2103 if (a == b) | 2108 if (a == b) |
2104 return true; | 2109 return true; |
2105 | 2110 |
2106 return stringImplContentEqual(a, b); | 2111 return stringImplContentEqual(a, b); |
2107 } | 2112 } |
2108 | 2113 |
2109 bool equalIgnoringNullity(StringImpl* a, StringImpl* b) { | 2114 bool equalIgnoringNullity(StringImpl* a, StringImpl* b) { |
2110 if (!a && b && !b->length()) | 2115 if (!a && b && !b->length()) |
2111 return true; | 2116 return true; |
2112 if (!b && a && !a->length()) | 2117 if (!b && a && !a->length()) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2165 } else if (localeIdMatchesLang(localeIdentifier, "lt")) { | 2170 } else if (localeIdMatchesLang(localeIdentifier, "lt")) { |
2166 // TODO(rob.buis) implement upper-casing rules for lt | 2171 // TODO(rob.buis) implement upper-casing rules for lt |
2167 // like in StringImpl::upper(locale). | 2172 // like in StringImpl::upper(locale). |
2168 } | 2173 } |
2169 } | 2174 } |
2170 | 2175 |
2171 return toUpper(c); | 2176 return toUpper(c); |
2172 } | 2177 } |
2173 | 2178 |
2174 } // namespace WTF | 2179 } // namespace WTF |
OLD | NEW |