gecko-dev/js/public
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
..
AllocPolicy.h Bug 1475228 - Add JSMallocAllocPolicy to let gecko allocate data structures using the JS heap r=jandem 2018-07-17 14:30:23 +01:00
CallArgs.h Bug 1471272 - Add [SMDOC] tags for in-source documentation. r=jandem,nbp 2018-06-28 15:23:25 -04:00
CallNonGenericMethod.h
CharacterEncoding.h Bug 1426909 - Introduce a new mfbt/Utf8.h header for UTF-8-related functionality, including a UTF-8 code unit type that is compatible with, but doesn't directly interconvert with, |char|. r=froydnj 2018-01-11 11:29:53 -07:00
Class.h Bug 1479793. Throw when someone tries to define an accessor property with an integer name on a DOM proxy with an indexed setter. r=qdot,jorendorff 2018-08-10 17:04:58 +00:00
Conversions.h Bug 1366287 - Part 1.0: Define a new BigInt primitive type, with a GDB prettyprinter, Rust binding support, and a new out-of-line TraceKind. (Disabled by default, implemented only incompletely, currently passing --enable-bigint will disable JITs, will be flipped on Eventually once every sub-aspect is in place, Don't Have A Cow, Man.) r=jwalden, r=Ms2ger, r=sfink 2018-05-24 11:26:09 -07:00
Date.h Bug 1425462 Normalize the JavaScript Engine behavior by adding a callback r=luke 2018-02-22 16:05:50 -06:00
Debug.h Bug 1471272 - Add [SMDOC] tags for in-source documentation. r=jandem,nbp 2018-06-28 15:23:25 -04:00
GCAnnotations.h Bug 1347999. Annotate xpidl methods/attributes that can be implemented in script as JS_HAZ_CAN_RUN_SCRIPT. r=froydnj 2018-07-30 11:51:44 -04:00
GCAPI.h Bug 1465505: Replace PRMJ_Now() by mozilla::TimeStamp r=jonco 2018-07-04 16:55:11 -03:00
GCHashTable.h Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
GCPolicyAPI.h Bug 1459577 - Check expected types with static assertions in GCPolicy implementations r=jandem 2018-05-25 16:07:56 +01:00
GCVariant.h Bug 1460341 - Replace GCPolicy<T>::initial() with SafelyInitialized<T>() r=Waldo 2018-05-25 10:01:25 +01:00
GCVector.h Bug 1466168: Remove mozilla::Forward in favor of std::forward. r=froydnj 2018-06-02 09:33:26 +02:00
HashTable.h Bug 1477626 - Move js::Hash{Set,Map} into MFBT. r=Waldo 2018-07-26 20:15:49 +10:00
HeapAPI.h Bug 1479900 - Part 2: Refactor GC relocation to use a reserved flag. r=sfink 2018-08-08 18:16:43 -04:00
Id.h Bug 1466168: Remove mozilla::Forward in favor of std::forward. r=froydnj 2018-06-02 09:33:26 +02:00
Initialization.h bug 1366287 - Part 2.1: Track GMP memory allocation from XPCOM. r=njn 2018-05-11 19:42:49 -07:00
MemoryMetrics.h Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
Principals.h Bug 1207696 Part 4e - Don't record various JS atomics, r=jandem. 2018-07-21 14:24:16 +00:00
Printf.h Bug 1439063 - Part 1: Move several public headers from js/src to js/public. r=jandem. 2018-02-21 10:30:19 -06:00
ProfilingFrameIterator.h Bug 1426124 - Discard JIT frames from native stacks in the profiler; r=jandem,mstange 2018-04-25 10:08:38 -05:00
ProfilingStack.h Bug 1476793 - Teach HelperThread how to push/pop profiler label frames, and use this capability to push an IDLE frame when the thread is idle. r=njn,sfink 2018-08-02 13:49:48 -04:00
ProtoKey.h Bug 1416723: Remove SIMD.js support; r=luke, r=nbp 2018-07-24 15:15:01 +02:00
Proxy.h Bug 1471272 - Add [SMDOC] tags for in-source documentation. r=jandem,nbp 2018-06-28 15:23:25 -04:00
Realm.h Bug 1481196 - Compile module scripts to a JSScript like we do for classic scripts r=jandem r=baku 2018-08-08 10:40:03 +01:00
RefCounted.h Bug 1480012 - Generalize JS shell mailbox to Wasm memories and modules. r=luke 2018-08-01 13:21:06 +02:00
RequiredDefines.h
Result.h Bug 1471272 - Add [SMDOC] tags for in-source documentation. r=jandem,nbp 2018-06-28 15:23:25 -04:00
RootingAPI.h Bug 1477626 - Move js::Hash{Set,Map} into MFBT. r=Waldo 2018-07-26 20:15:49 +10:00
SliceBudget.h Bug 1477761 - Fix sketchy timestamp computation for unlimited slice budget r=sfink 2018-07-26 17:23:18 +01:00
Stream.h
StructuredClone.h Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj 2018-06-01 10:45:27 +02:00
SweepingAPI.h Bug 1466168: Remove mozilla::Forward in favor of std::forward. r=froydnj 2018-06-02 09:33:26 +02:00
TraceKind.h Bug 1466168: Remove mozilla::Forward in favor of std::forward. r=froydnj 2018-06-02 09:33:26 +02:00
TracingAPI.h Bug 1466121 part 1 - Rename JSCompartment to JS::Compartment. r=luke 2018-06-07 16:44:40 +02:00
TrackedOptimizationInfo.h Bug 1472132 - Don't inline non-scripted functions in Ion when constructing and new.target != the callee. r=anba 2018-07-02 18:34:02 +02:00
TypeDecls.h Bug 1466121 part 2 - Make Compartment and Zone classes instead of structs. r=luke 2018-06-07 16:45:04 +02:00
UbiNode.h Bug 1477626 - Move js::Hash{Set,Map} into MFBT. r=Waldo 2018-07-26 20:15:49 +10:00
UbiNodeBreadthFirst.h Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
UbiNodeCensus.h Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
UbiNodeDominatorTree.h Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
UbiNodePostOrder.h Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
UbiNodeShortestPaths.h Bug 1481998 - Make mozilla::Hash{Map,Set}'s entry storage allocation lazy. r=luke,sfink 2018-08-10 18:00:29 +10:00
UbiNodeUtils.h Bug 1474383 - JSRuntime hook to construct ubi::Nodes specialized for nsINode instances. r=sfink,jimb,bz 2018-07-06 16:52:42 -07:00
UniquePtr.h Bug 1466168: Remove mozilla::Forward in favor of std::forward. r=froydnj 2018-06-02 09:33:26 +02:00
Utility.h Bug 1477626 - Move ScrambleHashCode() from js/src/Utility.h to mfbt/HashFunctions.h. r=Waldo 2018-07-26 18:52:47 +10:00
Value.h Bug 1317481 - Optimize away Generator/Promise handling for await in the topmost JS frame with already resolved/rejected Promise. r=anba,smaug 2018-08-02 16:11:57 +09:00
Vector.h
WeakMapPtr.h Bug 1438278 - Part 3: Rename some files into js/src/gc. r=jonco. 2018-02-14 16:00:46 -06:00
Wrapper.h Bug 1468752 part 2 - Define Wrapper::wrapperHandler in Wrapper.h. r=bz 2018-07-06 12:53:38 +02:00