Commit Graph

1616 Commits

Author SHA1 Message Date
Botond Ballo
63264c57f4 Bug 1498767 - Add missing MFBT tests to testing/cppunittest.py. r=froydnj
Also add a comment to mfbt/tests/moz.build to remind people that tests
need to be added to testing/cppunittest.py.

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

--HG--
extra : moz-landing-system : lando
2018-10-13 21:54:27 +00:00
twsmith
ca53c9933c Bug 1494207 - Add MOZ_CRASH_WRITE_ADDR to avoid ILL with UBSan. r=nfroyd 2018-10-04 14:52:16 -07:00
Jed Davis
08bc6b93f0 Bug 1493045 - Assert thread-safety when destroying WeakPtr r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D7353

--HG--
extra : moz-landing-system : lando
2018-10-03 16:41:10 +00:00
Botond Ballo
9492fcbd94 Bug 1494671 - Make the CompositorHitTestInfo globals constexpr. r=froydnj
Depends on D7323

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

--HG--
extra : moz-landing-system : lando
2018-10-01 20:09:10 +00:00
Botond Ballo
10780a46ba Bug 1494671 - Make MOZ_AssertAssignmentTest() constexpr. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D7323

--HG--
extra : moz-landing-system : lando
2018-10-01 19:53:06 +00:00
Daniel Zielas
adc55f89c0 Bug 1420996 - EnumSet enhancement. r=botond,Waldo
--HG--
extra : rebase_source : 0beee78e60e1432bfceeb04219efc62730f14475
extra : histedit_source : fdc75700e78e5e5a8b0f40a83192a9c0a0f24b85
2018-09-25 20:47:38 +02:00
Margareta Eliza Balazs
ffe6eaf2f0 Merge inbound to mozilla-central. a=merge 2018-09-25 12:42:09 +03:00
Mike Hommey
0121cc3b9f Backout changeset b31288fb959a (bug 1443265). r=froydnj
Because it never actually had an effect until clang 7, where it reveals
the tree is not ready for it. See details in bug 1492743.
2018-09-25 10:54:07 +09:00
Mike Hommey
b487ebbc58 Bug 1493093 - Allow to relax MOZ_NON_TEMPORARY_CLASS for some specific constructors r=andi
Differential Revision: https://phabricator.services.mozilla.com/D6566

--HG--
extra : moz-landing-system : lando
2018-09-24 22:47:12 +00:00
Andrew McCreight
c7a5590610 Bug 1493781 - Add a comment to IsBaseOf indicating that it is reflexive r=froydnj
IsBaseOf<A, A> holds despite the fact that a class is not actually a
base class of itself.

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

--HG--
extra : moz-landing-system : lando
2018-09-24 19:58:16 +00:00
Nathan Froyd
bc5c879186 Bug 1486400 - add task dispatch/run delays for ChaosMode; r=jesup 2018-09-19 12:02:09 -04:00
Noemi Erli
e6319bab61 Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-09-14 01:18:29 +03:00
Xidorn Quan
3da37fa945 Bug 1490956 - Add WrapUnique for UniquePtr. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D5756

--HG--
extra : moz-landing-system : lando
2018-09-13 13:29:13 +00:00
Dylan Roeh
b18b70dfcf Bug 1489257 - Backed out 3 changesets (bug 1441059, bug 1478171) for causing bug 1489257. r=me
Backed out changeset f7bd4f224f9a (bug 1441059)
Backed out changeset e66e6bd82e3f (bug 1441059)
Backed out changeset 94cfd6113ca7 (bug 1478171)
2018-09-13 12:27:23 -05:00
Aaron Klotz
66fac2de25 Bug 1489317: Part 1 - Add forward declaration for mscom::AgileReference to RefPtr; r=froydnj
I'd like to add a constructor and operator= to RefPtr for mscom::AgileReference.
This patch is simply the forward declarations to allow for that.

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

--HG--
extra : moz-landing-system : lando
2018-09-12 18:55:30 +00:00
Cosmin Sabou
ee876fb168 Backed out 4 changesets (bug 1489317) for causing multiple windows tests timeouts. CLOSED TREE
Backed out changeset e35a9b02675b (bug 1489317)
Backed out changeset 7528056ab631 (bug 1489317)
Backed out changeset d5d432fd2433 (bug 1489317)
Backed out changeset fddf77dc2f9d (bug 1489317)
2018-09-11 09:22:37 +03:00
Aaron Klotz
08dd5256f5 Bug 1489317: Part 1 - Add forward delcaration for mscom::AgileReference to RefPtr; r=froydnj
I'd like to add a constructor and operator= to RefPtr for mscom::AgileReference.
This patch is simply the forward declarations to allow for that.

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

--HG--
extra : source : 2787fb454f40584ad146c61fd9b375c419efe803
2018-09-10 22:58:16 +00:00
Ciure Andrei
7a6f7c263a Backed out 4 changesets (bug 1489317) for windows test failures CLOSED TREE
Backed out changeset 07b44bee061c (bug 1489317)
Backed out changeset b340f5acb7b5 (bug 1489317)
Backed out changeset 62b404e59c32 (bug 1489317)
Backed out changeset 2787fb454f40 (bug 1489317)
2018-09-11 04:22:44 +03:00
Aaron Klotz
e8230a1d6b Bug 1489317: Part 1 - Add forward delcaration for mscom::AgileReference to RefPtr; r=froydnj
I'd like to add a constructor and operator= to RefPtr for mscom::AgileReference.
This patch is simply the forward declarations to allow for that.

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

--HG--
extra : moz-landing-system : lando
2018-09-10 22:58:16 +00:00
Ciure Andrei
66949099e9 Backed out 4 changesets (bug 1489317) for causing Windows test failures CLOSED TREE
Backed out changeset 8cf95604ce94 (bug 1489317)
Backed out changeset 9d444f92b939 (bug 1489317)
Backed out changeset e0535e0450c8 (bug 1489317)
Backed out changeset 0f8554d82b32 (bug 1489317)
2018-09-11 00:50:10 +03:00
Aaron Klotz
d8aecf7193 Bug 1489317: Part 1 - Add forward delcaration for mscom::AgileReference to RefPtr; r=froydnj
I'd like to add a constructor and operator= to RefPtr for mscom::AgileReference.
This patch is simply the forward declarations to allow for that.

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

--HG--
extra : moz-landing-system : lando
2018-09-10 20:02:39 +00:00
Daniel Varga
1539df295b Merge mozilla-inbound to mozilla-central a=merge 2018-09-08 06:53:43 +03:00
Emilio Cobos Álvarez
c9c6290890 Bug 1489453 - EnumSet shouldn't take 32 bits if not needed. r=froydnj
This is the only reason I haven't used it before for things like
StyleSheet::State.

Change the underlying type to be the underlying enum representation by default,
but allow to override it if wanted.

Assertions should catch misuses.

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

--HG--
extra : moz-landing-system : lando
2018-09-07 14:40:02 +00:00
Valentin Gosu
c4da49a35f Bug 908413 - Make dom::MimeType a template to make it usable with nsCString r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D5094

--HG--
extra : moz-landing-system : lando
2018-09-07 05:41:29 +00:00
Mike Hommey
88314c2170 Bug 1488631 - Remove annotations that the clang plugin doesn't handle. r=andi
As per bug 1487622, annotations have side effects on codegen, one of
which changes a leak signature that the wpt harness doesn't match
against its whitelist anymore.

Interestingly, while looking at the issue, I found multiple moz_*
annotations that weren't actually looked for by the clang plugin,
making them useless. Even more interestingly, removing them changes
codegen in such a way that the leak signature mentioned above is not
altered anymore.

Differential Revision: https://phabricator.services.mozilla.com/D5000
2018-09-08 06:49:48 +09:00
Brian Hackett
4a3bf67bb5 Bug 1488260 Part 1 - Consolidate per-thread event and assertion streams, NOT REVIEWED YET.
--HG--
extra : rebase_source : c7a36db81ff22f3edcbdea6d7625facf291e44ee
2018-09-03 08:08:45 -10:00
Nathan Froyd
1e249c5e16 Bug 1486882 - make TestPoisonArea work with aarch64 windows; r=Waldo
We already have the AArch64 return instruction; we just need to check
for the Windows-specific preprocessor conditional.
2018-08-29 14:47:49 -04:00
Tiberius Oros
2ee9341d01 Merge inbound to mozilla-central. a=merge 2018-08-24 12:43:45 +03:00
Kris Maglione
61d9aacb68 Bug 1484373: Part 2a - Add Tuple ForEach helper function. r=froydnj
It's currently fairly difficult to perform some operation on each member of a
tuple. This is a particular issue in the context of adding a cycle collection
helper, where we need to perform traverse and unlink operations on each member
of a tuple, and don't have a way to do so without several layers of templates.

This patch adds a ForEach function which will call a function on each element
of the tuple. This would typically be used with a lambda function with a
single `auto&` argument.

--HG--
extra : rebase_source : 577f7c823ab7ee8d1fdedfbd26393c1f1664b965
2018-08-19 17:42:59 -07:00
Robert Helmer
3091853572 Bug 1421501 - WebIDL and DOM for PrioEncoder r=edgar,hsivonen
MozReview-Commit-ID: L8htRm3J1mZ

--HG--
extra : rebase_source : bba7f747583412677db1811400b86f1a335ef688
2018-06-20 17:21:17 -07:00
Cosmin Sabou
0bd06ad763 Backed out 7 changesets (bug 1421501) for causing build bustages. CLOSED TREE
Backed out changeset 492f05d220b1 (bug 1421501)
Backed out changeset 844232d77d0d (bug 1421501)
Backed out changeset 3affc66728b0 (bug 1421501)
Backed out changeset 4d7c3c02ce8d (bug 1421501)
Backed out changeset e27d93ac79a0 (bug 1421501)
Backed out changeset a6c9888b5179 (bug 1421501)
Backed out changeset f7f9e47f0608 (bug 1421501)
2018-08-23 22:46:07 +03:00
Robert Helmer
fff0e34b0f Bug 1421501 - WebIDL and DOM for PrioEncoder r=edgar,hsivonen
MozReview-Commit-ID: L8htRm3J1mZ

--HG--
extra : rebase_source : 5fd5317ef8891f1f7659161904e53d2e085d5c5b
2018-06-20 17:21:17 -07:00
Gurzau Raul
ac1914ecba Backed out 6 changesets (bug 1421501) for bustages on security/nss/lib/freebl/mpi/mp_comba.c on a CLOSED TREE
Backed out changeset cae4910806c7 (bug 1421501)
Backed out changeset 600a005d3613 (bug 1421501)
Backed out changeset 7381597721d2 (bug 1421501)
Backed out changeset 1ee0d35a041f (bug 1421501)
Backed out changeset 772dea1abb7f (bug 1421501)
Backed out changeset c119767aec7b (bug 1421501)
2018-08-23 17:13:42 +03:00
Robert Helmer
b8233d3ae3 Bug 1421501 - WebIDL and DOM for PrioEncoder r=edgar,hsivonen
MozReview-Commit-ID: L8htRm3J1mZ

--HG--
extra : rebase_source : ca9ccac75cd575be12d18c71ae60dbffb7c529fa
2018-06-20 17:21:17 -07:00
Nathan Froyd
8b18d41782 Bug 1480578 - update double-conversion to bring in ARM/AArch64 Windows support; r=Waldo 2018-08-22 21:01:24 -04:00
Nicholas Nethercote
de3b7e3af9 Bug 1483182 - Do report OOM failures in HashTable::reserve(). r=luke
This fixes a typo.

--HG--
extra : rebase_source : bc5d5eaa187797aa1167790c2bddd2db2110bf01
2018-08-21 19:07:20 +10:00
Nicholas Nethercote
d4f517f3e2 Bug 1483182 - Don't allocate in HashTable::lookupOrAdd(). r=luke
Currently lookupOrAdd() will allocate if the table has no storage. But it
doesn't report an error if the allocation fails, which can cause problems.

This patch changes things so that lookupOrAdd() doesn't allocate when the table
has no storage. Instead, it returns an AddPtr that is not *valid* (its mTable
is empty) but it is *live*, and can be used in add(), whereupon the allocation
will occur.

The patch also makes Ptr::isValid() and AddPtr::isValid() non-public, because
the valid vs. live distinction is non-obvious and best kept hidden within the
classes.

--HG--
extra : rebase_source : 95d58725d92cc83332e27a61f98fa61185440e26
2018-08-21 13:49:17 +10:00
Masatoshi Kimura
9e71125487 Bug 1306642 - Backed out changeset 5bd8445b019f as final NSPR fix has landed. r=dmajor
--HG--
extra : rebase_source : fc93d796f8fe4415d3897f307de9b13c9ebefcad
2018-08-16 19:06:42 +09:00
Margareta Eliza Balazs
4ec111d31e Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-08-16 12:34:45 +03:00
Nicholas Nethercote
2b8aa56d1e Bug 1483062 - Trivial comment fixes. r=me
--HG--
extra : rebase_source : 81beeb90397bc6dbfac21b3e0adccaf63978f437
2018-08-16 09:45:44 +10:00
Nicholas Nethercote
70253e2770 Bug 1483062 - Inline and remove HashTable::{over,under}loaded(). r=luke
Because they each only have a single call site, and the "too many items
removed?" test is already encapsulated within rehashIfOverloaded().

--HG--
extra : rebase_source : f6550c483477c2839764e7f657b542c24c82b1e8
2018-08-16 09:10:17 +10:00
Nicholas Nethercote
14551e3f43 Bug 1483062 - Merge HashTable::wouldBeUnderloaded() into underloaded(). r=luke
--HG--
extra : rebase_source : ed0ecbc871048b416452a7612991bcff98c91a06
2018-08-15 11:11:13 +10:00
Nicholas Nethercote
1c305db7ce Bug 1483062 - Inline and remove HashTable::overRemoved(). r=luke
--HG--
extra : rebase_source : c7dbdbe38bf0f44f27bda7f134bbf0d865149200
2018-08-15 11:10:56 +10:00
Nicholas Nethercote
eb0a51a708 Bug 1483062 - Rename HashTable::rehashIfOverRemoved(). r=luke
infallibleRehashIfOverloaded() actually matches what it does.

Also, the patch removes the `overloaded()` test within the function, because
`rehashIfOverloaded()` has the same test.

--HG--
extra : rebase_source : 2799e623fbdd4b8bb82f8b83166752e02a0f9202
2018-08-14 11:56:55 +10:00
Nicholas Nethercote
d12003b7e5 Bug 1483062 - Rename some HashTable methods. r=luke
Specifically:
- checkOverloaded  -> rehashIfOverloaded
- checkUnderloaded -> shrinkIfUnderloaded
- checkOverRemoved -> rehashIfOverRemoved

Because I've always found that the `check` prefix doesn't clearly explain that
the table might be changed,

And:
- shouldCompressTable -> overRemoved

Because that matches `overloaded` and `underloaded`.

--HG--
extra : rebase_source : 56e9edd012f4a400ac366895d05ea93fb09ec6b3
2018-08-14 11:19:39 +10:00
Nicholas Nethercote
d378adb5b7 Bug 1483062 - Rename HashTable::findFreeEntry() as findNonLiveEntry(). r=luke
Because that's a more accurate description of what it does -- it finds free
*and* removed entries.

--HG--
extra : rebase_source : 72b049f44c61a7406d9691a9d9b6405dd696848c
2018-08-14 09:36:00 +10:00
Nicholas Nethercote
44dd70d7d6 Bug 1483062 - Remove HashTable::maybeCreateTable. r=luke
It's dead.

--HG--
extra : rebase_source : c1a6aca3340c09cbe5e9f3ac9a5ea1ae5901ea4e
2018-08-09 14:19:49 +10:00
Thomas Wisniewski
78af5fd2ae Bug 1454590 - Align overrideMIMEType with the XMLHttpRequest Standard. r=hsivonen
MozReview-Commit-ID: 5k34F96jRPX

--HG--
extra : rebase_source : 95944acc3123406dbf490f2fd1837b8decaa3e0b
2018-08-13 16:12:10 -04:00
Gerald Squelart
2d21b03a3b Bug 1482046 - mfbt: FunctionTypeTraits - r=froydnj
FunctionTypeTraits< function type > makes it easier to inspect a function's
return type, arity, and parameter types.
It works with free functions, struct/class methods, function objects like
non-generic lambdas and std::function.

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

--HG--
extra : moz-landing-system : lando
2018-08-15 10:27:45 +00:00
Jeff Walden
65fc1cbcdc Make DecodeOneUtf8CodePoint* take |const EndIter& aEnd| to enforce immutability of the end iterator. No bug, r=me as trivial
--HG--
extra : rebase_source : 203441e69e49bcedcf9810a1e9504f72de1f3820
2018-08-09 21:04:23 -07:00
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
Nicholas Nethercote
a04c29f828 Bug 1481998 - Define lookup() in terms of readonlyThreadsafeLookup(). r=luke
The two functions are almost identical. This change minimizes duplication.

--HG--
extra : rebase_source : 08bb79d21084eec63702525ce6179e22686bec5c
2018-08-10 15:35:13 +10:00
Chris Peterson
b227b37687 Bug 1481097 - mfbt: Assert we're compiling with gcc 6.1 or later. r=glandium
Firefox currently requires gcc 6.1 or later (as of bug 1444274).

MozReview-Commit-ID: CaJwpUgntxn

--HG--
extra : rebase_source : 302d8aa57696e2e96962c67e3497f76e882a472f
extra : source : 2a53a830f79424b2c41c8bdc4816ec24fa943ecc
2018-07-21 23:45:41 -07:00
Bryce Van Dyk
460c97cad4 Bug 1481005 - Explicitly delete dtor of AlignmentFinder::Alinger to avoid MSVC warning breaking debug builds. r=froydnj
Bug 1480624 added new code that results in a warning on MSVC debug builds. This
warning is treated as an error and makes such builds unhappy. The warning is
due to implicit deletion of a dtor, this changeset makes that deletion
explicit to avoid the fatal warning.

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

--HG--
extra : moz-landing-system : lando
2018-08-07 17:58:39 +00:00
Nicholas Nethercote
dcd7d4327c Bug 1481138 - Clarify that Hash{Map,Set}::putNew() can be used if elements have been removed. r=luke
Hash{Map,Set}::putNew() can be used on a table that has had elements removed,
despite some comments to the contrary.

This patch fixes those comments. It also clarifies when putNewInfallible() can
be used.

This patch also removes the !isRemoved() assertion in findFreeEntry(), which is
confusing -- !isLive() would be more precise, but also obvious from the
surrounding code.

MozReview-Commit-ID: q4qwKGBsHx

--HG--
extra : rebase_source : 94331879f9a1484159e030de93bd0ab222b54385
2018-08-06 12:01:28 +10:00
Nicholas Nethercote
46db021929 Bug 1481138 - Remove HashMap::lookupWithDefault(). r=luke
Because it's quite strange, badly named, not that useful, and barely used.

Also remove WeakMap::lookupWithDefault(), which is similar, but not used at
all.

MozReview-Commit-ID: IhIl4hQ73U1

--HG--
extra : rebase_source : 7da237a56391836ca5d056248f18bd5e2d8b1564
2018-08-06 09:45:38 +10:00
Nicholas Nethercote
d9eb003725 Bug 1481138 - Remove the add() variant in HashTable and GCHashTable that uses a default value. r=luke
Because (a) it's kinda weird, and (b) only used in a single test, where it can
be easily replaced with a vanilla add().

MozReview-Commit-ID: L4RoxFb7yGG

--HG--
extra : rebase_source : 515a5ede5d417686907345ad9069c6a41669dd17
2018-08-06 09:10:05 +10:00
Masatoshi Kimura
b2d2d974d3 Bug 1306642 - Temporarily allow warnings from MemoryChecking.h. r=dmajor
--HG--
extra : rebase_source : ff1502d89cf38b27b2cb28152f4ff33141b67374
2018-08-04 17:25:11 +09:00
Randell Jesup
85a1661cdc Bug 1474701: Fix shutdown profile-save (fix imbalance) and add JSONWriter assertions r=mstange,njn 2018-08-06 10:44:26 -04:00
Nicholas Nethercote
e39fda4c40 Bug 1480668 - Remove js::CStringHashPolicy. r=luke
It's identical to mozilla::CStringHasher.

Also fix a comment at the top of HashTable.h about CStringHasher.

--HG--
extra : rebase_source : 92176c4f6ea8041f309764b4ce0271a494853a7b
2018-08-06 07:55:50 +10:00
Nicholas Nethercote
7b988956cc Bug 1480650 - Remove mozilla::HashTable::Stats. r=luke
I bet nobody has used them in years. The use of ad hoc profiling (printfs plus
post-processing with a tool like https://github.com/nnethercote/counts) is
generally a better approach.

Bug 1179657 did likewise for PLDHashTable.

--HG--
extra : rebase_source : 57ab26c62f2f1eff2eec827564a3c3ff0af12f01
2018-08-03 11:59:26 +10:00
Nicholas Nethercote
5c9b1f5c39 Bug 1480323 - Reorder methods in Hash{Set,Map}. r=luke
And add comments delimiting different operation groups. Together these changes
make Hash{Set,Map} much easier to navigate.

--HG--
extra : rebase_source : 21a7da92f898b318a24085b5f0885da85aa3afd1
2018-08-03 10:25:29 +10:00
Brian Hackett
a1556089f7 Bug 1479058 Part 1 - Add NewTimeWarpTarget() API, r=mccr8.
--HG--
extra : rebase_source : 556161b281c21b19f972854b5c3b31e302d0dd26
2018-08-02 23:26:25 +00:00
Nathan Froyd
dc2c367d40 Bug 1480581 - add an AArch64-specific case to EndianUtils.h; r=Waldo 2018-08-03 18:07:34 -04:00
Nathan Froyd
c0949fc4e1 Bug 1480577 - add AArch64-specific cases for MathUtils.h bitscan functionality; r=Waldo 2018-08-03 18:07:34 -04:00
Nicholas Nethercote
097b276f5c Bug 1480660 - Remove ConstExprHash{UntilZero,String}(). r=froydnj
They were workarounds for bugs in GCC 4.9, which is no longer supported.

--HG--
extra : rebase_source : b793b4643e1e44199afdb8e8b35f930e02664be8
2018-08-03 14:47:41 +10:00
Nicholas Nethercote
088ecf7be1 Bug 1480361 - Introduce HashTable::LookupReason. r=luke
Again inspired by PLDHashTable, this makes things a bit clearer than passing 0
or sCollisionBit.

It also guarantees more strongly that we'll end up with appropriately
specialized code for the Add vs. NonAdd cases. (That guarantee isn't currently
needed because the compiler inlines things sufficiently anyway, but it can't
hurt.)

--HG--
extra : rebase_source : c2341d7df85f44a00bd1b52eac0e08ac63525196
2018-08-03 10:03:37 +10:00
Nicholas Nethercote
7cb8d52236 Bug 1480361 - Tweak handling of removed entries in HashTable::lookup(). r=luke
There are two improvements here.

- When we're just doing a lookup (i.e. aCollisionBit==0), we don't need to
  do any special handling of removed entries. (Inlining means that the removed
  entry code is entirely removed for lookups.)

- When we're doing an insertion (i.e. aCollisionBit==sCollisionBit), we now
  stop adding collision markings once we find a removed entry, because they're
  unnecessary after that point.

This change brings the code in alignment with PLDHashTable::SearchTable().

--HG--
extra : rebase_source : 8d6e3a88ac24d0e71a2576997face3bea971c71f
2018-08-03 10:03:31 +10:00
Nicholas Nethercote
da4f2681a4 Bug 1478885 - Improve docs for mozilla::Hash{Set,Map}. r=luke
This patch does the following:

- Adds a bunch of useful high-level info at the top of the file, making the
  types easier to use for newcomers.

- Adds a comment to every Hash{Set,Map} method that lacked one.

- Tweaks lots of existing comments for clarity.

- Removes comments in Hash{Set,Map} referring to details within HashTable. That
  dependence is now covered in the top-level comment.

- Tweaks the signatures in hash policy classes to be more consistent.

--HG--
extra : rebase_source : ab9d6ae38b4b73e12151a228107ad3f3f12e36b3
2018-08-03 06:33:21 +10:00
Nicholas Nethercote
95ed5dcb6d Bug 1478879 - Define Range/Enum in terms of Iterator/ModIterator. r=luke
To reduce the code duplication.

--HG--
extra : rebase_source : fb14664f766fc51012e31e626b6313f10b69e9dc
2018-07-31 10:23:03 +10:00
Nicholas Nethercote
aea3d9d133 Bug 1478879 - Introduce Iterator and ModIterator in HashTable.h. r=luke
These basically duplicate the existing Range and Enum classes, but use more
familiar terminology, similar to the iterators we have for
PLDHashTable/nsTHashtable:

- Hash{Set,Map}::all()  Hash{Set,Map}::iter()
- Enum constructor      Hash{Set,Map}::modIter()
- Range::front()        Iterator::get()
- Range::popFront()     Iterator::next()
- Range::empty()        Iterator::done()
- Enum::mutableFront()  ModIterator::getMutable()
- Enum::removeFront()   ModIterator::remove()
- Enum::rekeyFront()    ModIterator::rekey()

The next patch will reduce the amount of code duplication.

--HG--
extra : rebase_source : 5787756b144bbaea98f381d5a128cb42edb82c41
2018-07-27 12:17:37 +10:00
Nicholas Nethercote
f97954cf65 Bug 1478879 - Remove zero-arg constructor for Range. r=luke
It's only used by InlineTable::Range, and can be avoided by using
mozilla::Maybe.

This also means Range::mTable can be changed from a pointer to a reference,
like Enum::mTable.

--HG--
extra : rebase_source : 35eb5b0bede361c2c765652e1e4c952f128702ef
2018-07-31 10:23:03 +10:00
Nicholas Nethercote
6141e31ef4 Bug 1479954 - Rename Hash{Set,Map}::sizeOf{In,Ex}cludingThis(). r=luke
In PLDHashTable the equivalent functions have a "Shallow" prefix, which makes
it clear that they don't measure things hanging off the table. This patch makes
mozilla::Hash{Set,Map} do likewise.

MozReview-Commit-ID: 3kwCJynhW7d

--HG--
extra : rebase_source : 9c03d11f376a9fd4cfd5cfcdc0c446c00633b210
2018-08-01 09:57:52 +10:00
Nicholas Nethercote
e0dbe1b052 Bug 1478896 - Fix HashTable.h style. r=froydnj
This patch converts HashTable.h from SpiderMonkey style to Gecko style.

It was created by first running `./mach clang-format -p mfbt/HashTable.h` to
fix the whitespace, and then doing manual patch-ups, the most significant of
which were:

- Adding braces around single-statement if/else/for/while blocks.

- Renaming class members to `mFoo` form and arguments to `aFoo` form.

- Converting `typedef Old New` to `using New = Old` throughout.

MozReview-Commit-ID: LJ1emPyuAjK
2018-07-31 13:39:31 +10:00
Nicholas Nethercote
234016c13e Bug 1477626 - Document some differences between mozilla::HashTable and PLDHashTable. r=Waldo
MozReview-Commit-ID: DB0KUy99DDM

--HG--
extra : rebase_source : 4d14c47c48cb821f6c69654c1c5d90c48f217e48
2018-07-26 20:15:55 +10:00
Nicholas Nethercote
b85493f609 Bug 1477626 - Move js::Hash{Set,Map} into MFBT. r=Waldo
The main change is that the patch copies js/public/HashTable.h to
mfbt/HashTable.h, and then changes it as follows.

- Changes `js` namespaces to `mozilla` (and removes some now-unnecessary
  `mozilla::` qualifiers).

- Changes the default AllocPolicy from the SpiderMonkey-specific
  `TempAllocPolicy` to the generic `MallocAllocPolicy`.

- Adds `#include "AllocPolicy.h"` (like mfbt/Vector.h).

- Changes `JS_DEBUG` use to `DEBUG`.

- Minor comment updates, as necessary.

js/public/HashTable.h is now tiny, holding just a few renamings of things from
the `mozilla` namespace into the `js` namespace to minimize churn elsewhere.
(Those renamings keep `TempAllocPolicy` as the default AllocPolicy for
js::Hash{Set,Map}.)

Also, various template specializations had to be moved from the `js` namespace
to the `mozilla` namespace to avoid compile errors.

MozReview-Commit-ID: GS9Qn9YeYDA

--HG--
rename : js/public/HashTable.h => mfbt/HashTable.h
2018-07-26 20:15:49 +10:00
Nicholas Nethercote
0f205a7ce0 Bug 1477626 - Move ScrambleHashCode() from js/src/Utility.h to mfbt/HashFunctions.h. r=Waldo
And use it in PLDHashTable.cpp.

MozReview-Commit-ID: BqwEkE0p5AG

--HG--
extra : rebase_source : bd9118e24b82add6ad1fdcb067a5f25b25e90201
2018-07-26 18:52:47 +10:00
Nicholas Nethercote
25a1140207 Bug 1477626 - Introduce mozilla::HashNumber and use it in various places. r=Waldo
Currently we have three ways of representing hash values.

- uint32_t: used in HashFunctions.h.

- PLDHashNumber: defined in PLDHashTable.{h,cpp}.

- js::HashNumber: defined in js/public/Utility.h.

Functions that create hash values with functions from HashFunctions.h use a mix
of these three types. It's a bit of a mess.

This patch introduces mozilla::HashNumber, and redefines PLDHashNumber and
js::HashNumber as synonyms. It also changes HashFunctions.h to use
mozilla::HashNumber throughout instead of uint32_t.

This leaves plenty of places that still use uint32_t that should use
mozilla::HashNumber or one of its synonyms, but I didn't want to tackle that
now.

The patch also:

- Does similar things for the constants defining the number of bits in each
  hash number type.

- Moves js::HashNumber from Utility.h to HashTable.h, which is a better spot
  for it. (This required changing the signature of ScrambleHashCode(); that's
  ok, it'll get moved by the next patch anyway.)

MozReview-Commit-ID: EdoWlCm7OUC

--HG--
extra : rebase_source : 5b92c0c3560eb56850cd8832f8ee514d25e3c16f
2018-07-26 18:52:46 +10:00
Jeff Walden
90533433e6 Bug 1478587 - Implement mozilla::Utf8AsUnsignedChars to centralize UTF-8-to-unsigned-chars casts and their justifications. r=froydnj
--HG--
extra : rebase_source : 98d7eb2e5bb183e39437fbfdbbee0f301ccb768a
2018-07-26 19:43:33 -07:00
shindli
774474fe26 Backed out 11 changesets (bug 1478892, bug 1478587) for build bustages in ../../../dist/bin/gdb-tests on a CLOSED TREE
Backed out changeset 185a4564afa5 (bug 1478892)
Backed out changeset c4b339472f4b (bug 1478587)
Backed out changeset 1a4669e53b46 (bug 1478587)
Backed out changeset aa8a0735f303 (bug 1478587)
Backed out changeset d1cd66e6d3c3 (bug 1478587)
Backed out changeset 63ccd68e1da3 (bug 1478587)
Backed out changeset 3a111fdc418d (bug 1478587)
Backed out changeset 756cbd89533a (bug 1478587)
Backed out changeset 9546bfc93c7a (bug 1478587)
Backed out changeset b335930f96b4 (bug 1478587)
Backed out changeset a47cd872a700 (bug 1478587)
2018-07-29 13:33:00 +03:00
Jeff Walden
03dd137c29 Bug 1478587 - Implement mozilla::Utf8AsUnsignedChars to centralize UTF-8-to-unsigned-chars casts and their justifications. r=froydnj
--HG--
extra : rebase_source : a24f75e7f1e3912b59d9cad31c9b20594e24f789
2018-07-26 19:43:33 -07:00
Jeff Gilbert
0e128a3868 Bug 1470985 - s/PodEqual/ArrayEqual/ from ArrayUtils.h. - r=waldo
We can't use memcmp to compare PODs, largely because of undefined
padding. The rest of the Pod* functions are fine though, since we're
replicating or zeroing PODs.

MozReview-Commit-ID: LSspAi8qCWw
2018-07-27 14:11:18 -07:00
Andreas Farre
b5730bd2b0 Bug 1445659 - Make it possible to store RefPtr<T> in AutoCleanLinkedList. r=froydnj
Add a trait method that AutoCleanLinkedList delegates to for calling
delete on non-refcounted list elements.

--HG--
extra : histedit_source : 5e8b05f348d734d9045621d858caed946853fc02
2018-06-13 06:25:00 +03:00
Jeff Walden
6060208b38 Bug 1478170 - Specialize SourceUnits::findWindowStart for UTF-8. r=arai
--HG--
extra : rebase_source : 6a9558e7fbf640c17cbbfb0e70d93ad24b3029ed
2018-07-18 22:46:48 -07:00
Jeff Walden
83ae856536 Bug 1478170 - Implement SourceUnits::peekCodePoint for UTF-8. r=arai
--HG--
extra : rebase_source : 7d256802f430ba813588fe9535630f67a30fbd56
2018-07-25 14:51:26 -07:00
Dylan Roeh
5fa70ba038 Bug 1441059 - Add cycle collection implementations for Maybe. r=bz 2018-07-17 10:34:58 -05:00
Brian Hackett
312bb81dda Bug 1470795 Part 2 - Record/replay API changes for replay debugger, r=froydnj.
--HG--
extra : rebase_source : 798587fb1675a3a02a0ef3b7606577c5b63cc216
2018-07-22 11:56:47 +00:00
Brian Hackett
3f2c401055 Bug 1465287 Part 9 - Allow copying IPDL messages, r=froydnj.
--HG--
extra : rebase_source : 25d5c75b5a5b07b545646535bd8da7b9fd9562dc
2018-07-22 11:53:23 +00:00
Brian Hackett
413abd40b5 Bug 1465452 Part 6 - Don't record assertion crashing flag, r=froydnj.
--HG--
extra : rebase_source : 994a8c6c16e20b81e2e112ef15fc08190678c440
2018-07-21 14:31:21 +00:00
Brian Hackett
2a875c0ad7 Bug 1207696 Part 4h - Don't record chaos mode counters, r=froydnj.
--HG--
extra : rebase_source : e37e6d4f124654ab99ef35acef2feb4d4e11a050
2018-07-21 14:25:36 +00:00
Brian Hackett
19be0573fa Bug 1207696 Part 4a - Make recording optional in mozilla::RefCounted, r=ehsan.
--HG--
extra : rebase_source : 4bf53b557247ac82933f4da70cccddafa6c2c7b2
2018-07-21 14:21:39 +00:00
Brian Hackett
be2b98186b Bug 1207696 Part 2b - Don't record activity in atomics unit tests, r=waldo.
--HG--
extra : rebase_source : 8fb15b2d0d73adf63ed3251f55c0cbbbcf0c9c18
2018-07-21 14:20:13 +00:00
Brian Hackett
47ccde0dda Bug 1207696 Part 2a - Atomics interface changes, r=waldo.
--HG--
extra : rebase_source : 39c1910c273357bdacbea7c15d9c49eccd2aeb2c
2018-07-21 14:17:16 +00:00
Brian Hackett
16cf11f43a Bug 1464903 Part 1 - Public record/replay API, r=froydnj.
--HG--
extra : rebase_source : 3841f170eac0e0916a667d541ab0ee20b1626f2e
2018-07-20 23:59:31 +00:00
Brian Hackett
f6b8e6f81c Bug 1309552 - Specify buffer size when freeing data in AllocPolicy, r=waldo.
--HG--
extra : rebase_source : f4e2d9f8831cf41c19d592ce252e87161f32250b
2018-07-20 23:58:34 +00:00
Jeff Walden
d243be25b1 Bug 1426909 - Abstract out mozilla::DecodeOneUtf8CodePoint for decoding a UTF-8 code point after having consumed a non-ASCII lead unit, with configurable error notification through optional user-provided functors. r=froydnj
--HG--
extra : rebase_source : 25836018b00b545a60969abccf40ce313d4da1af
2018-07-12 17:41:31 -07:00
Jeff Walden
9e8165ad5e Add support for char32_t to mozilla::IsIntegral. Found in the process of fixing another bug, no bug and r=me as so unbelievably trivial that it can't possibly deserve anything else
--HG--
extra : rebase_source : 457268f5749afbb84c50b86876df121c693a4e8f
2018-07-12 02:26:49 -07:00
Cameron McCormack
8a2341f976 Bug 1473771 - Part 2: Make LinkedList::Iterator work when element type inherits from multiple LinkedListElement<T>s. r=Waldo
MozReview-Commit-ID: 9dNTsSNyIYK

--HG--
extra : rebase_source : 60de5392ebf857d71e09a1bc7a68cc19edd66263
2018-07-06 10:56:08 +10:00
Cameron McCormack
cf90987901 Bug 1473771 - Part 1: Make LinkedList<T>::sizeOfExcludingThis work when element type inherits from multiple LinkedListElement<T>s. r=Waldo
MozReview-Commit-ID: KtqGkRKs68f

--HG--
extra : rebase_source : a4946439813dab4867e80e370e884f851289b4b7
2018-07-06 10:10:09 +10:00
Jeff Walden
90507ffb7a 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
--HG--
extra : rebase_source : 00760186060d7e72fac783af3fc5595a6057feca
2018-01-11 11:29:53 -07:00