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

37 Коммитов

Автор SHA1 Сообщение Дата
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
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
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 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 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 3eec1c3284 Bug 1275755 - Use an explicit init routine for the atom table. r=froydnj 2016-05-28 17:08:05 +01:00
Andrew McCreight 1e0f87e27d Bug 1151541, part 2 - Fix mode lines in xpcom/. r=froydnj 2015-04-09 10:25:05 -07:00
Nicholas Nethercote f907318caa Bug 1046477 (part 1) - Separate the reporting of the main and static atoms tables. r=froydnj.
--HG--
extra : rebase_source : c60db11fc39d180e43f22e7f395eea24cd358aa3
2014-07-30 23:06:57 -07:00
Ehsan Akhgari 08772d21ac Bug 918105 - Minimize the #includes in xpcom/ds; r=bsmedberg 2013-09-19 15:31:21 -04:00
Catalin Iacob 6f4758d23e Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn.
--HG--
extra : rebase_source : fc472490dd978d165f02f77ed37f07aed6e5bb61
2013-06-23 14:03:39 +02:00
Nathan Froyd 7a6a991007 Bug 765326 - atom-table numbers should include the static atom table; r=njn 2012-06-15 15:51:42 -04:00
Gervase Markham 82ff7027aa Bug 716478 - update licence to MPL 2. 2012-05-21 12:12:37 +01:00
Nicholas Nethercote 667df781bd Bug 712835 (part 3 of 3) - Move AtomImpl and PermanentAtomImpl out of the header. r=khuey.
--HG--
extra : rebase_source : d3fafaa3582faa1642b146d06fe0dfc457639e0a
2011-12-22 17:24:44 -08:00
Nicholas Nethercote 57e4fd55b0 Bug 712835 (part 2 of 3) - Add a memory reporter for the nsAtomTable. r=khuey.
--HG--
extra : rebase_source : 3c934649d072e0d519c905cb8baf49b12bce0312
2011-12-22 17:24:43 -08:00
Michael Wu d2b70213ac Bug 675553 - Switch from PRBool to bool on a CLOSED TREE , r=bsmedberg,khuey,bz,cjones
--HG--
rename : tools/trace-malloc/bloatblame.c => tools/trace-malloc/bloatblame.cpp
2011-09-28 23:19:26 -07:00
Jonas Sicking e1f58838d3 Bug 534136 Part 4: Inline accessors on nsIAtom. r=peterv sr=jst 2010-03-08 07:45:00 -08:00
Jonas Sicking c7c7514f75 Bug 534136 Part 2: Use 16bit-char buffers inside atoms. r=bz sr=mrbkap 2010-03-08 07:45:00 -08:00
Jonas Sicking c24e5442a9 Bug 534136 Part 1: Make atoms keep a pointer to an nsStringBuffer rather than storing the data inline. r=bsmedberg 2010-03-08 07:44:59 -08:00
jst@mozilla.org 0240a7e8d9 Fixing bug 377360. Fix atom table crash due to invalid UTF data in atoms. r=jonas@sicking.cc, sr=peterv@propagandism.org 2007-07-11 13:46:43 -07:00
dbaron%dbaron.org e22e27fc35 Fix threadsafety regression so we're back to the old broken state. b=335734 r=sicking rs=brendan 2006-05-06 17:49:21 +00:00
dbaron%dbaron.org 19cdeba085 Make IsPermanent non-virtual so it can be called in the destructor. b=334605 r=mrbkap rs=brendan 2006-04-19 21:46:47 +00:00
gerv%gerv.net 31625ba2b1 Bug 236613: change to MPL/LGPL/GPL tri-license. 2004-04-18 14:21:17 +00:00
bryner%brianryner.com a10a5e8383 Continuing removal of unneeded virtual destructors (bug 229875). r=dougt, sr=dbaron. 2004-01-22 01:01:19 +00:00
alecf%netscape.com 8c50d0242a landing attempt #2 for 195262 - support for static atoms, and converting atoms over to UTF8 to reduce bloat - now without performance regressions!
sr=darin, r=dbaron
2003-03-25 18:55:59 +00:00
alecf%netscape.com b6584a77fb backout my static atom patch for now until I figure out the performance loss! :(
bug 195262
2003-03-21 20:13:08 +00:00
alecf%netscape.com ecf24a2b78 fix for bug 195262:
- convert atoms to UTF8 because 99% of the time, that is what they are used for
- add support for static atoms, where the strings are declared in a large const array and not copied into the heap
r=dbaron, sr=darin

this is an experimental landing - if there are performance issues, I will back it out.
2003-03-21 06:26:32 +00:00
dp%netscape.com cc314746c1 Trying to fix Irix and HPUX bustage. Defining CPP_THROW_NEW at point
of declaration too.
2002-07-02 22:38:16 +00:00
seawood%netscape.com 03ace271f0 Add CPP_THROW_NEW macro to the build system. This macro should be used when defining a local |operator new| function. It will be set to an empty throw function by default on all platforms except mac CW builds. This will allow us to not crash on systems that expect |operator new| to throw an exception by default and will suppress compiler warnings about how |operator new| should throw an exception instead of returning NULL.
Bug 149032 r=timeless sr=scc
2002-07-02 20:25:30 +00:00
dbaron%fas.harvard.edu 6cdcd7ef3a Convert users of nsAReadable[C]String and nsAWritable[C]String typedefs to [const] nsA[C]String. b=131899 r=scc sr=jag a=asa 2002-03-24 00:16:18 +00:00
jdunn%netscape.com c054ef2252 trying an AIX ifdef to see if this is our startup slowdown problem
a=waterson@netscape.com
# 112824
2002-01-04 15:03:43 +00:00
jdunn%netscape.com 3c7d0ffdc4 AIX requires a constructor for the nsPermanentAtom since this relies on
"new replacement"

r=dbaron@fas.harvard.edu
sr=shaver@mozilla.org
# 112824
2002-01-03 15:57:59 +00:00
dbaron%fas.harvard.edu 2fe76cd2ac Reduce the performance cost of (threadsafely) refcounting many atoms by creating a second implementation of nsIAtom (derived from the first) that does not refcount and gets destroyed at XPCOM shutdown. Normal atoms are converted to permanent ones without loss of pointer identity when a permanent atom is requested and a normal one already exists. b=92141 r=waterson sr=brendan 2001-10-20 23:19:07 +00:00
gerv%gerv.net 4e12e44b2f Relicensing Round 1, Take 2. Most C-like NPL files -> NPL/GPL/LGPL. Bug 98089. 2001-09-28 20:14:13 +00:00
jst%netscape.com 9abec73fbe DOM string changes. All nsString& in DOM interfaces (and interfaces needed by DOM implementations) have been changed to nsAReadableString& and nsAWritableString&. String implementation additions (sanctioned by scc) to support DOM needs. Bug 49091. r=vidur,jst,scc 2000-08-23 17:27:06 +00:00
dmose%mozilla.org 142ac52eaf updated xPL license boilerplate to v1.1, a=chofmann@netscape.com,r=endico@mozilla.org 1999-11-06 03:43:54 +00:00
dougt%netscape.com 32a9a77110 xpild-ing nsIAtom. Now nsIAtom is xpcom compliant. 1999-08-21 07:07:00 +00:00
warren%netscape.com 0142cb7a14 Added 1999-05-18 21:43:13 +00:00