gecko-dev/xpcom/ds
Nicholas Nethercote 9ea93c4f7b Bug 1449395 - Remove nsStaticAtomSetup. r=froydnj
Each nsStaticAtomSetup contains a pointer to a static atom, and also a pointer
to the canonical pointer to that static atom. Which is pretty weird! The
notable thing thing about it is that these structs are in an array, and that
gives us the only way to iterate over all static atoms in a single class, for
registration and lookups.

But thanks to various other recent changes to the implementation of static
atoms, we can now put the static atoms themselves into an array, which can be
iterated over. So this patch does that. With that done, nsStaticAtomSetup is no
longer necessary.

According to the `size` utility, on Linux64 this reduces the size of libxul.so
by the following amounts:

> text:  62008 bytes
> data:  20992 bytes
> bss:   21040 bytes
> total: 104040 bytes

- The bss reduction is one word per atom, because the canonical static atom
  pointers (e.g. nsGkAtoms::foo) have moved from .bss to .data, because they're
  now initialized at compile time instead of runtime.

- The data reduction is one word per atom, because we remove two words per atom
  for the nsStaticAtomSetup removal, but gain one word per atom from the
  previous bullet point.

- I'm not sure about the text reduction. It's three words per atom. Maybe
  because there is one less relocation per atom?

Other notable things in the patch:

- nsICSSAnonBoxPseudo and nsICSSPseudoElement now inherit from nsStaticAtom,
  not nsAtom, because that's more precise.

- Each static atoms array now has an enum associated with it, which is used in
  various ways.

- In the big comment about the macros at the top of nsStaticAtom.h, the pre-
  and post-expansion forms are now shown interleaved. The interleaving reduces
  duplication and makes the comment much easier to read and maintain. The
  comment also has an introduction that explains the constraints and goals of
  the implementation.

- The SUBCLASS macro variations are gone. There are few enough users of these
  macros now that always passing the atom type has become simpler.

MozReview-Commit-ID: 1GmfKidLjaU

--HG--
extra : rebase_source : 2352590101fc6693ba388f885ca4714a42963943
2018-03-29 11:48:18 +11:00
..
ArenaAllocator.h Bug 1421345 - Check the canary during allocations. r=jet 2018-01-17 12:07:34 +13:00
ArenaAllocatorExtensions.h Bug 1412416 - Part 2: Simplify ArenaStrdup for xpcom strings. r=froydnj 2017-10-27 13:26:47 -07:00
ArrayIterator.h Bug 1342303 part 1 - Make nsTArrayIterator an independent class. r=erahm 2017-02-24 16:14:06 +11:00
AtomArray.h Bug 1407843 part 1 - Introduce a global-level AtomArray type alias. r=froydnj 2017-10-13 11:59:23 +11:00
Dafsa.cpp Bug 1380154 - Part 1: Add the Chromium DAFSA generator. r=njn 2017-07-17 16:09:42 -07:00
Dafsa.h Bug 1380154 - Part 2: Generate a DAFSA and use it for eTLDs. r=jduell 2017-07-17 16:10:18 -07:00
IncrementalTokenizer.cpp Bug 1339537 - Part 6: Pass std::function values tree by const reference instead of by value, r=ehsan 2017-04-27 12:44:57 -04:00
IncrementalTokenizer.h Bug 1339537 - Part 6: Pass std::function values tree by const reference instead of by value, r=ehsan 2017-04-27 12:44:57 -04:00
make_dafsa.py Bug 1382001 - Part 1: Handle gperf-like preamble in make_dafsa. r=froydnj 2017-08-11 14:12:03 -07:00
moz.build Bug 1411469 - Statically allocate static atoms. r=froydnj 2018-03-26 11:18:31 +02:00
nsArray.cpp Bug 1417279 - Remove an odd second case from nsArray::IndexOf. r=froydnj 2017-11-14 16:34:42 -08:00
nsArray.h Bug 1311191 - Part 1: Add nsISupportsArray-like iteration to nsArray. r=froydnj 2016-10-24 13:24:26 -07:00
nsArrayEnumerator.cpp Bug 1432323 - Refactor operator new in nsArrayEnumerator. r=froydnj 2018-02-22 12:38:15 -08:00
nsArrayEnumerator.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsArrayUtils.cpp Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsArrayUtils.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsAtom.h Bug 1411469 - Statically allocate static atoms. r=froydnj 2018-03-26 11:18:31 +02:00
nsAtomTable.cpp Bug 1449395 - Remove nsStaticAtomSetup. r=froydnj 2018-03-29 11:48:18 +11:00
nsAtomTable.h Bug 1411469 - Statically allocate static atoms. r=froydnj 2018-03-26 11:18:31 +02:00
nsBaseHashtable.h Bug 1441726 - Include CacheStorageService::mPurgeTimeStamps hashtable in the memory reporter. r=michal 2018-03-27 10:21:00 +03:00
nsCharSeparatedTokenizer.h Bug 1374580 (part 3) - Remove ns{,C}Substring typedefs. r=froydnj. 2017-06-20 19:19:52 +10:00
nsCheapSets.h Bug 1268772 (part 1) - Remove nsCheapSet::Put()'s return value. r=erahm. 2016-04-28 15:59:58 +10:00
nsClassHashtable.h Bug 888600 - Move ContentFrameMessageManager to WebIDL. Part 4: Convert MessageManager to WebIDL. r=bz. 2017-06-20 11:09:50 +02:00
nsCOMArray.cpp Bug 1407838 - Remove the remains of NS_Alloc/NS_Realloc/NS_Free. r=njn 2017-10-12 11:08:44 +09:00
nsCOMArray.h Bug 1342303 part 6 - Remove nsCOMArray::Enumerate{Forwards,Backwards}. r=erahm 2017-02-24 21:37:07 +11:00
nsCRT.cpp Bug 1427023 - Remove nsCRT::strncmp. r=erahm 2018-01-09 23:49:37 +09:00
nsCRT.h Bug 1427023 - Remove nsCRT::strncmp. r=erahm 2018-01-09 23:49:37 +09:00
nsDataHashtable.h Bug 1404897: Some fixes to allow storing non-copyable types in nsDataHashtable. r=froydnj 2017-10-02 15:24:59 +02:00
nsDeque.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
nsDeque.h Bug 1398999 - nsDequeFunctor::operator() doesn't need to return anything - r=froydnj 2017-02-09 14:06:36 +11:00
nsEnumeratorUtils.cpp Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsEnumeratorUtils.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsExpirationTracker.h Bug 1436263 - Part 1: Replace final override virtual function specifiers with just final. r=froydnj 2018-02-05 22:46:57 -08:00
nsGkAtomList.h Bug 1335191 - Remove support for the attributes "activetitlebarcolor" and "inactivetitlebarcolor" for XUL window elements. r=emilio 2018-03-24 01:14:23 -04:00
nsGkAtoms.cpp Bug 1449395 - Remove nsStaticAtomSetup. r=froydnj 2018-03-29 11:48:18 +11:00
nsGkAtoms.h Bug 1449395 - Remove nsStaticAtomSetup. r=froydnj 2018-03-29 11:48:18 +11:00
nsHashKeys.h Bug 1423773 - Part 1: Remove usage of nsStringGlue.h. r=glandium 2017-12-06 16:52:51 -08:00
nsHashPropertyBag.cpp Bug 1428535 - Add missing override specifiers to overridden virtual functions. r=froydnj 2017-11-05 19:37:28 -08:00
nsHashPropertyBag.h Bug 1353660 - proxy destruction of nsHashPropertyBag's hash table to the main thread; r=mccr8 2017-04-05 15:31:20 -04:00
nsIArray.idl
nsIArrayExtensions.idl Bug 1311191 - Part 1: Add nsISupportsArray-like iteration to nsArray. r=froydnj 2016-10-24 13:24:26 -07:00
nsIHashable.idl
nsIINIParser.idl
nsIMutableArray.idl Bug 1313150 - Remove |weak| parameter from nsIMutableArray methods. r=froydnj 2017-10-21 23:53:02 +09:00
nsINIParserImpl.cpp
nsINIParserImpl.h
nsINIProcessor.js Bug 1432992, part 1 - Remove definitions of Ci, Cr, Cc, and Cu. r=florian 2018-02-06 09:36:57 -08:00
nsINIProcessor.manifest
nsInterfaceHashtable.h Bug 1326028 - Allow moving a reference into nsInterfaceHashtable. r=smaug 2018-02-22 14:09:26 -08:00
nsIObserver.idl
nsIObserverService.idl Bug 1355216 - Mark last parameters that are almost always falsy as optional, r=froydnj. 2017-04-12 00:07:30 +02:00
nsIPersistentProperties2.idl
nsIPersistentProperties.h
nsIProperties.idl
nsIProperty.idl
nsIPropertyBag2.idl
nsIPropertyBag.idl
nsISerializable.idl Bug 1440808 - Cleanup error handling in nsXULPrototypeDocument::Read. r=mccr8 2018-02-22 11:33:20 -08:00
nsISimpleEnumerator.idl
nsIStringEnumerator.idl
nsISupportsIterators.idl
nsISupportsPrimitives.idl Bug 1329718 - remove nsISupportsVoid and associated machinery; r=erahm 2017-01-10 16:31:48 -05:00
nsIVariant.idl
nsIWindowsRegKey.idl
nsIWritablePropertyBag2.idl
nsIWritablePropertyBag.idl
nsJSThingHashtable.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsMathUtils.h Bug 1354510 - Firefox build should recognize Solaris. r=glandium 2017-04-11 00:01:32 -07:00
nsObserverList.cpp Backed out changeset 491237dbcb5d (bug 1323207) 2016-12-16 20:06:43 +01:00
nsObserverList.h Bug 1268772 (part 5) - Use MOZ_MUST_USE in other parts of xpcom/ds/. r=erahm. 2016-04-28 17:11:17 +10:00
nsObserverService.cpp Bug 1443079 - nsScriptError.isFromPrivateWindow must match the correct value also in e10s mode, r=smaug 2018-03-13 06:40:38 +01:00
nsObserverService.h Bug 1268772 (part 5) - Use MOZ_MUST_USE in other parts of xpcom/ds/. r=erahm. 2016-04-28 17:11:17 +10:00
nsPersistentProperties.cpp Bug 1374580 (part 2) - Remove nsAFlat{,C}String typedefs. r=froydnj. 2017-06-20 19:19:05 +10:00
nsPersistentProperties.h Bug 1351732 - Part 2: Replace use of PLArena with ArenaAllocator in xpcom. r=froydnj 2017-03-30 16:46:58 -07:00
nsPointerHashKeys.h Bug 1379282 - Improve XPCOM's pointer hashing functions for pointers to neighboring memory locations; r=erahm 2017-07-19 14:16:35 -04:00
nsProperties.cpp Bug 1376498 part 2 - Use plain Remove(key) in some places instead of Lookup(key).Remove() for simplicity. r=froydnj 2017-07-05 02:01:44 +02:00
nsProperties.h
nsQuickSort.cpp Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsQuickSort.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsRefPtrHashtable.h Bug 1400459 (part 2) - Devirtualize nsIAtom. r=heycam. 2017-09-26 08:33:21 +10:00
nsStaticAtom.h Bug 1449395 - Remove nsStaticAtomSetup. r=froydnj 2018-03-29 11:48:18 +11:00
nsStaticNameTable.cpp Bug 1374580 (part 2) - Remove nsAFlat{,C}String typedefs. r=froydnj. 2017-06-20 19:19:05 +10:00
nsStaticNameTable.h Bug 1374580 (part 2) - Remove nsAFlat{,C}String typedefs. r=froydnj. 2017-06-20 19:19:05 +10:00
nsStringEnumerator.cpp Bug 1262399 - remove Impl suffixes from nsSupports* implementations; r=mccr8 2016-05-03 15:25:41 -05:00
nsStringEnumerator.h Bug 1268772 (part 5) - Use MOZ_MUST_USE in other parts of xpcom/ds/. r=erahm. 2016-04-28 17:11:17 +10:00
nsSupportsPrimitives.cpp Bug 1409227 (part 4) - Replace nsMemory::Clone(id, sizeof(nsID)) with nsID::Clone(id). r=mccr8. 2017-10-18 10:39:20 +11:00
nsSupportsPrimitives.h Bug 1329718 - remove nsISupportsVoid and associated machinery; r=erahm 2017-01-10 16:31:48 -05:00
nsTArray-inl.h Bug 1431122 - Part 1: Add UnorderedRemoveElement[s]At to nsTArray, r=froydnj 2018-01-23 17:27:35 -05:00
nsTArray.cpp Bug 1338574 - Part 7: Use MOZ_CRASH_UNSAFE_PRINTF in XPCOM. r=froydnj 2017-02-21 18:02:03 +01:00
nsTArray.h Bug 1444200: Explicitly call the parent class default constructor from AutoTArray's copy constructor. r=froydnj 2018-03-09 05:27:14 +01:00
nsTArrayForwardDeclare.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsTHashtable.h Bug 1435702 - specialize copying nsTHashtable elements where possible; r=mystor 2018-02-05 16:18:12 -05:00
nsTObserverArray.cpp Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsTObserverArray.h Bug 1385533 - Reserve space for one pointer in the mMutationObservers array on node slots; r=smaug 2017-07-31 17:12:38 -04:00
nsTPriorityQueue.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
nsVariant.cpp Bug 1409227 (part 4) - Replace nsMemory::Clone(id, sizeof(nsID)) with nsID::Clone(id). r=mccr8. 2017-10-18 10:39:20 +11:00
nsVariant.h Bug 1268772 (part 2) - Make infallible nsVariant methods return |void| instead of |nsresult|. r=erahm. 2016-04-29 13:47:44 +10:00
nsWhitespaceTokenizer.h Bug 1374580 (part 3) - Remove ns{,C}Substring typedefs. r=froydnj. 2017-06-20 19:19:52 +10:00
nsWindowsRegKey.cpp Bug 1353593 - Part 2: Remove wwc functions. r=froydnj 2017-06-12 16:20:49 -07:00
nsWindowsRegKey.h Bug 1268772 (part 3) - Remove NS_NewWindowsRegKey()'s return value. r=erahm. 2016-05-02 09:06:45 +10:00
Observer.h Bug 1332631 part C - file moves from xpcom/glue to xpcom/ds, r=froydnj 2017-01-20 13:59:21 -05:00
PLDHashTable.cpp Bug 1400193 (part 2) - Shrink PLDHashTable. r=froydnj. 2017-09-15 20:04:29 +10:00
PLDHashTable.h Bug 1400193 (part 2) - Shrink PLDHashTable. r=froydnj. 2017-09-15 20:04:29 +10:00
StickyTimeDuration.h
Tokenizer.cpp Bug 1378712 - Remove all trailing whitespaces r=Ehsan 2017-07-06 14:00:35 +02:00
Tokenizer.h Bug 1295941 - Let mozilla::Tokenizer read signed integers from the input, r=erahm 2018-01-17 06:23:00 +02:00