re-apply "Improve nsHtml5AtomTable performance (#693)" (#695)"

This reverts commit ca87455cc5880897c8b921077819988feede90bd.
This commit is contained in:
wolfbeast 2018-08-04 13:40:36 +02:00 committed by Roy Tam
commit 860f212b0b
2 changed files with 20 additions and 0 deletions

View file

@ -11,6 +11,8 @@
#include "nsIAtom.h"
#include "nsIThread.h"
#define RECENTLY_USED_PARSER_ATOMS_SIZE 31
class nsHtml5Atom;
class nsHtml5AtomEntry : public nsStringHashKey
@ -87,6 +89,9 @@ class nsHtml5AtomTable
*/
void Clear()
{
for (uint32_t i = 0; i < RECENTLY_USED_PARSER_ATOMS_SIZE; ++i) {
mRecentlyUsedParserAtoms[i] = nullptr;
}
mTable.Clear();
}
@ -99,6 +104,7 @@ class nsHtml5AtomTable
private:
nsTHashtable<nsHtml5AtomEntry> mTable;
nsIAtom* mRecentlyUsedParserAtoms[RECENTLY_USED_PARSER_ATOMS_SIZE];
#ifdef DEBUG
nsCOMPtr<nsIThread> mPermittedLookupThread;
#endif