gecko-dev/js/ipc
Nicholas Nethercote b9e071e2e8 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
..
CPOWTimer.cpp
CPOWTimer.h
CpowHolder.h
CrossProcessObjectWrappers.h Bug 1428535 - Add missing override specifiers to overridden virtual functions. r=froydnj 2017-11-05 19:37:28 -08:00
JavaScriptBase.h Bug 1468774 - Remove getPropertyDescriptor from CPOWs. r=mrbkap r=mccr8 2018-04-03 18:21:40 +02:00
JavaScriptChild.cpp Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
JavaScriptChild.h Bug 1314254 - Add mozilla::ipc::IPCResult type and convert IPDL handlers to use new return type. r=billm 2016-11-15 04:26:00 +01:00
JavaScriptLogging.h Bug 1481229 part 2 - Always use the unwrapped object in Logging::formatObject. r=evilpie 2018-08-07 14:06:45 +02:00
JavaScriptParent.cpp Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
JavaScriptParent.h Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
JavaScriptShared.cpp Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
JavaScriptShared.h Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
JavaScriptTypes.ipdlh Bug 1413867 - Remove StopIteration object. r=evilpie 2017-11-05 19:01:04 +01:00
PJavaScript.ipdl Bug 1468774 - Remove getPropertyDescriptor from CPOWs. r=mrbkap r=mccr8 2018-04-03 18:21:40 +02:00
WrapperAnswer.cpp Bug 1468774 - Remove getPropertyDescriptor from CPOWs. r=mrbkap r=mccr8 2018-04-03 18:21:40 +02:00
WrapperAnswer.h Bug 1468774 - Remove getPropertyDescriptor from CPOWs. r=mrbkap r=mccr8 2018-04-03 18:21:40 +02:00
WrapperOwner.cpp Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
WrapperOwner.h Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
moz.build Bug 1394734 - Replace CONFIG['GNU_C*'] by CONFIG['CC_TYPE'] r=glandium 2017-12-07 22:09:15 +01:00