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
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
Dafsa.h
IncrementalTokenizer.cpp
IncrementalTokenizer.h
Observer.h
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
Tokenizer.h Bug 1295941 - Let mozilla::Tokenizer read signed integers from the input, r=erahm 2018-01-17 06:23:00 +02:00
make_dafsa.py
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
nsArrayEnumerator.cpp Bug 1432323 - Refactor operator new in nsArrayEnumerator. r=froydnj 2018-02-22 12:38:15 -08:00
nsArrayEnumerator.h
nsArrayUtils.cpp
nsArrayUtils.h
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
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
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
nsCharSeparatedTokenizer.h
nsCheapSets.h
nsClassHashtable.h Bug 888600 - Move ContentFrameMessageManager to WebIDL. Part 4: Convert MessageManager to WebIDL. r=bz. 2017-06-20 11:09:50 +02: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
nsDeque.h
nsEnumeratorUtils.cpp
nsEnumeratorUtils.h
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
nsIArray.idl
nsIArrayExtensions.idl
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
nsIObserver.idl
nsIObserverService.idl
nsIPersistentProperties.h
nsIPersistentProperties2.idl
nsIProperties.idl
nsIProperty.idl
nsIPropertyBag.idl
nsIPropertyBag2.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
nsIVariant.idl
nsIWindowsRegKey.idl
nsIWritablePropertyBag.idl
nsIWritablePropertyBag2.idl
nsInterfaceHashtable.h Bug 1326028 - Allow moving a reference into nsInterfaceHashtable. r=smaug 2018-02-22 14:09:26 -08:00
nsJSThingHashtable.h
nsMathUtils.h
nsObserverList.cpp
nsObserverList.h
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
nsPersistentProperties.cpp
nsPersistentProperties.h
nsPointerHashKeys.h
nsProperties.cpp
nsProperties.h
nsQuickSort.cpp
nsQuickSort.h
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
nsStaticNameTable.h
nsStringEnumerator.cpp
nsStringEnumerator.h
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
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
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
nsTHashtable.h Bug 1435702 - specialize copying nsTHashtable elements where possible; r=mystor 2018-02-05 16:18:12 -05:00
nsTObserverArray.cpp
nsTObserverArray.h
nsTPriorityQueue.h
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
nsWhitespaceTokenizer.h
nsWindowsRegKey.cpp
nsWindowsRegKey.h