https://bugs.webkit.org/show_bug.cgi?id=141258
Reviewed by Daniel Bates.
* wtf/text/StringImpl.h: (WTF::equal): Add custom implementations for ASan.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@179644
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-02-04 Alexey Proskuryakov <ap@apple.com>
+
+ Optimized equal() functions in StringImpl.h are not ASan compatible
+ https://bugs.webkit.org/show_bug.cgi?id=141258
+
+ Reviewed by Daniel Bates.
+
+ * wtf/text/StringImpl.h: (WTF::equal): Add custom implementations for ASan.
+
2015-02-04 Chris Dumez <cdumez@apple.com>
Add removeFirst(value) / removeAll(value) methods to WTF::Vector
2015-02-04 Chris Dumez <cdumez@apple.com>
Add removeFirst(value) / removeAll(value) methods to WTF::Vector
}
// Do comparisons 8 or 4 bytes-at-a-time on architectures where it's safe.
}
// Do comparisons 8 or 4 bytes-at-a-time on architectures where it's safe.
-#if CPU(X86_64) || CPU(ARM64)
+#if (CPU(X86_64) || CPU(ARM64)) && !ASAN_ENABLED
ALWAYS_INLINE bool equal(const LChar* aLChar, const LChar* bLChar, unsigned length)
{
unsigned dwordLength = length >> 3;
ALWAYS_INLINE bool equal(const LChar* aLChar, const LChar* bLChar, unsigned length)
{
unsigned dwordLength = length >> 3;
+#elif CPU(X86) && !ASAN_ENABLED
ALWAYS_INLINE bool equal(const LChar* aLChar, const LChar* bLChar, unsigned length)
{
const char* a = reinterpret_cast<const char*>(aLChar);
ALWAYS_INLINE bool equal(const LChar* aLChar, const LChar* bLChar, unsigned length)
{
const char* a = reinterpret_cast<const char*>(aLChar);
-#elif PLATFORM(IOS) && WTF_ARM_ARCH_AT_LEAST(7)
+#elif PLATFORM(IOS) && WTF_ARM_ARCH_AT_LEAST(7) && !ASAN_ENABLED
ALWAYS_INLINE bool equal(const LChar* a, const LChar* b, unsigned length)
{
bool isEqual = false;
ALWAYS_INLINE bool equal(const LChar* a, const LChar* b, unsigned length)
{
bool isEqual = false;
ALWAYS_INLINE bool equal(const LChar* a, const LChar* b, unsigned length) { return !memcmp(a, b, length); }
ALWAYS_INLINE bool equal(const UChar* a, const UChar* b, unsigned length) { return !memcmp(a, b, length * sizeof(UChar)); }
ALWAYS_INLINE bool equal(const LChar* a, const LChar* b, unsigned length) { return !memcmp(a, b, length); }
ALWAYS_INLINE bool equal(const UChar* a, const UChar* b, unsigned length) { return !memcmp(a, b, length * sizeof(UChar)); }
+#else
+ALWAYS_INLINE bool equal(const LChar* a, const LChar* b, unsigned length)
+{
+ for (unsigned i = 0; i < length; ++i) {
+ if (a[i] != b[i])
+ return false;
+ }
+ return true;
+}
+ALWAYS_INLINE bool equal(const UChar* a, const UChar* b, unsigned length)
+{
+ for (unsigned i = 0; i < length; ++i) {
+ if (a[i] != b[i])
+ return false;
+ }
+ return true;
+}
#endif
ALWAYS_INLINE bool equal(const LChar* a, const UChar* b, unsigned length)
#endif
ALWAYS_INLINE bool equal(const LChar* a, const UChar* b, unsigned length)