Commit Graph

36 Commits

Author SHA1 Message Date
Nicholas Nethercote
439d31614d Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink
Entry storage allocation now occurs on the first lookupForAdd()/put()/putNew().
This removes the need for init() and initialized(), and matches how
PLDHashTable/nsTHashtable work. It also removes the need for init() functions
in a lot of types that are built on top of mozilla::Hash{Map,Set}.

Pros:

- No need for init() calls and subsequent checks.

- No memory allocated for empty tables, which are not that uncommon.

Cons:

- An extra branch in lookup() and lookupForAdd(), but not in put()/putNew(),
  because the existing checkOverloaded() can handle it.

Specifics:

- Construction now can take a length parameter.

- init() is removed. Explicit length-setting, when necessary, now occurs in the
  constructors.

- initialized() is removed.

- capacity() now returns zero when the entry storage is absent.

- lookupForAdd() is no longer `const`, because it can instantiate the storage,
  which requires modifications.

- lookupForAdd() can now return an invalid AddPtr in two cases:

  - old: hashing failure (due to OOM in the hasher)

  - new: OOM while instantiating entry storage

  The existing failure handling paths for the old case work for the new case.

- clear(), finish(), and clearAndShrink() are replaced by clear(), compact(),
  and reserve(). The old compactIfUnderloaded() is also removed.

- Capacity computation code is now in its own functions, bestCapacity() and
  hashShift(). setTableSizeLog2() is removed.

- uint32_t is used throughout for capacities, instead of size_t, for
  consistency with other similar values.

- changeTableSize() now takes a capacity instead of a deltaLog2, and it can now
  handle !mTable.

Measurements:

- Total source code size is reduced by over 900 lines. Also, lots of existing
  lines got shorter (i.e. two checks were reduced to one).

- Executable size barely changed, down by 2 KiB on Linux64. The extra branches
  are compensated for by the lack of init() calls.

- Speed changed negligibly. The instruction count for Bench_Cpp_MozHash
  increased from 2.84 billion to 2.89 billion but any execution time change was
  well below noise.
2018-08-10 18:00:29 +10:00
Bill McCloskey
1deceb4b29 Bug 1311212 - Add dead CPOW debugging facility (r=mrbkap) 2016-10-19 16:26:23 -07:00
Jan de Mooij
519f0d4bf1 Bug 1292892 part 7 - Remove unnecessary JSContext arguments from IPC classes. r=bz 2016-08-11 14:39:23 +02:00
Jan de Mooij
bd0f1c9018 Bug 1292892 part 1 - Stop using JSRuntime outside SpiderMonkey. r=bz,terrence,fitzgen,kanru 2016-08-11 14:39:22 +02:00
Bill McCloskey
7953e46b07 Bug 1215167 - Forbid unsafe browser CPOWs (disabled by default for now) (r=mrbkap) 2015-11-05 13:17:04 -08:00
Wes Kocher
dd9e3ef892 Backed out changeset 89446bf8d6b8 (bug 1215167) for introducing a hazard 2015-11-04 16:16:59 -08:00
Bill McCloskey
f333296703 Bug 1215167 - Forbid unsafe browser CPOWs (disabled by default for now) (r=mrbkap) 2015-11-04 13:40:15 -08:00
Birunthan Mohanathas
a29151dc87 Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Jan de Mooij
c6596c5fa8 Bug 1144366 - Switch SpiderMonkey and XPConnect style from |T *t| to |T* t|. r=jorendorff 2015-03-28 23:22:11 +01:00
Phil Ringnalda
1a1c158706 Backed out changeset 0c030f97a04f (bug 1144366) for being on top of patches being backed out
CLOSED TREE
2015-03-28 10:39:56 -07:00
Jan de Mooij
369ef1b850 Bug 1144366 - Switch SpiderMonkey and XPConnect style from |T *t| to |T* t|. r=jorendorff 2015-03-28 12:08:37 +01:00
Ehsan Akhgari
ea41d8de48 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Ehsan Akhgari
e8139a2aa1 Bug 1119265 - Mark virtual overridden functions as MOZ_OVERRIDE in JS IPC; r=billm 2015-01-08 23:10:41 -05:00
Bobby Holley
0432f88162 Bug 1052096 - Move CPOW targets into the privileged/unprivileged junk scope of the child/parent. r=billm 2014-09-12 17:41:18 -07:00
Ehsan Akhgari
9918ac3b8c Bug 1060988 - Fix more bad implicit constructors in JS IPC code; r=billm 2014-08-31 21:10:16 -04:00
Bill McCloskey
219eb6cb82 Bug 1052093 - Child->parent CPOWs should go through COWs in the parent for security (r=bholley) 2014-08-20 12:49:10 -07:00
Tom Schuster
14dc944888 Bug 957742 - Logging for CPOWs (r=mrbkap) 2014-05-28 18:05:22 -07:00
Bill McCloskey
6582876747 Bug 996785 - Bidirectional CPOWs (r=mrbkap) 2014-05-16 16:40:37 -07:00
Bill McCloskey
648513711d Bug 996785 - Distinguish local and remote CPOW objects in IPDL (r=mrbkap) 2014-05-16 16:40:36 -07:00
Bill McCloskey
a6ad990683 Bug 996785 - Move CPOW wrapper owner code (r=mrbkap) 2014-05-16 16:40:36 -07:00
Bill McCloskey
b07848079e Bug 996785 - Rename CPOW makeId/unwrap (r=mrbkap) 2014-05-16 16:40:35 -07:00
Bill McCloskey
0f7f7b7bb9 Bug 996785 - Move global CPOW functions to top level (r=mrbkap) 2014-05-16 16:40:35 -07:00
Jason Orendorff
d3d65bb33a Bug 547140, part 2 - Remove flags argument from JS_GetPropertyDescriptor and friends. r=Waldo. 2014-04-25 16:11:01 -05:00
Bill McCloskey
68e9bb772c Bug 962604 - Add ActorDestroy handling to CPOWs (r=mrbkap) 2014-02-05 08:39:59 -08:00
Thinker Lee
894dfd9896 Bug 771765 - Support template content process, part 4: Clone IPC protocol objects that will be up when the template process is ready. r=khuey, r=bent 2013-06-03 18:14:37 +08:00
Nicholas Nethercote
378d4e5d13 Bug 911043 (part 1) - Move the "inject JS:: names into js::" block into its own file, to reduce dependencies on jsapi.h. r=luke. 2013-09-01 21:51:02 -07:00
Nicholas Nethercote
acad15eadf Bug 909178 (part 2) - Make jsclass.h not depend on jsapi.h, and rename it js/Class.h. r=jwalden. 2013-08-21 22:26:57 -07:00
Nicholas Nethercote
fa37a2655d Bug 905017 (part 3, attempt 2) - Move profiling stack stuff from jsapi.h to js/ProfilingStack.h. r=billm. 2013-08-19 23:45:26 -07:00
Ms2ger
f8ed09ac74 Backout changesets 7e6fb33fdf22:c85332df4320 (bug 905017) for windows bustage. 2013-08-22 10:16:30 +02:00
Nicholas Nethercote
52fbc3188d Bug 905017 (part 3) - Move profiling stack stuff from jsapi.h to js/ProfilingStack.h. r=billm. 2013-08-19 23:45:26 -07:00
Nicholas Nethercote
9fc605b8f3 Bug 905017 (part 1) - Minimize inclusions of JS engine headers in .h and .idl files. r=billm. 2013-08-17 15:50:18 -07:00
Terrence Cole
f3b496ba3b Bug 862115 - Use Rooted<JSPropertyDescriptor> in favor of JSPropertyDescriptor::AutoRooter r=terrence r=smaug r=bholley 2013-04-30 10:29:40 -07:00
Bill McCloskey
5766d47c37 Bug 899804 - Make CPOWs handle instanceof with WebIDL interfaces (r=bz,dvander) 2013-08-01 16:45:17 -07:00
Tom Schuster
da3fbff1f7 Bug 890729 - Reorder the CPOW traps. r=dvander 2013-07-11 11:23:34 -04:00
Tom Schuster
13c81bab95 Bug 890729 - Implement the missing CPOW traps. r=dvander 2013-07-09 22:45:08 -04:00
David Anderson
0fb025f184 Rewrite CPOWs to use one actor per process (bug 853209, r=billm,bholley,smaug). 2013-07-03 00:24:32 -07:00