зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1352734, use memcmp for nsIAtom Equals to improve performance, r=hsivonen
--HG-- extra : rebase_source : 1a78863c52f088609a6edcb6b32bf16bc02a4118
This commit is contained in:
Родитель
6a150bced4
Коммит
ac0ae74439
|
@ -91,7 +91,7 @@ nsHtml5Portability::releaseString(nsString* str)
|
|||
bool
|
||||
nsHtml5Portability::localEqualsBuffer(nsIAtom* local, char16_t* buf, int32_t offset, int32_t length)
|
||||
{
|
||||
return local->Equals(nsDependentSubstring(buf + offset, buf + offset + length));
|
||||
return local->Equals(buf + offset, length);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -325,13 +325,7 @@ AtomTableMatchKey(const PLDHashEntryHdr* aEntry, const void* aKey)
|
|||
nsDependentAtomString(he->mAtom)) == 0;
|
||||
}
|
||||
|
||||
uint32_t length = he->mAtom->GetLength();
|
||||
if (length != k->mLength) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return memcmp(he->mAtom->GetUTF16String(),
|
||||
k->mUTF16String, length * sizeof(char16_t)) == 0;
|
||||
return he->mAtom->Equals(k->mUTF16String, k->mLength);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -37,9 +37,15 @@ interface nsIAtom : nsISupports
|
|||
size_t SizeOfIncludingThis(in MallocSizeOf aMallocSizeOf);
|
||||
|
||||
%{C++
|
||||
// note this is NOT virtual so this won't muck with the vtable!
|
||||
// note these are NOT virtual so they won't muck with the vtable!
|
||||
inline bool Equals(char16ptr_t aString, uint32_t aLength) const
|
||||
{
|
||||
return mLength == aLength &&
|
||||
memcmp(mString, aString, mLength * sizeof(char16_t)) == 0;
|
||||
}
|
||||
|
||||
inline bool Equals(const nsAString& aString) const {
|
||||
return aString.Equals(nsDependentString(mString, mLength));
|
||||
return Equals(aString.BeginReading(), aString.Length());
|
||||
}
|
||||
|
||||
inline bool IsStaticAtom() const {
|
||||
|
|
Загрузка…
Ссылка в новой задаче