Граф коммитов

256 Коммитов

Автор SHA1 Сообщение Дата
Simon Giesecke cd8b8939b9 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Andrew McCreight 4babb2b5ab Bug 1609815 - Remove Web Replay C++ implementation. r=jgilbert,jandem,gbrown
Patch by bhackett and jlaster. Also reviewed by mccr8.

Differential Revision: https://phabricator.services.mozilla.com/D60197

--HG--
extra : moz-landing-system : lando
2020-02-27 17:39:15 +00:00
Ciure Andrei 00dd87f6f4 Backed out changeset d407a28318e6 (bug 1609815) for causing windows ming bustages CLOSED TREE
--HG--
extra : histedit_source : b2c748e31e0f6ba8fcf9960a336e0bbd361b07e6
2020-02-27 07:05:19 +02:00
Andrew McCreight b197e1f783 Bug 1609815 - Remove Web Replay C++ implementation. r=jgilbert,jandem,gbrown
Patch by bhackett and jlaster. Also reviewed by mccr8.

Differential Revision: https://phabricator.services.mozilla.com/D60197

--HG--
extra : moz-landing-system : lando
2020-02-27 04:43:48 +00:00
Simon Giesecke b50347f917 Bug 1611415 - Prefer using std::move over forget. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-13 14:38:48 +00:00
shindli 91aa0518dd Backed out changeset 0c982bc69cb3 (bug 1611415) for causing build bustages in /builds/worker/workspace/build/src/obj-firefox/dist/include/nsCOMPtr CLOSED TREE 2020-02-12 20:13:29 +02:00
Simon Giesecke f604a47fa5 Bug 1611415 - Applied FixItHints from mozilla-non-std-move. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980

--HG--
extra : moz-landing-system : lando
2020-02-12 17:24:41 +00:00
Eric Rahm 6d75492859 Bug 1241518 - Part 1: Remove unused nsAutoPtr.h includes in xpcom/ r=kmag
This removes various unused `#include "nsAutoPtr.h"` in `xpcom/`. Additionally
adds a few includes to the media stack.

Differential Revision: https://phabricator.services.mozilla.com/D58282

--HG--
extra : moz-landing-system : lando
2020-01-07 00:06:01 +00:00
Jeff Walden 7b8ce42e6e Bug 1453456 - Remove nsCRT::IsAscii(null-terminated string) in favor of mozilla::IsAsciiNullTerminated. r=froydnj 2019-02-25 12:22:24 -08:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Emilio Cobos Álvarez b65d0757d1 Bug 1509720 - Inline atom refcounting. r=njn
We're paying two function calls from Gecko_AddRefAtom /
Gecko_ReleaseAtom for no good reason, plus it's simple enough it's probably
worth to inline it anyway for C++ callers.

Differential Revision: https://phabricator.services.mozilla.com/D12860

--HG--
extra : moz-landing-system : lando
2018-11-28 15:03:40 +00:00
Emilio Cobos Álvarez 6ca25ecbe6 Bug 1499170 - Add an atom bit to know whether we're ascii lowercase. r=njn
And thus massively speed up ascii-case-insensitive atom comparisons when both
atoms are lowercase (which is the common case by far).

This removes almost all the slow selector-matching in this page, and it seems
an easier fix than storing the lowercased version of all class-names in quirks
mode in elements and selectors...

Differential Revision: https://phabricator.services.mozilla.com/D10945

--HG--
extra : moz-landing-system : lando
2018-11-13 12:47:40 +00:00
Emilio Cobos Álvarez 03ce7b0699 Bug 1392185 - Remove dynamic HTML5 atoms. r=njn,hsivonen
This is a rebase + manual refcounting on some places, + cleanup of the original
patch in the bug.

Co-authored-by: Nicholas Nethercote <nnethercote@mozilla.com>

Differential Revision: https://phabricator.services.mozilla.com/D11035
2018-11-09 14:45:30 +01:00
Nicholas Nethercote e35d805828 Bug 1494515 - Clean up static atom registration. r=froydnj
Static atom registration is a bit of a mess. NS_InitAtomTable() calls
nsGkAtoms::RegisterStaticAtoms(), which calls NS_RegisterStaticAtoms(); i.e. we
go from nsAtomTable.cpp to nsGkAtoms.cpp and back.

(And NS_RegisterStaticAtoms() is declared in a .cpp file, not a .h file!)

This commit makes NS_InitAtomTable() a friend of nsGkAtoms, so NS_InitAtomTable
can see nsGkAtoms's atoms array directly, thus removing the need for
NS_RegisterAtomTable() and nsGkAtoms::RegisterStaticAtoms().

This commit also removes an out-of-date part of a comment from XPCOMInit.cpp.

--HG--
extra : rebase_source : 7e1f9aa0a9f7cb5088159fe4c953948b931f6d68
2018-09-27 16:13:41 +10:00
Eric Rahm 9f6d588b5d Bug 1491151 - Part 4: Convert atom table to use MRU cache. r=smaug
--HG--
extra : rebase_source : 7adb5dd49cf55543324c313229c406dba8a8535a
2018-09-12 17:51:53 -07:00
Cameron McCormack be0a66bcfb Bug 1483121 - Generate static atom hash in StaticAtoms.py. r=njn,emilio
Summary: Depends On D3286

Reviewers: njn!, emilio!

Tags: #secure-revision

Bug #: 1483121

Differential Revision: https://phabricator.services.mozilla.com/D3295
2018-08-15 15:52:42 +10:00
Cameron McCormack 426af33a36 Bug 1482782 - Part 7: Expand out nsStaticAtom.h macros now that we only static atom table. r=njn
Summary: Depends On D3285

Reviewers: njn!

Tags: #secure-revision

Bug #: 1482782

Differential Revision: https://phabricator.services.mozilla.com/D3286
2018-08-15 15:46:42 +10:00
Cameron McCormack b17e6b4468 Bug 1482782 - Part 6: Remove support for multiple static atom sources. r=njn,emilio
Summary: Depends On D3284

Reviewers: njn!, emilio!

Tags: #secure-revision

Bug #: 1482782

Differential Revision: https://phabricator.services.mozilla.com/D3285
2018-08-15 15:46:42 +10:00
Narcis Beleuzu d20e8e7674 Backed out 8 changesets (bug 1483121, bug 1482782) for build bustages on nsDirectoryService.cpp. CLOSED TREE
Backed out changeset 0a8334bbcf45 (bug 1483121)
Backed out changeset cb2dcb859071 (bug 1482782)
Backed out changeset c834d4ca2eef (bug 1482782)
Backed out changeset 887de0efbb67 (bug 1482782)
Backed out changeset 018fdb50a6be (bug 1482782)
Backed out changeset 33a8aa8096c9 (bug 1482782)
Backed out changeset e3632354f16e (bug 1482782)
Backed out changeset 46f8319bee82 (bug 1482782)
2018-08-15 09:14:41 +03:00
Cameron McCormack 0b89d2391b Bug 1483121 - Generate static atom hash in StaticAtoms.py. r=njn,emilio
Summary: Depends On D3286

Reviewers: njn!, emilio!

Tags: #secure-revision

Bug #: 1483121

Differential Revision: https://phabricator.services.mozilla.com/D3295
2018-08-15 15:52:42 +10:00
Cameron McCormack ec18757d45 Bug 1482782 - Part 7: Expand out nsStaticAtom.h macros now that we only static atom table. r=njn
Summary: Depends On D3285

Reviewers: njn!

Tags: #secure-revision

Bug #: 1482782

Differential Revision: https://phabricator.services.mozilla.com/D3286
2018-08-15 15:46:42 +10:00
Cameron McCormack e816227f97 Bug 1482782 - Part 6: Remove support for multiple static atom sources. r=njn,emilio
Summary: Depends On D3284

Reviewers: njn!, emilio!

Tags: #secure-revision

Bug #: 1482782

Differential Revision: https://phabricator.services.mozilla.com/D3285
2018-08-15 15:46:42 +10:00
Henri Sivonen 3edc601325 Bug 1402247 - Use encoding_rs for XPCOM string encoding conversions. r=Nika,erahm,froydnj.
Correctness improvements:

 * UTF errors are handled safely per spec instead of dangerously truncating
   strings.

 * There are fewer converter implementations.

Performance improvements:

 * The old code did exact buffer length math, which meant doing UTF math twice
   on each input string (once for length calculation and another time for
   conversion). Exact length math is more complicated when handling errors
   properly, which the old code didn't do. The new code does UTF math on the
   string content only once (when converting) but risks allocating more than
   once. There are heuristics in place to lower the probability of
   reallocation in cases where the double math avoidance isn't enough of a
   saving to absorb an allocation and memcpy.

 * Previously, in UTF-16 <-> UTF-8 conversions, an ASCII prefix was optimized
   but a single non-ASCII code point pessimized the rest of the string. The
   new code tries to get back on the fast ASCII path.

 * UTF-16 to Latin1 conversion guarantees less about handling of out-of-range
   input to eliminate an operation from the inner loop on x86/x86_64.

 * When assigning to a pre-existing string, the new code tries to reuse the
   old buffer instead of first releasing the old buffer and then allocating a
   new one.

 * When reallocating from the new code, the memcpy covers only the data that
   is part of the logical length of the old string instead of memcpying the
   whole capacity. (For old callers old excess memcpy behavior is preserved
   due to bogus callers. See bug 1472113.)

 * UTF-8 strings in XPConnect that are in the Latin1 range are passed to
   SpiderMonkey as Latin1.

New features:

 * Conversion between UTF-8 and Latin1 is added in order to enable faster
   future interop between Rust code (or otherwise UTF-8-using code) and text
   node and SpiderMonkey code that uses Latin1.

MozReview-Commit-ID: JaJuExfILM9
2018-08-14 14:43:42 +03:00
Brian Hackett 91398f534f Bug 1465452 Part 10 - Don't record atom table atomic, r=froydnj.
--HG--
extra : rebase_source : df483c29e518c0937d34317ba36b00383f2d39ad
2018-07-21 14:34:13 +00:00
Masayuki Nakano 5c3723acb2 Bug 1475461 - part 2: Make callers of PLDHashTable::Search() const methods if possible r=Ehsan
Some callers of PLDHashTable::Search() use const_cast, some others are not
const methods due to non-const PLDHashTable::Search().

This patch removes const_cast from the former and mark some methods of the
latter const.

MozReview-Commit-ID: C8ayoi7mXc1

--HG--
extra : rebase_source : 2cba0339756e3278ba6e5f0e8a11e68217a61d34
2018-07-13 19:01:53 +09:00
Nicholas Nethercote 60b1f563cb Bug 1447951 - Store nsDynamicAtom's chars after the end of the object. r=froydnj
This reduces memory usage because we only need one allocation instead of two
for the dynamic atom and its chars, and because we don't need to store a
refcount and a size. It precludes sharing of chars between dynamic atoms, but
we weren't benefiting much from that anyway.

This reduces per-process memory usage by up to several hundred KiB on my
Linux64 box.

One consequence of this change is that we need to allocate + copy in
DOMString::SetKnownLiveAtom(), which could make some things slower.

--HG--
extra : rebase_source : ba4065ea31e509dd985c003614199f73def0596c
2018-06-22 09:38:42 +10:00
Bobby Holley 2b985ab718 Bug 1451421 - Add a ToLowerCaseASCII utility method for nsAtom. r=hisvonen 2018-04-06 15:30:15 -07:00
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
Nicholas Nethercote 380782f6b6 Bug 1445113 - Disallow duplicate static atoms. r=froydnj
This will allow us to work with direct pointers to static atoms that are
initialized at compile-time, rather than pointers to pointers to static atoms
that are initialized at runtime.

MozReview-Commit-ID: K04pEicuqu3

--HG--
extra : rebase_source : c5d895b34567c621f4591769390fc95a4c6ff405
2018-03-29 05:54:10 +11:00
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
Nicholas Nethercote 2211e2da6f Bug 1446865 - Rename various AddRefTable() functions as RegisterStaticAtoms. r=froydnj
These functions no longer perform any refcounting, so the existing names are
misleading.

MozReview-Commit-ID: LX55e0bUP8N

--HG--
extra : rebase_source : 89a3da577325286c1d31723acfd4153754f49703
2018-03-20 13:01:30 +11:00
Nicholas Nethercote e303a46fae Bug 1445142 - Remove DefaultAtoms. r=froydnj
Now that nsGkAtoms is in xpcom/, we can call nsGkAtoms::AddRefAtoms() from
NS_InitAtomTable(), which removes the need for DefaultAtoms, and also removes a
duplicate static atom.

MozReview-Commit-ID: CyfvnvZomzZ

--HG--
extra : rebase_source : 53ead62323a340038c1b4594b1a3eb225aa19626
2018-03-14 11:11:02 +11:00
Nicholas Nethercote 0e2f1f5ab8 Bug 1444031 - Rename nsStaticAtom::mAtom as mAtomp. r=froydnj
Because (a) that name better indicates that it's a pointer to a pointer, and
(b) because nsStaticAtom::mString is going to be renamed as mAtom in bug
1411469.

MozReview-Commit-ID: D5tuNOstMgr

--HG--
extra : rebase_source : 9344eeea0288c8c52c069ce21e8bc55f6e0f3f6f
2018-03-08 11:42:06 +11:00
Nicholas Nethercote 8ac9830be0 Bug 1444031 - Rename Is{Static,Dynamic,HTML5}Atom. r=froydnj
By removing the "Atom" suffix, which is redundant.

MozReview-Commit-ID: 4MCX9Icfjrw

--HG--
extra : rebase_source : c3c759a508a8938b59d36dbb20448d2964b98c91
2018-03-07 15:17:34 +11:00
Nicholas Nethercote 9bc7f17b9e Bug 1442433 - Make nsAtom::mString more const. r=froydnj
The patch also uses GetStringBuffer() in a couple of appropriate places.

MozReview-Commit-ID: JufCUgmO8JL

--HG--
extra : rebase_source : ecd3f17b5560b19622c86759d605fa122d70e48a
2018-03-07 11:57:54 +11:00
Nicholas Nethercote aa19ca1709 Bug 1442433 - Remove the refcount from static atoms. r=froydnj
The refcount is only used for dynamic atoms.

On 64-bit, this reduces sizeof(nsStaticAtom) from 24 bytes to 16 bytes, and the
on-heap size from 32 bytes to 16 bytes. This saves 42 KiB per process.

On 32-bit, this reduces sizeof(nsStaticAtom) from 16 bytes to 12 bytes, but the
on-heap size stays at 16 bytes, so memory usage is unchanged.

MozReview-Commit-ID: 7d9H7MRHN9a

--HG--
extra : rebase_source : d3eafb3aaf44a592afd6c89cd0519d043056e65a
2018-03-05 13:54:06 +11:00
Nicholas Nethercote 7ac2324679 Bug 1441430 - Provide more detail about atoms memory usage. r=froydnj
The old output had a single value: "atoms-table". The new output looks like
this:

> 649,904 B (00.39%) -- atoms
> ├──350,256 B (00.21%) -- dynamic
> │  ├──235,056 B (00.14%) ── unshared-buffers
> │  └──115,200 B (00.07%) ── atom-objects
> ├──212,992 B (00.13%) ── table
> └───86,656 B (00.05%) ── static/atom-objects

MozReview-Commit-ID: 924vUmxHAlh

--HG--
extra : rebase_source : 6c977546a69eeee62ebc87e335982e8278217484
2018-02-28 11:05:07 +11:00
Nicholas Nethercote 50976e53e0 Bug 1441714 - Respect the 80 line char style rule better in nsAtomTable.cpp. r=froydnj
This mostly affects comments; some are too long, some could be longer.

MozReview-Commit-ID: HprR0sIDZwU
2018-02-28 10:57:18 +11:00
Nicholas Nethercote e340c5594b Bug 1441714 - Remove two unused AtomTableKey consructors. r=froydnj
MozReview-Commit-ID: FSsdDYxQHTW
2018-02-28 10:57:02 +11:00
Nicholas Nethercote f76d17db0f Bug 529808 - Remove the static atom table. r=froydnj
Various atom-related things have improved recently.

- The main atom table is now threadsafe (bug 1275755) and so can be accessed on
  any thread. It has also been split into pieces (bug 1440824), which greatly
  reduces lock contention.

- A cache has been added to the HTML5 parser (bug 1352874) that removes the
  need for most of the full table lookups.

As a result, there is no point having a separate static atom table. This patch
removes it.

MozReview-Commit-ID: 8ou1BrnPAwd

--HG--
extra : rebase_source : 0c6ab073b1a20b703705582d28731a68456741e1
2018-02-28 07:34:12 +11:00
Bobby Holley b54cbd7921 Bug 1440824 - Enable multiple hashtables for atoms. r=froydnj
MozReview-Commit-ID: Hj8gKPap0cR
2018-02-26 18:44:39 -08:00
Bobby Holley 62b82589a5 Bug 1440824 - Overhaul the atom infrastructure to support multiple subtables. r=froydnj
MozReview-Commit-ID: E1bcchzuMOu
2018-02-26 18:44:38 -08:00
Bobby Holley 1a54fdfd7a Bug 1440824 - Move some code around. r=froydnj
MozReview-Commit-ID: 4uMktcaYwWW
2018-02-26 18:44:38 -08:00
Nicholas Nethercote 8ad99dd7fa Bug 1411893 - Introduce nsStaticAtom. r=emilio,froydnj.
It's a sub-class of nsAtom, useful for cases where you know you are dealing
exclusively with static atoms. The nice thing about it is that you can use
raw nsStaticAtom pointers instead of RefPtr<>. (In fact, the AddRef/Release
implementations ensure that we'll crash if we use RefPtr<nsStaticAtom>.)

MozReview-Commit-ID: 4Q6QHX5h44V

--HG--
extra : rebase_source : e4237f85b4821b684db0ef84d1f9c5e17cdee428
2017-10-27 10:31:13 +11:00
Nicholas Nethercote 21e7dce1a2 Bug 1410294 (part 3) - Overhaul static atom macros. r=froydnj.
There are four things that must be provided for every static atom, two of which
have a macro:
- the atom pointer declaration (no macro);
- the atom pointer definition (no macro);
- the atom char buffer (NS_STATIC_ATOM_BUFFER);
- the StaticAtomSetup struct (NS_STATIC_ATOM_SETUP).

This patch introduces new macros for the first two things: NS_STATIC_ATOM_DECL
and NS_STATIC_ATOM_DEFN, and changes the arguments of the existing two macros
to make them easier to use (e.g. all the '##' concatenation now happens within
the macros).

One consequence of the change is that all static atoms must be within a class,
so the patch adds a couple of classes where necessary (DefaultAtoms, TSAtoms).

The patch also adds a big comment explaining how the macros are used, and what
their expansion looks like. This makes it a lot easier to understand how static
atoms work. Correspondingly, the patch removes some small comments scattered
around the macro use points.

MozReview-Commit-ID: wpRyrEOTHE

--HG--
extra : rebase_source : 9f85d477b4d06c9a9e710c757de1f1476edb6efe
2017-10-22 08:50:25 +11:00
Nicholas Nethercote 074a872086 Bug 1410294 (part 1) - Rename nsStaticAtom as nsStaticAtomSetup. r=froydnj.
Because it's the type we use to set up static atoms at startup, not the static
atom itself.

The patch accordingly renames some parameters, variables, and NS_STATIC_ATOM,
for consistency.

MozReview-Commit-ID: 1a0KvhYNNw2

--HG--
extra : rebase_source : 5c66e5b2dfe053a368bf3584d957198aec4cce91
2017-10-20 14:04:47 +11:00
Nicholas Nethercote f2d1f3b005 Bug 1407117 - Simplify static atom representation. r=froydnj,bz.
Currently nsAtom::mString points to the interior of an nsStringBuffer. For
static atoms this requires the use of nsFakeStringBuffer, which is pretty
gross.

This patch changes things so that nsAtom::mString points to a static char
buffer for static atoms. This simplifies a number of things:

- nsFakeStringBuffer and CheckStaticAtomSizes are no longer needed.

- FakeBufferRefCountHelper is no longer needed.

- nsAtom's constructor for static atoms is simpler.

- RegisterStaticAtoms() is simpler.

On the flip-side, a couple of things get more complicated.

- nsAtom::ToString() treats static and dynamic atoms differently.

- nsAtom::GetStringBuffer() is now only valid for dynamic atoms. This
  function is only used in two places, both involving DOMString, so those
  locations are updated appropriately. This also requires updating some other
  code assigning nsStrings to DOMStrings, because we can't assume that
  nsStrings are shared.

On Linux64 this change reduces the size of the binary by 8752 B, and moves
81968 B from the .data to the .rodata section, where it can be shared between
processes.

--HG--
extra : rebase_source : 0f6fcdec1c525aa66222e208b66a9f9026f69bcb
2017-10-12 10:52:17 +11:00
Nicholas Nethercote 1de4b467c1 Bug 1406829 (part 2) - Use initializer lists more in nsAtom constructors. r=froydnj. 2017-09-26 16:43:31 +10:00
Nicholas Nethercote d225f7151b Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro.
(Path is actually r=froydnj.)

Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than nsIAtom.

MozReview-Commit-ID: 91U22X2NydP

--HG--
rename : xpcom/ds/nsIAtom.h => xpcom/ds/nsAtom.h
extra : rebase_source : ac3e904a21b8b48e74534fff964f1623ee937c67
2017-10-03 09:05:19 +11:00
Nicholas Nethercote dfd3b7e7aa Bug 1400459 (part 2) - Devirtualize nsIAtom. r=heycam.
This patch merges nsAtom into nsIAtom. For the moment, both names can be used
interchangeably due to a typedef. The patch also devirtualizes nsIAtom, by
making it not inherit from nsISupports, removing NS_DECL_NSIATOM, and dropping
the use of NS_IMETHOD_. It also removes nsIAtom's IIDs.

These changes trigger knock-on changes throughout the codebase, changing the
types of lots of things as follows.

- nsCOMPtr<nsIAtom> --> RefPtr<nsIAtom>

- nsCOMArray<nsIAtom> --> nsTArray<RefPtr<nsIAtom>>
  - Count() --> Length()
  - ObjectAt() --> ElementAt()
  - AppendObject() --> AppendElement()
  - RemoveObjectAt() --> RemoveElementAt()

- ns*Hashtable<nsISupportsHashKey, ...> -->
  ns*Hashtable<nsRefPtrHashKey<nsIAtom>, ...>

- nsInterfaceHashtable<T, nsIAtom> --> nsRefPtrHashtable<T, nsIAtom>
  - This requires adding a Get() method to nsRefPtrHashtable that it lacks but
    nsInterfaceHashtable has.

- nsCOMPtr<nsIMutableArray> --> nsTArray<RefPtr<nsIAtom>>
  - nsArrayBase::Create() --> nsTArray()
  - GetLength() --> Length()
  - do_QueryElementAt() --> operator[]

The patch also has some changes to Rust code that manipulates nsIAtom.

MozReview-Commit-ID: DykOl8aEnUJ

--HG--
extra : rebase_source : 254404e318e94b4c93ec8d4081ff0f0fda8aa7d1
2017-09-26 08:33:21 +10:00