gecko-dev/parser/html
Nicholas Nethercote bac452f9ad Bug 1411469 - Statically allocate static atoms. r=froydnj
Currently static atoms are stored on the heap, but their char buffers are
stored in read-only static memory.

This patch changes the representation of nsStaticAtom (thus making it a
non-trivial subclass of nsAtom). Instead of a pointer to the string, it now has
an mStringOffset field which is a 32-bit offset to the string. (This requires
placement of the string and the atom within the same object so that the offset
is known to be small. The docs and macros in nsStaticAtom.h handle that.)

Static and dynamic atoms now store their chars in different ways: nsStaticAtom
stores them inline, nsDynamicAtom has a pointer to separate storage. So
`mString` and GetStringBuffer() move from nsAtom to nsDynamicAtom.

The change to static atoms means they can be made constexpr and stored in
read-only memory instead of on the heap. On 64-bit this reduces the per-process
overhead by 16 bytes; on 32-bit the saving is 12 bytes. (Further reductions
will be possible in follow-up patches.)

The increased use of constexpr required multiple workarounds for MSVC.
- Multiple uses of MOZ_{PUSH,POP}_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING to
  disable warnings about (well-defined!) overflow of unsigned integer
  arithmetic.
- The use of -Zc:externConstexpr on all files defining static atoms, to make
  MSVC follow the C++ standard(!) and let constexpr variables have external
  linkage.
- The use of -constexpr:steps300000 to increase the number of operations
  allowed in a constexpr value, in order to handle gGkAtoms, which requires
  hashing ~2,500 atom strings.

The patch also changes how HTML5 atoms are handled. They are now treated as
dynamic atoms, i.e. we have "dynamic normal" atoms and "dynamic HTML5 atoms",
and "dynamic atoms" covers both cases, and both are represented via
nsDynamicAtom. The main difference between the two kinds is that dynamic HTML5
atoms still aren't allowed to be used in various operations, most notably
AddRef()/Release(). All this also required moving nsDynamicAtom into the header
file.

There is a slight performance cost to all these changes: now that nsStaticAtom
and nsDynamicAtom store their chars in different ways, a conditional branch is
required in the following functions: Equals(), GetUTF16String(),
WeakAtom::as_slice().

Finally, in about:memory the "explicit/atoms/static/atom-objects" value is no
longer needed, because that memory is static instead of heap-allocated.

MozReview-Commit-ID: 4AxPv05ngZy
2018-03-26 11:18:31 +02:00
..
java Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
javasrc Bug 1445983. <bdi> should be an HTMLElement, not HTMLUnknownElement. r=hsivonen 2018-03-16 11:26:09 -04:00
jArray.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
moz.build Bug 1424548 - Part 11: Regenerate HTML parser code with MOZ_FALLTHROUGH annotations. r=hsivonen 2017-12-01 01:05:26 -08:00
nsAHtml5TreeBuilderState.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsAHtml5TreeOpSink.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5ArrayCopy.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5AtomTable.cpp Bug 1411469 - Statically allocate static atoms. r=froydnj 2018-03-26 11:18:31 +02:00
nsHtml5AtomTable.h Bug 1411469 - Statically allocate static atoms. r=froydnj 2018-03-26 11:18:31 +02:00
nsHtml5AttributeEntry.h Bug 1444031 - Rename Is{Static,Dynamic,HTML5}Atom. r=froydnj 2018-03-07 15:17:34 +11:00
nsHtml5AttributeName.cpp Bug 1382020 - Don't preload nomodule scripts when modules are enabled r=hsivonen 2018-01-23 13:07:37 +00:00
nsHtml5AttributeName.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5AutoPauseUpdate.h Bug 1410848 - Use RAII with nsHtml5TreeOpExecutor::mFlushState. r=smaug. 2017-11-01 13:16:23 +02:00
nsHtml5ByteReadable.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5ContentCreatorFunction.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5DependentUTF16Buffer.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5DependentUTF16Buffer.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5DocumentBuilder.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5DocumentBuilder.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5DocumentMode.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5ElementName.cpp Bug 1445983. <bdi> should be an HTMLElement, not HTMLUnknownElement. r=hsivonen 2018-03-16 11:26:09 -04:00
nsHtml5ElementName.h Bug 1445983. <bdi> should be an HTMLElement, not HTMLUnknownElement. r=hsivonen 2018-03-16 11:26:09 -04:00
nsHtml5Highlighter.cpp Bug 1445302 - Replace TArray.RemoveElementAt(TArray.Length() - 1) pattern with TArray.RemoveLastElement() or TArray.PopLastElement() r=froydnj 2018-03-13 14:51:33 +01:00
nsHtml5Highlighter.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5HtmlAttributes.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5HtmlAttributes.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5Macros.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5MetaScanner.cpp Bug 1424548 - Part 11: Regenerate HTML parser code with MOZ_FALLTHROUGH annotations. r=hsivonen 2017-12-01 01:05:26 -08:00
nsHtml5MetaScanner.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5MetaScannerCppSupplement.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5MetaScannerHSupplement.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5Module.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5Module.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5NamedCharacters.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5NamedCharacters.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5NamedCharactersAccel.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5NamedCharactersAccel.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5NamedCharactersInclude.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5OplessBuilder.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5OplessBuilder.h Bug 1232696 - Remove NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW as it causes segfaulting for GCC 6 builds (4 of 5, fixes for parser/). r=hsivonen. 2017-01-24 17:11:43 +01:00
nsHtml5OwningUTF16Buffer.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5OwningUTF16Buffer.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5Parser.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5Parser.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5PlainTextUtils.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5PlainTextUtils.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5Portability.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5Portability.h Bug 1424548 - Part 9a: clang-format generated HTML parser code. r=hsivonen 2017-12-21 00:02:43 -08:00
nsHtml5SVGLoadDispatcher.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5SVGLoadDispatcher.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5Speculation.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5Speculation.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5SpeculativeLoad.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5SpeculativeLoad.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5StackNode.cpp Bug 1424548 - Part 9a: clang-format generated HTML parser code. r=hsivonen 2017-12-21 00:02:43 -08:00
nsHtml5StackNode.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5StateSnapshot.cpp Bug 1424548 - Part 9a: clang-format generated HTML parser code. r=hsivonen 2017-12-21 00:02:43 -08:00
nsHtml5StateSnapshot.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5StreamListener.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5StreamListener.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5StreamParser.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5StreamParser.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5StreamParserPtr.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5String.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5String.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5StringParser.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5StringParser.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5Tokenizer.cpp Bug 1424548 - Part 11: Regenerate HTML parser code with MOZ_FALLTHROUGH annotations. r=hsivonen 2017-12-01 01:05:26 -08:00
nsHtml5Tokenizer.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5TokenizerCppSupplement.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5TokenizerHSupplement.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5TokenizerLoopPolicies.h
nsHtml5TreeBuilder.cpp Bug 1445983. <bdi> should be an HTMLElement, not HTMLUnknownElement. r=hsivonen 2018-03-16 11:26:09 -04:00
nsHtml5TreeBuilder.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5TreeBuilderCppSupplement.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5TreeBuilderHSupplement.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5TreeOpExecutor.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5TreeOpExecutor.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5TreeOpStage.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5TreeOpStage.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5TreeOperation.cpp Bug 1447098 part 1. Rename FromContent on various DOM classes to FromNode. r=mystor 2018-03-21 17:39:04 -04:00
nsHtml5TreeOperation.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5UTF16Buffer.cpp Bug 1445983. <bdi> should be an HTMLElement, not HTMLUnknownElement. r=hsivonen 2018-03-16 11:26:09 -04:00
nsHtml5UTF16Buffer.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5UTF16BufferCppSupplement.h
nsHtml5UTF16BufferHSupplement.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5ViewSourceUtils.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsHtml5ViewSourceUtils.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsIContentHandle.h
nsIParserUtils.idl Bug 1437147 - report warnings when the sanitizer removes stuff for chrome documents, r=bz 2018-02-15 16:03:19 +00:00
nsIScriptableUnescapeHTML.idl
nsParserUtils.cpp Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00
nsParserUtils.h Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn 2018-03-16 11:26:06 -04:00