Commit Graph

1718 Commits

Author SHA1 Message Date
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
Kris Maglione
2bbae5374b Bug 1470365: Part 1 - Add a compact, read-only, shared-memory string map class. r=erahm
This class implements a shared memory key-value store that fits into a single
memory mapped segment. All of the runtime data for its instances are stored in
the shared memory region, which means that memory overhead for each instance
in each process is only a few bytes.

Importantly, the key and value strings returned by this class are also
pointers into the shared memory region, which means that once an instance is
created, its memory cannot be unmapped until process shutdown.

For the uses I intend to put it to, this is a reasonable constraint. If we
need to use it for shorter-lived maps in the future, we can add an option to
return non-literal dependent strings that will be copied if they need to be
kept alive long term.

MozReview-Commit-ID: 5BwAaDsb7HS

--HG--
extra : rebase_source : b472fe628018f88a2c4d6b3de4b7143aeca55e14
extra : absorb_source : 5cdeb568cfd2b4a5a767191402e699e61e653b3b
2018-06-29 22:50:41 -07:00
Jacek Caban
03565d5406 Bug 1471177 - Use mingw-specific IFStream and OFStream implementation only when building againstd libstdc++. r=froydnj
MozReview-Commit-ID: 6aKGtK7B74z

--HG--
extra : rebase_source : 708e16c62c91aa482bffd6dbc74f6bfe944d4fec
2018-06-26 13:06:17 +02:00
Benjamin Peterson
1c04f1eba7 Bug 1470641 - Update already_AddRefed constructor comment. r=froydnj
RIP B2G.

--HG--
extra : rebase_source : 90de1c8ef7a273e87f869ad054a46aae23153a2f
2018-06-22 23:25:19 -07:00
Andi-Bogdan Postelnicu
4a5d0dd615 Bug 1453795 - MFTB - Initialize member fields in classes/ structures. r=waldo
--HG--
extra : rebase_source : e091acb3a9f60695b87ab9e3d348c5978680d2f8
2018-06-15 13:49:31 +03:00
Jeff Walden
5b41e725ee Bug 1469003 - Convert SegmentedVector to use a manually aligned |unsigned char| array for storage, using a clean C++11 idiom. r=froydnj
--HG--
extra : rebase_source : a456526a6596ce4e204d1f64a211c12cd9d41223
2018-06-18 11:55:41 -07:00
Jeff Walden
df09db05b8 Bug 1465808 - Update double-conversion to latest upstream. rs=froydnj
--HG--
extra : rebase_source : 89aeedf516a89aa5d6189bdbde8d1466e59f01f6
2018-06-12 22:12:42 -07:00
Alessio Placitelli
1ecfce2746 Bug 1467759 - Escape all the property names in JSONWriter. r=froydnj
Scalar property names (e.g. IntProperty) are already escaped correctly.
This patch escapes the collection property names (e.g. StartObjectProperty)
as well (and adds test coverage for it).

MozReview-Commit-ID: 68kkjPb2ZN7

--HG--
extra : rebase_source : b42939ccebb71fc73914ff595803b2d6c7df2715
2018-06-08 19:50:25 +02:00
Jeff Walden
784f62bdc2 Bug 1466928 - Make mozilla::SmallPointerArray compatible with the C++ object model. r=froydnj
--HG--
extra : rebase_source : e803add704e25f981bd8609405fc6f2967f40b05
2018-06-07 03:53:54 -07:00
Jeff Walden
c55625cdec Bug 1467336 - Implement mozilla::IsAscii to detect pure ASCII characters. r=froydnj
--HG--
extra : rebase_source : 1f6de2745234766d676178bdeafb9b82e48e51b5
2018-06-07 02:17:10 -07:00
Jeff Walden
701bad47cd Bug 1438212 - Implement mozilla::IsFloat32Representable using an algorithm that handles NaN correctly and doesn't sometimes invoke undefined behavior. r=froydnj
--HG--
extra : rebase_source : b4246ea818046b1e4100b90a3a371a866ea2b098
2018-06-06 16:03:47 -07:00
Jeff Walden
7bbef1fafc Bug 1465981 - Use memcpy instead of union-arm-punning (which has implementation-defined, desired behavior with gcc and presumably clang, and is not known to have problems on MSVC, but potentially could with other compilers) in BitwiseCast. r=froydnj
--HG--
extra : rebase_source : 686363576c84710ae0181afc32b05dee8b40a59b
2018-06-06 16:03:47 -07:00
André Bargull
f7acf7bc9c Bug 1466909 - Use AddLvalueReference for UniquePtr's operator*(). r=froydnj
--HG--
extra : rebase_source : df072aca7e79ce534c3bc620a352adfc92fbf245
2018-06-07 07:27:22 -07:00
Eric Rahm
51f133db96 Bug 1467048 - Add a version of CorruptionCanary for statics. r=froydnj
This adds 'CorruptionCanaryForStatics', which as the name implies is suitable
for use in objects that are statically declared. It has a trivial destructor
which allows us to avoid the need for static constructors.

--HG--
extra : amend_source : 27f8eff9ead21fde9f5f5d17f16c322d2c995a27
2018-06-06 14:50:17 -07:00
arthur.iakab
fd0ee7c9b8 Merge inbound to mozilla-central a=merge 2018-06-06 00:58:30 +03:00
Eric Rahm
572911732c Bug 1436768 - Add debug code to LazyLogModule. r=froydnj
--HG--
extra : rebase_source : bd70f788eb986b73eb70460337d5d7c3423c4e8a
extra : source : 82ef13b02416c8519178a7e8e08791b7b8dfcbdb
2018-05-09 11:16:27 -07:00
Miko Mynttinen
4c85ef17cc Bug 1465060 - Part 1: Fix warnings for std::move() use r=froydnj
MozReview-Commit-ID: HpdFXqQdIOO

--HG--
extra : rebase_source : 1e7eea4f2d4ec16ec0c559a8afb26976ddbf4d07
2018-06-01 17:59:07 +02:00
arthur.iakab
7e765f798b Backed out 2 changesets (bug 1465060) for build bustages on security/sandbox/linux/reporter/SandboxReporter.cpp
Backed out changeset 7c8905b6b226 (bug 1465060)
Backed out changeset 10446073eca8 (bug 1465060)
2018-06-03 19:25:41 +03:00
Miko Mynttinen
8d9dc85cd4 Bug 1465060 - Part 1: Fix warnings for std::move() use r=froydnj
MozReview-Commit-ID: HpdFXqQdIOO

--HG--
extra : rebase_source : 619d0e0ff63a2453c80f0c4d9beb906d43fa9b01
2018-06-01 17:59:07 +02:00
Emilio Cobos Álvarez
1e9c395548 Bug 1466168: Remove mozilla::Forward in favor of std::forward. r=froydnj
Same approach as the other bug, mostly replacing automatically by removing
'using mozilla::Forward;' and then:

  s/mozilla::Forward/std::forward/
  s/Forward</std::forward</

The only file that required manual fixup was TestTreeTraversal.cpp, which had
a class called TestNodeForward with template parameters :)

MozReview-Commit-ID: A88qFG5AccP
2018-06-02 09:33:26 +02:00
Emilio Cobos Álvarez
fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Henri Sivonen
c3fcb6ab2c Bug 1466475 - Make mozilla::Span produce aligned bogus pointers per new Rust rules. r=froydnj
MozReview-Commit-ID: JFVSRu53Geh

--HG--
extra : rebase_source : a9436aef554b6e892195324744f135d2b65086d5
2018-06-04 12:59:46 +03:00
Daniel Stenberg
0506997177 bug 1464999 - make SplayTree.remove clear mRight and mLeft r=froydnj
... to allow a user to remove() an entry, update the values and
re-insert() it into a tree.

MozReview-Commit-ID: GrSY90Q3ugt

--HG--
extra : rebase_source : 9d8876064f9e3d5b9e4249936a4c999b74fcc9ad
2018-05-29 09:41:24 +02:00
Paul Adenot
515134e9a0 Bug 1454385 - Add a single producer single consumer lock and wait free queue to mfbt/. r=froydnj
MozReview-Commit-ID: 6Dq0GQtYgv2

--HG--
extra : rebase_source : 67bc4245a61c15738e3a6467a03b41e9e29af9ce
2018-04-13 17:14:05 +02:00
Csoregi Natalia
acd92af57e Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-05-23 01:02:30 +03:00
Alex Gaynor
3511d14f46 Bug 1462912 - fixed BufferList::Extract to handle the case where the call consumes the entirety of the BufferList; r=froydnj
MozReview-Commit-ID: 1LWODn8JaNL

--HG--
extra : rebase_source : 29cea444a49eb5e2ade33214ff52d6419949337e
2018-05-22 13:04:59 -04:00
Kris Maglione
d92e63a9a9 Bug 1463299: Add RefPtr::forget special case for ambiguous nsISupports casts. r=bz
When we use RefPtr with nsISupports sub-classes, it's usually because the type
cannot be unambiguously cast to nsISupports. We already have a ToSupports
generic function to resolve ambiguity in these cases, so we may as well use
it here.

MozReview-Commit-ID: FaHhPKAPn6j

--HG--
extra : rebase_source : dd8f3707bdebedfe559aed0caf2c3b0c49163735
extra : histedit_source : 9805787a169329b9c739dfa456cfe6a61a22b7d7
2018-05-21 17:23:10 -07:00
shindli
4ff26c26f4 Merge inbound to mozilla-central. a=merge 2018-05-22 00:29:52 +03:00
Nathan Froyd
b29b040b36 Bug 1410186 - turn Maybe assertions into diagnostic assertions; r=bkelly
We out-of-line the relevant functions because assertions can generate
quite a bit of code, and we'd rather let the compiler determine if these
functions should be inlined now.
2018-05-21 10:03:59 -04:00
Bogdan Tara
2aa42f2cab Backed out changeset c82274a23aea (bug 1410186) on request by igoldan a=backout 2018-05-21 16:53:30 +03:00
Masatoshi Kimura
1c639cc220 Bug 1463011 - Constexpr-ify mozilla::NotNull r=njn
MozReview-Commit-ID: EyXmRskjtfU

--HG--
extra : rebase_source : bd86a8126d1f2098c436f5e61106857c8b068c04
2018-05-21 23:03:16 +09:00
Alex Gaynor
a13531321e Bug 1456189 - Simplify BufferList::Extract to make the lifetimes clearer. r=froydnj 2018-05-18 18:59:00 -04:00
Gurzau Raul
841689c6d7 Backed out changeset 1d0aa0c581cf (bug 1456189) for bustage on selftest.py on a CLOSED TREE 2018-05-18 01:00:26 +03:00
Alex Gaynor
bb3ec615d6 Bug 1456189 - Simplify BufferList::Extract to make the lifetimes clearer. r=froydnj 2018-05-17 17:16:43 -04:00
Tom Ritter
4c56c059bb Bug 1460645 Avoid the thread_local keyword for MinGW and instead use __thread r=froydnj
MozReview-Commit-ID: 5RPwQVatThs

--HG--
extra : rebase_source : 0ad9a69f51529c6a35dc76555e4cb5d37a087a28
2018-05-10 11:11:19 -05:00
Noemi Erli
5ffb086f4a Backed out changeset 98e368b5c4be (bug 1463035) for failures in tools/profiler/tests/chrome/test_profile_worker.html on a CLOSED TREE 2018-05-22 03:16:44 +03:00
Mike Hommey
c51cee4730 Bug 1463035 - Remove MOZ_SIGNAL_TRAMPOLINE. r=jchen
For some reason, GNU as is not happy with the assembly generated after
bug 1238661 anymore on Debian armel.

OTOH, as mentioned in bug 1238661 comment 4, we actually don't need this
workaround anymore, so let's just kill it.

--HG--
extra : rebase_source : 6fd06832136d4f840c65f74b63f1c1bec48d525d
2018-05-21 12:04:22 +09:00
Nathan Froyd
d0ba1c83de Bug 1410186 - turn Maybe assertions into diagnostic assertions; r=bkelly
We out-of-line the relevant functions because assertions can generate
quite a bit of code, and we'd rather let the compiler determine if these
functions should be inlined now.
2018-05-15 16:34:59 -04:00
Ryan VanderMeulen
1e5a06e4b0 Bug 1460316 - Update lz4 to version 1.8.2. r=froydnj 2018-05-09 12:16:28 -04:00
Aaron Klotz
84feb9c523 Bug 1460057: Update WindowsVersion with latest Windows 10 build numbers; r=froydnj 2018-05-07 17:24:51 -06:00
Gerald Squelart
9b8e47ab12 Bug 1448494 - NonDereferenceable<T> wraps a T* and prevents dereferencing ops - r=froydnj
NonDereferenceable denotes the intent that a pointer will (most likely) not be
dereferenced, but its numeric value may be used for e.g. logging purposes.

Dereferencing operations are explicitly disabled to avoid unintentional misuses.
Casting is still possible between related types (same as with raw pointers),
but pointers stay safely stored inside NonDereferenceable objects. These casts
do not trigger `clang++ -fsanitize=vptr` errors.

MozReview-Commit-ID: 5885pB7hSFR

--HG--
extra : rebase_source : 3c4011da64d84f1b19991742b76bafbffa90d590
2018-03-28 17:48:53 +11:00
Masatoshi Kimura
2b6d5d5d7e Bug 1442275 - Implement a path charset agnostic wrapper for PR_LoadLibraryWithFlags. r=froydnj
MozReview-Commit-ID: 5rjmcv4kz9x

--HG--
extra : rebase_source : b57c7e79ceaa2dc3d65f52ee8f665c640dd1f41c
2018-04-24 00:31:53 +09:00
Jon Coppeard
edcb15ad07 Bug 1456875 - Add const iterators for LinkedList r=Waldo 2018-04-30 10:21:31 +01:00
Jeff Walden
04d21ccac0 Bug 1451248. r=jorendorff, r=bz
--HG--
extra : rebase_source : e26439a5954162bdaf332fbd63d623a3810e19e0
2018-04-25 19:40:09 -07:00
Alex Gaynor
3e8fd2dc07 Bug 1450232 - in IPC, check that lengths fit in the available data before allocating data; r=mccr8
There are three things we want to be true:

a) If the child sends a large value and the parent can't allocate enough space
   for it we use an infallible allocation so the parent dies with an OOM.
b) If a fuzzer generates (huge-length, small-data) we don't try to allocate
   huge-length bytes; knowing that the read will fail.
c) No fuzzer-specific branches in the core IPC serialization code.

Finally, this makes (huge-length, small-data) consistent with other cases where
the data is potentially truncated: ReadParam returns false.

MozReview-Commit-ID: 6nDKrw5z4pt

--HG--
extra : rebase_source : 58372d29139e9545a6ed2852c7243affeab6fdb7
2018-04-19 16:53:29 -04:00
Nathan Froyd
9362ad6e83 Bug 1454052 - make MakeScopeExit a MOZ_MUST_USE function; r=gerald
Otherwise, one can do thinkos like:

  MakeScopeExit(...);

and the scope exiting function will execute much earlier than the
intended:

  auto guard = MakeScopeExit(...);
2018-04-18 12:14:18 -04:00
Margareta Eliza Balazs
dbef13782c Backed out 2 changesets (bug 1451278) for breaking windows pgo builds a=backout
Backed out changeset ac685df07bfc (bug 1451278)
Backed out changeset 5944ccd5060d (bug 1451278)
2018-04-16 21:41:03 +03:00
Nicholas Nethercote
e1318b1d03 Bug 1451278 - Remove ConstExpr hash functions. r=froydnj
MozReview-Commit-ID: L6yRyt4DZRR

--HG--
extra : rebase_source : 2d56a50b1a99e66c397165b9b851e23ca66d97a0
2018-04-16 08:37:15 +10:00
Jeff Walden
821db93ccc Bug 1453456 - Replace nsCRT::IsAscii{Alpha,Digit} with mfbt/TextUtils.h versions. r=froydnj
--HG--
extra : rebase_source : b31986c0e6828be79442cfb0cf369eb80c232139
2018-04-12 20:19:30 -07:00
Jeff Walden
9ea9bcc2df Bug 1453456 - Add/use more ASCII alphanumeric testing/conversion functions from MFBT in SpiderMonkey code in various places. r=froydnj
--HG--
extra : rebase_source : b4e05102cce2ad5dabb973a3968f1112376da594
2018-04-10 11:42:54 -07:00
Tom Bannister
988d18881f Bug 1434710 - Replaced all instances of mozilla::IndexSequence, mozilla::MakeIndexSequence and mozilla::IndexSequenceFor with std::index_sequence, std::make_index_sequence and std::index_sequence_for and removed mfbt/IndexSequence.h. r=botond
MozReview-Commit-ID: 1Ema7TUNr5v

--HG--
extra : rebase_source : e5bb164dbe19993214e8c16f92b0a1f5d2ff3fa1
2018-04-09 21:12:13 +10:00
Sebastian Hengst
0819f35e51 Backed out 4 changesets (bug 525063) on request from Andi. a=backout
Backed out changeset 516c4fb1e4b8 (bug 525063)
Backed out changeset 6ff8aaef2866 (bug 525063)
Backed out changeset bf13e4103150 (bug 525063)
Backed out changeset d7d2f08e051c (bug 525063)
2018-04-13 16:01:28 +03:00
Masatoshi Kimura
caada858fb Bug 1451722 - Constexpr-ify mozilla::Span more. r=hsivonen
MozReview-Commit-ID: B7sxH5BAdp6

--HG--
extra : rebase_source : 3e7bf5424478cdff6dfd1c25b9808a41cfb6e0d3
2018-04-05 21:55:00 +09:00
Tristan Bourvon
a3a77c0312 Bug 525063 - Initialize uninitialized class attributes in m-c. r=ehsan 2018-04-10 21:11:02 +02:00
Jeff Walden
be8ccd5a6b Bug 1452619 - Implement mozilla::IsAsciiAlpha. r=froydnj
--HG--
extra : rebase_source : fd1e3284d293edad0bd96cc378eeeeb1bc2c8829
2018-04-09 12:02:43 -07:00
Nicholas Nethercote
374e333b76 Bug 1451658 - Add MOZ_STATIC_CLASS. r=mystor
MozReview-Commit-ID: HlbfoQypMcI

--HG--
extra : rebase_source : 3f91229f7190f04a9f512a6ac594674e05829039
2018-04-10 17:31:31 +10:00
Nathan Froyd
cc035fe9e0 Bug 1444125 - don't poison Maybe on construction; r=gerald
This behavior is pretty heavy-handed and degrades performance.
2018-04-10 13:46:00 -04:00
Nathan Froyd
e7e0eac6bc Bug 1444125 - work harder to generate good code for Maybe poisoning; r=gerald 2018-04-10 13:46:00 -04:00
Sylvestre Ledru
99f0e1b624 Bug 1447480 - Add support of MOZ_FALLTHROUGH_ASSERT without any argument r=hsivonen
MozReview-Commit-ID: 6xrdrggcVFR

--HG--
extra : rebase_source : f53d9a62e828d65469c42c79a468b5bea2e8b645
2018-04-05 11:42:23 +02:00
Jonathan Kew
c66fb1e660 Bug 1451296 - Make enabling of font-variation-settings and font-optical-sizing properties dependent on adequate platform support at runtime. r=lsalzman 2018-04-05 18:53:56 +01:00
Masatoshi Kimura
3560ad5b6e Bug 1449094 - Implement constexpr mozilla::AllOf. r=froydnj
MozReview-Commit-ID: KvKY9CMqfww

--HG--
extra : rebase_source : 5e548884d3a331b5dc8704a690ccbd532ac2534a
2018-03-28 00:01:08 +09:00
Henri Sivonen
5f81ea7f50 Bug 1448591 - Make MakeStringSpan(nullptr) return an empty span. r=froydnj.
MozReview-Commit-ID: EyuLeWjEL7w

--HG--
extra : rebase_source : a40b671692db0e7faa7772654cb4b1ae75bd30a2
2018-03-24 21:36:00 +02:00
Bogdan Tara
8b1819017d Backed out changeset 577c20417552 (bug 1449094) for failing /builds/worker/workspace/build/src/mfbt/tests/TestAlgorithm.cpp CLOSED TREE 2018-03-30 01:54:04 +03:00
Masatoshi Kimura
316aea87d9 Bug 1449094 - Implement constexpr mozilla::AllOf. r=froydnj
MozReview-Commit-ID: KvKY9CMqfww

--HG--
extra : rebase_source : 15efd61da5b66d6bbb4655cf95936c5d36473a82
2018-03-28 00:01:08 +09:00
Emilio Cobos Álvarez
1f4687f9fc Bug 1448387: Use alignof() in HasFreeLSB. r=froydnj
This doesn't seem relevant for the differences between MOZ_ALIGNOF and alignof
mentioned in bug 1288016.

MozReview-Commit-ID: 8f9Ui7Aecfj
2018-03-23 19:09:42 +01:00
Jeff Walden
36462015eb Bug 1446592 - Update our local double_conversion to tip. Also remove one local patch as unnecessary as of MSVC 2010, hacking around prior versions' lack of <stdint.h> support. r=froydnj
--HG--
extra : rebase_source : ae21e264fc97373f42ea4a01189caed48e785e9c
2018-03-16 20:25:17 -07:00
Nicholas Nethercote
cecefaa849 Bug 1443706 - Introduce ConstExprHashString(const char16_t*). r=jwalden
This is a `constexpr` alternative to HashString(const char16_t*). We can't make
HashString(const char16_t*) itself `constexpr` because HashUntilZero(const T*)
isn't in a form that older compilers (like GCC 4.9) allow to be made
`constexpr`. (The trick to satisfying those compilers is to use recursion
instead of iteration, to get the function into a single `return` statement.)

This requires making a bunch of other functions `constexpr` as well. It also
requires adding MOZ_{PUSH,POP}_DISABLE_INTEGRAL_CONSTANT_OVERFLOW_WARNING
macros to avoid some MSVC weirdness.

The introduction of RotateLeft5() partly undoes one of the patches from bug
1443342, but that's unavoidable.

This change will help with static allocation of static atoms (bug 1411469).

MozReview-Commit-ID: 7r3PnrQXb29
2018-03-08 10:27:14 +11:00
Jeff Walden
0eefeabe25 Bug 1445024 - Implement mozilla::WrappingSubtract. r=froydnj
--HG--
extra : rebase_source : 026268df1cb1cfc56873e61834ea90257645c508
2018-03-06 19:22:20 -08:00
Jeff Walden
83186da179 Bug 1445024 - Consolidate some WrappingOperations.h comments and implementation bits. r=froydnj
--HG--
extra : rebase_source : 7efdbb7fa034645f6699954810c52709e54e29fe
2018-03-12 12:56:39 -07:00
Jeff Walden
52d9907ee0 Bug 1445024 - Implement mozilla::WrappingAdd. r=froydnj
--HG--
extra : rebase_source : 3514c6487305e64ce19060cb05d39bc6eb2fd912
2018-03-06 19:21:58 -08:00
Narcis Beleuzu
298d1d55b5 Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-03-13 12:36:54 +02:00
Emilio Cobos Álvarez
2125f0fbd4 Bug 1444416: Handle references in the "can run script" checker. r=mystor
MozReview-Commit-ID: 8F9HjiFqbGN

--HG--
extra : rebase_source : 03d49b9a605ff5eade81a814b0903f81d87720ab
2018-03-09 17:51:59 +01:00
Jeff Walden
15bf6fd876 Bug 1442967 - Boo, MSVC warns when a cast will truncate a numeric constant. Arguably a desirable warning generally, but here we specifically intend the cast to narrow, so disable the warning. r=me in a CLOSED TREE 2018-03-12 19:20:42 -07:00
Jeff Walden
fc7dc7e60e Bug 1442967 - When doing a comparison against a 64-bit constant in code run only in 64-bit builds, but compiled in 32-bit builds, cast it to uintptr_t so that the comparison isn't clearly false in 32-bit builds. rs=froydnj by suggestion on IRC
--HG--
extra : rebase_source : 2be98a1a0c436664ea0fa3ef8be55a9fb71541af
2018-03-12 13:36:44 -07:00
Jeff Walden
1b063823be Bug 1442967 - Futz with a uintptr_t (as uint32_t) == uint64_t comparison to evade constantly-false compiler warnings in 32-bit builds. r=jorendorff 2018-03-09 21:59:08 -08:00
Nathan Froyd
1a68724fe3 Bug 1442304 - make already_AddRefed returnable in registers in non-DEBUG Unix builds; r=glandium,tjr
This change saves ~150k (!) of binary size on x86-64 Linux.
2018-03-07 14:27:28 -05:00
Jeff Walden
212527bdf1 Bug 1443342 - Remove XorShift128PlusRNG.h from integer-overflow sanitizer blacklisting. r=froydnj
--HG--
extra : rebase_source : 6ecedb849aa51cffc493017661025365ecdb1eb2
2018-03-06 09:33:52 -08:00
Jeff Walden
ba5975180b Bug 1443342 - Opt one HashFunctions.h function out of integer-overflow sanitizing and don't blacklist HashFunctions.h. r=froydnj
--HG--
extra : rebase_source : a33b53362c1f9ce96df22a321990a45a224af9d6
2018-03-01 17:11:33 -08:00
Jeff Walden
75f86d4202 Bug 1443342 - Remove HashFunctions.h's RotateBitsLeft32 and use the general RotateLeft function instead. r=froydnj
--HG--
extra : rebase_source : 88ad42c5757d9f1f0df5590c647a840061523318
2018-03-01 17:05:58 -08:00
Dorel Luca
0e437cae41 Merge mozilla-central to mozilla-inbound 2018-03-06 20:46:45 +02:00
Gerald Squelart
a1f5bed9e9 Bug 1443367 - Rework MakeNotNull to build with VS 2017 15.6 - r=njn
VS 2017 15.6 (March 2018) doesn't seem to understand
`*DeclVal<SharedFontList*>()` anymore.
To work around this issue, the pointed-to type is now extracted in a separate
struct, for which we provide a specialization for raw pointers, so we don't
encounter the shaky `*DeclVal<T*>()` statement anymore.

MozReview-Commit-ID: FuslManbfdB

--HG--
extra : rebase_source : be3813aa9a028e6891cb3de1fc4faae5bde0348e
2018-03-06 20:27:27 +11:00
Nathan Froyd
08e65e40ba Bug 1443265 - make already_AddRefed a MOZ_TEMPORARY_CLASS; r=mystor 2018-03-05 16:12:41 -05:00
Nathan Froyd
2bd0c8e0a2 Bug 1414901 - part 2 - poison Maybe<T> instances when not in use; r=Waldo 2018-03-06 11:35:50 -05:00
Nathan Froyd
2ac6e45b48 Bug 1414901 - part 1b - eliminate alignment requirements for poisoning memory; r=Waldo
mozWritePoison secretly depended on the passed-in pointer being aligned
as though it were a pointer to uintptr_t, as it used bare stores to
C-casted pointers to accomplish poisoning.  But this is an unnecessary
limitation: we can use memcpy and rely on the compiler to appropriately
inline the store to an unaligned store instruction if necessary.
2018-03-06 11:35:50 -05:00
Nathan Froyd
450618b0af Bug 1414901 - part 1a - make mozWritePoison respect its documentation; r=Waldo
The documentation for mozWritePoison says that only an even number of
sizeof(uintptr_t) bytes are overwritten; any trailing bytes are not
touched.  This documentation doesn't correspond to how the function
actually works.  The function as written will happily overwrite trailing
bytes and any bytes not contained in the object, if the passed-in size
isn't divisible by sizeof(uintptr_t).  Let's fix that.
2018-03-06 11:35:50 -05:00
Jason Orendorff
ef8693d6f2 Bug 1413049 - Part 1a: In a test, zero-pad hex integer constants to the width of their type. r=Waldo.
--HG--
extra : rebase_source : dfd3f1a00470856a177a526d385dd0f1b7d0ec38
2018-03-01 20:06:37 -06:00
Jason Orendorff
2418dfb4b3 Bug 1413049 - Part 1: Add methods to EndianUtils for pointer-sized integers. r=Waldo.
--HG--
extra : rebase_source : 115e40ecaee589b07e4ff9534694e56af7690e9b
2018-03-01 11:05:13 -06:00
Jeff Walden
25a7df6306 Bug 1441657 - Implement mozilla::WrappingMultiply. r=froydnj
--HG--
extra : rebase_source : 57d1796976a25597ee4dda90561d40debc6a9fc9
2018-02-15 17:36:55 -08:00
Jeff Walden
b0074d3a7d Bug 1441657 - Create a new mozilla/WrappingOperations.h header to contain implementations of common math operations with well-defined wraparound semantics. r=froydnj
--HG--
rename : mfbt/MathAlgorithms.h => mfbt/WrappingOperations.h
rename : mfbt/tests/TestMathAlgorithms.cpp => mfbt/tests/TestWrappingOperations.cpp
extra : rebase_source : 552a0f17d7ba2ad6229d45fd2945592aceabb354
2018-02-15 17:36:50 -08:00
Blake Kaplan
32db9fed96 Bug 1404297 - Add a move constructor to SegmentedVector. r=smaug
Given that we have a SegmentedVector of nsCOMPtrs, it's probably worth
avoiding copying it.

MozReview-Commit-ID: GHyfVLrdnlQ

--HG--
extra : rebase_source : 75df805d8b2df32b76ee77b95ced625f20331744
2018-03-01 11:26:54 -08:00
Masatoshi Kimura
6648e322a9 Bug 1441112 - Stop including <iostream> in FStream.h. r=froydnj
MozReview-Commit-ID: 8SBsucRbL3i

--HG--
extra : rebase_source : 385a9fafbc07753c1273ed25b09e7c00edb5fe36
2018-02-28 21:45:04 +09:00
Sylvestre Ledru
b7b13979a7 Bug 1370794 - Use bool instead of integer being casted to bool r=Ehsan
MozReview-Commit-ID: lUVFeU0Y0p

--HG--
extra : rebase_source : c2dac9c0e0345111f68aea2b9e359ad94086430d
2018-02-07 15:15:28 +01:00
Jeff Walden
1b16de9738 Bug 744965 - Implement mozilla::NumberEqualsInt32 in a way that doesn't depend on undefined behavior casting an out-of-range floating point number to int32_t. r=froydnj
--HG--
extra : rebase_source : dc4781e2a31ee0e75fc62951cbdc71eaa9fd7b1c
2018-02-15 17:22:14 -08:00
Jeff Walden
5472050225 Bug 1438750 - Remove mfbt/double-conversion.h, and change existing users to instead do #include "double-conversion/double-conversion.h" themselves. r=froydnj on a CLOSED TREE
--HG--
extra : amend_source : 72f066d9c75ae5ccd4d1e929896a2b12aa0ddc8c
2018-02-21 10:15:43 +02:00
Cosmin Sabou
48de1e7807 Backed out changeset 1fcc972d445b (bug 744965) for assertion failures on TestFloatingPoint.cpp on a CLOSED TREE 2018-02-21 10:12:45 +02:00
Gurzau Raul
14b89a5ae5 Backed out changeset 66c1c1596bea (bug 1438750) for assertion failure at TestFloatingPoint.cpp on Windows platform 2018-02-21 08:29:50 +02:00
Jeff Walden
2b6c4bedad Bug 1438750 - Remove mfbt/double-conversion.h, and change existing users to instead do #include "double-conversion/double-conversion.h" themselves. r=froydnj
--HG--
extra : rebase_source : 76ecf4ab0caf7a5367636a866512931d3fd9b962
2018-02-15 21:02:53 -08:00
Jeff Walden
e77ef331a3 Bug 744965 - Implement mozilla::NumberEqualsInt32 in a way that doesn't depend on undefined behavior casting an out-of-range floating point number to int32_t. r=froydnj
--HG--
extra : rebase_source : d6d890b7b20d93297f575abe838e8619418ea545
2018-02-15 17:22:14 -08:00
Sylvestre Ledru
78c25c6d82 Bug 1437482 - gcc 8 has no-sanitize but not the {un,}signed-integer-overflow option r=Waldo
MozReview-Commit-ID: EfRYhaISZfL

--HG--
extra : rebase_source : 2a5f32a71be4688d260786f6f762183f38b682a8
2018-02-12 12:07:52 +01:00
Masatoshi Kimura
9bbb2153d4 Bug 1428614 - Implement mozilla::IFStream and mozilla::OFStream. r=froydnj
This is drop-in replacements of std::ifstream and std::ofstream, but supports
widechar filenames on Windows. This is just an alias of std::ofstream on other
platforms.

MozReview-Commit-ID: FHNatG5595k

--HG--
extra : rebase_source : 0805153dd13907a6c3b6971bfc0b499a31416b9a
extra : intermediate-source : 3113df1e69bf7444105953df8610b8bbf5d4d41e
extra : source : 750263b126963d2634a89de0a2aac63efa4b49e6
2018-01-07 18:31:31 +09:00
Jeff Walden
0e77ce073b Bug 1435484 - Split the integer-overflow blacklist into two blacklists, one for signed integer overflow and one for unsigned integer overflow, and rename both configure flags to be clearer. r=decoder, r=froydnj
--HG--
rename : build/sanitizers/ubsan_blacklist_int.txt => build/sanitizers/ubsan_signed_overflow_blacklist.txt
rename : build/sanitizers/ubsan_blacklist_int.txt => build/sanitizers/ubsan_unsigned_overflow_blacklist.txt
2018-02-02 21:25:31 -08:00
Eric Rahm
61c1f85e41 Bug 1434689 - Part 2: Add MOZ_TEMPORARY_CLASS attribute. r=mystor
This adds the MOZ_TEMPORARY_CLASS attribute to Attributes.h.

--HG--
extra : rebase_source : aea2ac53705863a839bcf11245b67a9fc1da08bf
2018-01-31 15:22:42 -08:00
Nathan Froyd
46ffc41619 Bug 1435382 - fix documentation for AlignedElem; r=me
Sub-byte alignment isn't really a thing.

DONTBUILD because documentation fixes are always safe, amirite?
2018-02-02 15:24:51 -05:00
Tom Ritter
41a1a6c9b0 Bug 1433971 Clean up Assertions.h with respect to Unused Attributes r=froydnj
In Bug 1393538 I renamed MOZ_STATIC_ASSERT_UNUSED_ATTRIBUTE to MOZ_UNUSED_ATTRIBUTE,
moved it out of it's #define depth, and used it in toolkit. I also orphaned a
comment.

This was wrong. MOZ_UNUSED_ATTRIBUTE was basically identical to MOZ_MAYBE_UNUSED
which exists in Attributes.h (because it is an attribute, not an assertion.)

Undo that wrong thing: restore MOZ_STATIC_ASSERT_UNUSED_ATTRIBUTE to the correct
place, have toolkit use the correct macro, and remove MOZ_UNUSED_ATTRIBUTE.

MozReview-Commit-ID: 5BWWsXgbm9i

--HG--
extra : rebase_source : d07156068c877bf57d400bc6a71e115b7f1aef31
2018-01-29 11:36:19 -06:00
David Major
b0f6b50b37 Bug 1422372: Mark MOZ_NoReturn as MOZ_MAYBE_UNUSED. r=Waldo 2018-01-30 14:15:51 +13:00
Daniel Zielas
e80f2e7469 Bug 1427229 - Perform validation when sending an EnumSet over IPC. r=botond,froydnj
MozReview-Commit-ID: Cmugi1ldc1Z

--HG--
extra : amend_source : 88b792772ce7948172a68fda03d6d61de66347de
2018-01-21 21:23:21 +01:00
Jeff Walden
51f84c53a8 Bug 1432646 - Followup bustage fix for compilers that warn (error with -Werror-alike) when negating an unsigned expression. r=bustage in a CLOSED TREE 2018-01-27 00:25:40 -08:00
Jeff Walden
8314131139 Bug 1432646 - Implement mozilla::WrapToSigned. r=froydnj
--HG--
extra : rebase_source : 2c1a216830767da789eea59d00b55a45845f4d60
2018-01-25 14:48:01 -08:00
Masatoshi Kimura
17fb30182d Bug 1428543 - Add mozilla::filesystem::Path and use it in nsIFile. r=froydnj
Currently only |value_type| is implemented.

MozReview-Commit-ID: 1mejzvkuako

--HG--
extra : rebase_source : 69e08073adbb9a866db26e515702a0659ece0a70
extra : intermediate-source : 3696381ddfdc19ab2f901ca4247e1cb4efb27731
extra : source : 35d760da1d73dd51614f434c26e5ce80ff690829
2017-12-28 03:03:35 +09:00
Ryan VanderMeulen
77a9b22fbc Bug 1430708 - Update lz4 to version 1.8.1.2. r=froydnj 2018-01-22 08:48:44 -05:00
Chris Peterson
37efe4d0e6 Bug 1428535 - Add missing override specifiers to overridden virtual functions. r=froydnj
MozReview-Commit-ID: DCPTnyBooIe

--HG--
extra : rebase_source : cfec2d96faeb11656d86d760a34e0a04cacddb13
extra : intermediate-source : 6176724d63788b0fe8caa3f91607c2d93dbaa7ec
extra : source : eebbb0600447f9b64aae3bcd47b4be66c02a51ea
2017-11-05 19:37:28 -08:00
Masatoshi Kimura
f4cb55c630 Bug 1428541 - Make char16ptr_t::operator bool() explicit. r=froydnj
clang-cl fails to build without this change due to ambiguous call.

MozReview-Commit-ID: 22x5PCsG221

--HG--
extra : rebase_source : 93d2d50abc126286ad78c1f3700fe358c507a826
extra : intermediate-source : a9c64eaa326a2c694456d2e8907074f75b66c645
extra : source : c0b55d2093f59a8dabf2640106befa0dae516906
2017-12-24 23:33:56 +09:00
Sylvestre Ledru
c911c249ec Bug 1424866 - Update the comment for fix a warning: unnecessary parentheses in declaration of 'type name' r=gerald DONTBUILD 2018-01-04 11:59:13 +01:00
Sylvestre Ledru
530203c95e Bug 1424866 - Fix a warning: unnecessary parentheses in declaration of 'type name' r=gerald
MozReview-Commit-ID: CBOTKHgqDfV

--HG--
extra : rebase_source : cc9d339008e7024b5406153bad37e4d717c7ae59
2018-01-03 17:43:04 +01:00
Valentin Gosu
679361e438 Bug 1424834 - LinkedList::sizeOfExcludingThis should use ConstRawType instead of T* r=njn
MozReview-Commit-ID: 2EM9cEOAkIl

--HG--
extra : rebase_source : 05ebe36ecdaacbaf26bd1b6e23715035996f88b4
2017-12-20 01:13:53 +01:00
Dorel Luca
d9227411a0 Backed out 2 changesets (bug 1424834) for AddressSanitizer failure r=backout a=backout
Backed out changeset 00e1d58aedfe (bug 1424834)
Backed out changeset 9b69f2b7d373 (bug 1424834)
2017-12-19 13:59:02 +02:00
Valentin Gosu
9d89df19e4 Bug 1424834 - LinkedList::sizeOfExcludingThis should use ConstRawType instead of T* r=njn
MozReview-Commit-ID: 2EM9cEOAkIl

--HG--
extra : rebase_source : b3950ed06e1bc014fff9aa1deb5c2387fb2eb5bb
2017-12-15 15:46:31 -06:00
Cosmin Sabou
f0ab0b072a Backed out 2 changesets (bug 1424834) for leaks at netwerk/dns/nsHostResolver.cpp:352 r=backout a=backout
Backed out changeset 2503df83bbd9 (bug 1424834)
Backed out changeset 49cc08386f17 (bug 1424834)
2017-12-18 11:52:06 +02:00
Valentin Gosu
a659128162 Bug 1424834 - LinkedList::sizeOfExcludingThis should use ConstRawType instead of T* r=njn
MozReview-Commit-ID: 2EM9cEOAkIl

--HG--
extra : rebase_source : b3950ed06e1bc014fff9aa1deb5c2387fb2eb5bb
2017-12-15 15:46:31 -06:00
Masatoshi Kimura
456098425e Bug 1424103 - constexpr-ify mozilla::Span. r=hsivonen
MozReview-Commit-ID: 4e98Aer9V1k

--HG--
extra : rebase_source : 44f87677a4918aea4abaf2721895e48045267c7b
2017-12-08 23:20:56 +09:00
Sylvestre Ledru
4591d82b23 Bug 1394734 - Replace CONFIG['CLANG*'] by CONFIG['CC_TYPE'] r=glandium
MozReview-Commit-ID: HbF5oT5HW6f

--HG--
extra : rebase_source : eca479b6ae4bff7f600d1cdb39e11ac2057e4e79
2017-12-07 22:09:38 +01:00
Sylvestre Ledru
5de63ef061 Bug 1394734 - Replace CONFIG['MSVC'] by CONFIG['CC_TYPE'] r=glandium
MozReview-Commit-ID: 5orfnoude7h

--HG--
extra : rebase_source : 1ed9a6b56e1d27221a07624767a7fb0e6147117f
2017-12-08 13:46:13 +01:00
Sylvestre Ledru
9bfe27d903 Bug 1394734 - Replace CONFIG['GNU_C*'] by CONFIG['CC_TYPE'] r=glandium
MozReview-Commit-ID: 7duJk2gSd4m

--HG--
extra : rebase_source : 7312fe276e561e8c034a5f6749774ae812727f9c
2017-12-07 22:09:15 +01:00
Boris Zbarsky
be29e2b41d Bug 1418558 part 3. Make MOZ_KnownLive compile even when not doing a static analysis build. r=mystor
MozReview-Commit-ID: HNF3KfXaEIB
2017-12-05 11:18:16 -05:00
Jeff Muizelaar
07d53bd660 Bug 1379680. Add a way to append buffers to a BufferList. r=billm 2017-11-29 10:11:13 -05:00
Alfredo.Yang
0000c37a97 Bug 1419682 - add unwrap_or() for Result. r=Waldo
MozReview-Commit-ID: FmPvPzUmN9j

--HG--
extra : rebase_source : d5d3b3ca42b839b82886512ada8bc49551a60d8a
2017-11-22 17:14:28 +08:00
Nika Layzell
a124bfae77 Bug 1418465 - Add an opt-out to the MOZ_CAN_RUN_SCRIPT analysis, r=andi
MozReview-Commit-ID: 2YKncUdrT5p
2017-11-24 11:15:17 -05:00
Dragan Mladjenovic
0da69a98b9 Bug 1417135 - Mark user-defined default constructor for ThreadLocalKeyStorage as constexpr. r=glandium
--HG--
extra : rebase_source : 0bb28ea9d255856b778689afd70f703e187cb086
2017-11-15 01:33:00 -05:00
Mike Hommey
a1ac099614 Bug 1416183 - Build LZ4 as C instead of including it as C++. r=froydnj
Apply 63a7f34fee
to our copy of lz4.h to allow to flag the lz4 symbols as not exported.

--HG--
extra : rebase_source : d9aafb04a56c0ae3620e0c873f77d124386a41c4
2017-11-15 12:51:01 +09:00
Mike Hommey
d89bedbf1e Bug 1416989 - Remove mfbt_staticruntime. r=froydnj
The library was added in bug 1160285 for webapprt, and webapprt was
removed in bug 1238079.

--HG--
extra : rebase_source : 8e47523263eb53707b0d916cc550418f1bc646ef
2017-11-14 15:55:53 +09:00
Nicholas Nethercote
4d9d19123c Backout 15b89e515c94 (bug 1410186) for causing too many crashes on Nightly. 2017-11-13 12:14:02 +11:00
Nathan Froyd
37e5710099 Bug 1410186 - turn Maybe assertions into release assertions; r=bkelly
We out-of-line the relevant functions because release assertions can
generate quite a bit of code, and we'd rather let the compiler determine
if these functions should be inlined now.
2017-11-09 12:27:51 -05:00
Nathan Froyd
4c1bca4cb9 Bug 1412825 - fix lz4 deprecated attribute with clang and c++14; r=RyanVM
This is the upstream fix from https://github.com/lz4/lz4/pull/393.
2017-10-30 10:12:38 -04:00
Nathan Froyd
840ac6d981 Bug 1385438 - make mozilla::RefCounted use the strongest memory consistency necessary; r=jrmuizel
We don't need to use sequential consistency for everything, we can get
by with using weaker memory consistency models depending on the operation.
2017-10-27 13:05:51 -04:00
Nathan Froyd
d3031ab529 Bug 1409398 - remove EnumSet::initVersion; r=sylvestre
We don't need this function anymore with member initializer syntax.
2017-10-26 14:54:23 -04:00
Joel Maher
04fee04208 Bug 1411586 - mfbt is missing BUGZILLA_COMPONENTS defined in-tree. r=froydnj 2017-10-26 04:53:23 -04:00
Sylvestre Ledru
d60d69e2cb Bug 1411001 - Remove the +x permissions on cpp & h files r=froydnj
MozReview-Commit-ID: DjDkL20wRg0

--HG--
extra : rebase_source : a343d83d1f4e97e4ba56d0f57fec93079df0b5ea
2017-10-23 20:59:55 +02:00
Gerald Squelart
5bea7c3a56 Bug 1410252 - MakeNotNull<PointerType, OptionalPointeeType>(Args...) - r=njn
MakeNotNull is similar to UniquePtr, in that it combines the infallible
allocation and construction of an object on the heap and wraps the (raw or
smart) pointer into a NotNull.
It skips the unnecessary null check from WrapNotNull, and removes the usual
naked 'new' used in many WrapNotNull calls.

MozReview-Commit-ID: UwCrhDnkUg

--HG--
extra : rebase_source : 5a027165fc17ed748783c7ffda03eb421865ad6e
2017-10-20 14:56:01 +11:00
Lee Salzman
70cd2a8499 Bug 1404742 - add test for ThreadSafeWeakPtr. r=nfroyd
MozReview-Commit-ID: GkNXsTLcN7m
2017-10-18 14:21:27 -04:00
Lee Salzman
3ffe69dad3 Bug 1404742 - add ThreadSafeWeakPointer to MFBT. r=nfroyd 2017-10-18 14:21:23 -04:00
Sylvestre Ledru
f4fab71f73 Bug 1409382 - EnumSet.h - Initialize mVersion to silence a warning with gcc 8 r=froydnj
MozReview-Commit-ID: CfTs6IAP1z5

--HG--
extra : rebase_source : 80051fe498d20e08060afca577a6abc4ee3c35cd
2017-10-17 15:19:16 +02:00
Mike Hommey
9f2dd4775e Bug 1407468 - Replace multiple !JS_STANDALONE with MOZ_WIDGET_TOOLKIT. r=mshal
--HG--
extra : rebase_source : 4f9f9f583c3422ed0f8d1d65ea8e7575bd9baf2c
2017-10-05 14:50:01 +09:00
Jeff Walden
a3d9df23d5 Bug 1407137 - Implement Swap(Atomic<T, Order>&, Atomic<T, Order>&) = delete; to remove an actually-non-atomic footgun. r=froydnj
--HG--
extra : rebase_source : 6afed8e85fcf8801144a1a34ea07f590baa0f5e0
2017-10-10 10:19:31 -07:00
Jeff Walden
be56429c85 Bug 1402344 - Update mfbt-double-conversion to the latest upstream rev. r=froydnj
--HG--
rename : mfbt/double-conversion/source/LICENSE => mfbt/double-conversion/double-conversion/LICENSE
rename : mfbt/double-conversion/source/README.md => mfbt/double-conversion/double-conversion/README.md
rename : mfbt/double-conversion/source/bignum-dtoa.cc => mfbt/double-conversion/double-conversion/bignum-dtoa.cc
rename : mfbt/double-conversion/source/bignum-dtoa.h => mfbt/double-conversion/double-conversion/bignum-dtoa.h
rename : mfbt/double-conversion/source/bignum.cc => mfbt/double-conversion/double-conversion/bignum.cc
rename : mfbt/double-conversion/source/bignum.h => mfbt/double-conversion/double-conversion/bignum.h
rename : mfbt/double-conversion/source/cached-powers.cc => mfbt/double-conversion/double-conversion/cached-powers.cc
rename : mfbt/double-conversion/source/cached-powers.h => mfbt/double-conversion/double-conversion/cached-powers.h
rename : mfbt/double-conversion/source/diy-fp.cc => mfbt/double-conversion/double-conversion/diy-fp.cc
rename : mfbt/double-conversion/source/diy-fp.h => mfbt/double-conversion/double-conversion/diy-fp.h
rename : mfbt/double-conversion/source/double-conversion.cc => mfbt/double-conversion/double-conversion/double-conversion.cc
rename : mfbt/double-conversion/source/double-conversion.h => mfbt/double-conversion/double-conversion/double-conversion.h
rename : mfbt/double-conversion/source/fast-dtoa.cc => mfbt/double-conversion/double-conversion/fast-dtoa.cc
rename : mfbt/double-conversion/source/fast-dtoa.h => mfbt/double-conversion/double-conversion/fast-dtoa.h
rename : mfbt/double-conversion/source/fixed-dtoa.cc => mfbt/double-conversion/double-conversion/fixed-dtoa.cc
rename : mfbt/double-conversion/source/fixed-dtoa.h => mfbt/double-conversion/double-conversion/fixed-dtoa.h
rename : mfbt/double-conversion/source/ieee.h => mfbt/double-conversion/double-conversion/ieee.h
rename : mfbt/double-conversion/source/strtod.cc => mfbt/double-conversion/double-conversion/strtod.cc
rename : mfbt/double-conversion/source/strtod.h => mfbt/double-conversion/double-conversion/strtod.h
rename : mfbt/double-conversion/source/utils.h => mfbt/double-conversion/double-conversion/utils.h
extra : rebase_source : 2d03850dcd1db749f0debecffec2e870acd1b958
2017-10-09 22:15:37 -07:00
Jean-Yves Avenard
a81f8e9be1 Bug 1406793 - Make IsWindows* methods thread-safe. r=froydnj
MozReview-Commit-ID: 9AmhHv2g983

--HG--
extra : rebase_source : c814d15bdbfacdbe48fe7705e41a8c8878339a9a
2017-10-09 10:36:23 +02:00
Nicholas Nethercote
d225f7151b Bug 1400460 - Rename nsIAtom as nsAtom. r=hiro.
(Path is actually r=froydnj.)

Bug 1400459 devirtualized nsIAtom so that it is no longer a subclass of
nsISupports. This means that nsAtom is now a better name for it than nsIAtom.

MozReview-Commit-ID: 91U22X2NydP

--HG--
rename : xpcom/ds/nsIAtom.h => xpcom/ds/nsAtom.h
extra : rebase_source : ac3e904a21b8b48e74534fff964f1623ee937c67
2017-10-03 09:05:19 +11:00
Chris Peterson
7bbe4a40e6 Bug 1405582 - Span: avoid repeated calls to size(). r=hsivonen
MozReview-Commit-ID: BKFrbvEt57l

--HG--
extra : rebase_source : 9aeb6fd018da5b8623f14ab927bd786c29ae56ae
extra : source : c5bedfde8b9dc2929fc14cfc2dc816e5f08b4ad8
2017-09-19 13:18:38 -07:00
Chris Peterson
a48326552c Bug 1405582 - Span: delete implicit constructors for char* and char16_t*. r=froydnj,hsivonen
Delete Span's implicit constructors for char* and char16_t* pointers to avoid accidental construction in cases where a pointer does not point to a zero-terminated string. Use the MakeStringSpan() function instead.

I deleted both the const and non-const char* and char16_t* constructors, in the name of cross-compiler consistency. If we only delete the const char* and char16_t* constructors, for some reason, MSVC complains that `Span<char> s(charArray)` uses a deleted constructor while clang nor gcc permit it. I don't know if this is a compiler bug in MSVC or clang and gcc.

Also, do not permit MakeSpan() for string literals (const char and char16_t arrays) because the Span length would include the zero terminator, which may surprise callers. Use MakeStringSpan() to create a Span whose length that excludes the string literal's zero terminator or use the MakeSpan() overload that accepts a pointer and length and specify the string literal's full length.

The following Span usages are prevented:

  Span<const char> span("literal"); // error
  Span<char> span(charArray); // error

  Span<const char> span;
  span = "literal"; // error
  span = charArray; // error

  MakeSpan("literal"); // error

The following Span usages are still permitted:

  assert(MakeStringSpan("literal") == 8); // OK: span length is calculated with strlen() and excludes the zero terminator
  MakeStringSpan(charArray); // OK: span length is calculated with strlen() and excludes the zero terminator
  MakeSpan(charArray); // OK: span length is the char array size including any zero terminator

MozReview-Commit-ID: Et71CpjsiyI

--HG--
extra : rebase_source : f6f8bdb28726f0f2368fdfdd039fb1d7dcf2914e
extra : source : 0547d8924ffc7713d6cf32cc06eeeaf00e0d69a3
2017-09-20 00:38:07 -07:00
Jim Blandy
d68a13309e No bug: RollingMean.h doc fix. DONTBUILD r=kentuckyfriedtakahe
--HG--
extra : rebase_source : ea6ed30a67a1b0d3d19048b3c2b61857514371da
extra : amend_source : 3dc9b5c144c565ca9b90914de626c15e610aa372
2016-12-20 23:11:30 -08:00
Sebastian Hengst
9187795579 merge mozilla-inbound to mozilla-central. r=merge a=merge
MozReview-Commit-ID: 74cERYrHFIG
2017-09-28 11:44:21 +02:00
Tom Ritter
86d478e605 Bug 1402355 Require TLS_OUT_OF_INDEXES to be defined before ThreadLocalKeyStoragewill be defined on Windows r=glandium
ThreadLocalKeyStorage uses Thread Local APIs that are declared in
processthreadsapi.h (although it's more common to just include
windows.h). If a caller wants to use this class, it is their
responsibility to include an appropriate header before including
ThreadLocal.h


MozReview-Commit-ID: GO5dHKVWpZO

--HG--
extra : rebase_source : ff8d6cda1eed7bd9d54745c869b4e47a895b605a
2017-09-27 15:09:23 -05:00
Luke Wagner
bb375a16d4 Bug 1329019 - Allow specifying capacity to Vector::replaceRawBuffer (r=froydnj)
MozReview-Commit-ID: 9Eq6PR53n4i
2017-09-22 10:34:24 -05:00
Luke Wagner
231c33a9fe Bug 1329019 - Vector::podResizeToFit should update reserved (r=froydnj)
MozReview-Commit-ID: CkoNRjxmjom
2017-09-22 10:33:36 -05:00
Mats Palmgren
b00f969bb5 Bug 1356936 - Use __builtin_add/sub/mul_overflow() where available to optimize CheckedInt. r=waldo,ehsan
MozReview-Commit-ID: ARw6zNelpSk
2017-09-21 18:24:10 +02:00
Dimitry Andric
f2d86a8b30 Bug 1399412 - Work around clang assertion by wrapping lz4.c in an extern C block. r=froydnj
MozReview-Commit-ID: LLgSbJadbyJ

--HG--
extra : amend_source : 08d7908fe6807db654411fc291bccc98496d4275
2017-09-13 09:43:00 -04:00
Wes Kocher
ff68b95b87 Merge inbound to central, a=merge
MozReview-Commit-ID: ClVRh99eIUo
2017-09-14 00:03:28 -07:00
Sebastian Hengst
123fb86836 merge mozilla-central to mozilla-inbound. r=merge a=merge 2017-09-14 00:15:34 +02:00
Matt Woodrow
a56e3551a2 Bug 1397056 - Add Contains and a return parameter to Remove for SmallPointerArray. r=froydnj
* * *
[mq]: fix

MozReview-Commit-ID: 5laM7PQLP7X
2017-09-12 14:11:47 -04:00
Mike Hommey
087c1cda52 Bug 1399031 - Add a Tls{Get,Set}Value-based ThreadLocal implementation for Windows. r=froydnj
--HG--
extra : rebase_source : 13a407d35973ba2ed6da29195f5ce8a2c0f7cff4
2017-09-12 16:04:17 +09:00
Mike Hommey
97e87fc179 Bug 1399031 - Expose pthread_{get,set}specific-based TLS whether "native" TLS is supported or not. r=froydnj
There are use cases for wanting a specific TLS implementation
independently of whether __thread or thread_local are supported.
This is one step in that direction, making the
pthread_{get,set}specific-based implementation available independently.

We still keep everything under the mozilla::detail namespace because
it's still better if people don't try to use mozilla::ThreadLocal
directly.

--HG--
extra : rebase_source : 095b95a577b85efaaf2f3c0b7c3ac968ff711738
2017-09-12 15:37:31 +09:00
Kevin Hsieh
a0a376f2f1 Bug 1396026 - Update OTS to accept Awami Nastaliq. r=froydnj,jfkthame
MozReview-Commit-ID: EvF3YDhuwNn

--HG--
extra : rebase_source : 20046aa4f2695f923574bf00207f06a113d1f246
2017-09-07 10:40:59 -07:00
Wes Kocher
b1233c7d04 Backed out changeset 371a03aa9b24 (bug 1397056) for build errors in SmallPointerArray.h a=backout CLOSED TREE
MozReview-Commit-ID: FNVPjKmVCWB

--HG--
extra : rebase_source : 41e380e59d9eead945ba515d85c1b9195329bc74
2017-09-12 12:39:09 -07:00
Matt Woodrow
5675f29866 Bug 1397056 - Add Contains and a return parameter to Remove for SmallPointerArray. r=froydnj
* * *
[mq]: fix

MozReview-Commit-ID: 5laM7PQLP7X

--HG--
extra : rebase_source : f1baa7c1581fcc864d2b548989e967f57e24b921
2017-09-12 14:11:47 -04:00
Ryan VanderMeulen
909ebdebd8 Bug 1398021 - Update lz4 to version 1.8.0. r=froydnj 2017-09-12 09:00:37 -04:00
Mike Hommey
be1493b6fc Bug 1396723 - Use DoublyLinkedList in mozjemalloc. r=froydnj
Mozjemalloc uses its own doubly linked list, which, being inherited from
C code, doesn't do much type checking, and, in practice, is rather
similar to DoublyLinkedList, so use the latter instead.

--HG--
extra : rebase_source : 9eb7334b6dde05f9af0eaea4184e532c69d0264e
2017-09-02 08:55:42 +09:00
Mike Hommey
0d8ed2b1a5 Bug 1396723 - Simplify the trait users of DoublyLinkedList need to define. r=froydnj
While the flexibility of the current trait is nice, it's actually not
used to its fullest anywhere, and is boilerplate-y. While it is useful
to be able to put the links anywhere, there's not much usefulness from
being able to split mNext and mPrev.

So instead of a trait that allows to get/set mNext and mPrev
independently, we just use a trait that tells how to get a reference to
a DoublyLinkedListElement from a list element itself.

--HG--
extra : rebase_source : 674277bac4fc979f2e483a77b5ef1495baccc7fe
2017-09-02 08:09:58 +09:00
Mike Hommey
18212266ea Bug 1398543 - Add missing condition in DoublyLinkedList::ElementNotInList. r=froydnj
--HG--
extra : rebase_source : fa07b148bd0d7e7428e70fb8a05edb5792836135
2017-09-10 08:49:56 +09:00
Chris Manchester
c0a229d4c3 Bug 1386876 - Replace all uses of DISABLE_STL_WRAPPING with a template, remove DISABLE_STL_WRAPPING. r=glandium
MozReview-Commit-ID: FMEtb5PY7iP

--HG--
extra : rebase_source : 3cdee7528846462c758e623d6bcd2e6e17dbabff
2017-09-11 11:33:26 -07:00
Phil Ringnalda
bc78097d88 Backed out 2 changesets (bug 1396723) for !ElementAccess::Get(mHead).mPrev assertion failures
Backed out changeset 4f17343164b6 (bug 1396723)
Backed out changeset b744eba9ca78 (bug 1396723)

MozReview-Commit-ID: JbvM6oMxEFl
2017-09-06 21:39:20 -07:00
Mike Hommey
6b7116c52d Bug 1396723 - Use DoublyLinkedList in mozjemalloc. r=froydnj
Mozjemalloc uses its own doubly linked list, which, being inherited from
C code, doesn't do much type checking, and, in practice, is rather
similar to DoublyLinkedList, so use the latter instead.

--HG--
extra : rebase_source : 1d40653b8117e28d8633134f379540c3c517a306
2017-09-02 08:55:42 +09:00
Mike Hommey
b16f4035ba Bug 1396723 - Simplify the trait users of DoublyLinkedList need to define. r=froydnj
While the flexibility of the current trait is nice, it's actually not
used to its fullest anywhere, and is boilerplate-y. While it is useful
to be able to put the links anywhere, there's not much usefulness from
being able to split mNext and mPrev.

So instead of a trait that allows to get/set mNext and mPrev
independently, we just use a trait that tells how to get a reference to
a DoublyLinkedListElement from a list element itself.

--HG--
extra : rebase_source : f84c5799c305a4a3b7dc5deb727a05d4d537bb15
2017-09-02 08:09:58 +09:00
Wes Kocher
f66c96f2c8 Backed out 2 changesets (bug 1396723) for build failures in TestDoublyLinkedList.cpp a=backout
Backed out changeset 1c0f9d069ade (bug 1396723)
Backed out changeset 6ca94a450b81 (bug 1396723)

MozReview-Commit-ID: 2w3WTvhpg6J
2017-09-06 14:30:41 -07:00
Mike Hommey
d946f42f29 Bug 1396723 - Use DoublyLinkedList in mozjemalloc. r=froydnj
Mozjemalloc uses its own doubly linked list, which, being inherited from
C code, doesn't do much type checking, and, in practice, is rather
similar to DoublyLinkedList, so use the latter instead.

--HG--
extra : rebase_source : 7f2c03d6ba5c1da5d8badb0de710b7900e9d00c1
2017-09-02 08:55:42 +09:00
Mike Hommey
9a3dd41f50 Bug 1396723 - Simplify the trait users of DoublyLinkedList need to define. r=froydnj
While the flexibility of the current trait is nice, it's actually not
used to its fullest anywhere, and is boilerplate-y. While it is useful
to be able to put the links anywhere, there's not much usefulness from
being able to split mNext and mPrev.

So instead of a trait that allows to get/set mNext and mPrev
independently, we just use a trait that tells how to get a reference to
a DoublyLinkedListElement from a list element itself.

--HG--
extra : rebase_source : b7d502754a764670e291acdd56726948db935497
2017-09-02 08:09:58 +09:00
Kilik Kuo
3d9fbae6bd Bug 1279171 - Do not use WMF when application is in Windows pre-2000 compatibility mode. r=froydnj
MozReview-Commit-ID: BPiz2WWrshF

--HG--
extra : rebase_source : c5e78e94c542a5b00b06e177aa088ad3bb56da57
2017-08-24 11:46:56 +08:00
Kris Maglione
6bad4f8ef7 Bug 1366511: Part 3 - Add mozilla::ToResult() to convert other result types to equivalent Result. r=nbp,ehsan
Also adds a mozilla/ResultExtensions.h header to define the appropriate
conversion functions for nsresult and PRResult. This is in a separate header
since those types are not available in Spidermonkey, and this is the pattern
other *Extensions.h headers follow.

Also removes equivalent NS_TRY macros and WrapNSResult inlines that served the
same purpose in existing code, and are no longer necessary.

MozReview-Commit-ID: A85PCAeyWhx

--HG--
extra : rebase_source : a5988ff770888f901dd0798e7717bcf6254460cd
2017-08-29 21:28:31 -07:00
Kris Maglione
c9899cb3fa Bug 1366511: Part 2 - Allow autoconverting Err(nsresult) to nsresult. r=ehsan,nbp
This allows MOZ_TRY and MOZ_TRY_VAR to be transparently used in XPCOM methods
when compatible Result types are used.

Also removes a compatibility macro in SimpleChannel.cpp, and an identical
specialization in AddonManagerStartup, which are no longer necessary after
this change.

MozReview-Commit-ID: 94iNrPDJEnN

--HG--
extra : rebase_source : 24ad4a54cbd170eb04ded21794530e56b1dfbd82
2017-08-29 21:28:22 -07:00
Kris Maglione
92dcd409a3 Bug 1366511: Part 1 - Allow packing Result<T, nsresult> values into a single word. r=ehsan,nbp
When used as an error value, nsresult should never be NS_OK, which means that
we should be able to safely pack simple nsresult Result values into a single
word.

MozReview-Commit-ID: GJvnyTPjynk

--HG--
extra : rebase_source : ab5a64b545dfbfe9bbef167f8b63ecbf00b16e07
2017-08-31 16:01:43 -07:00
Nick Fitzgerald
9da40f6365 Bug 1277338 - Part 7: Export mozglue when JS_STANDALONE && !jemalloc; r=glandium,sfink
This makes sure that:

* We don't define `MOZ_GLUE_IN_PROGRAM` so that everything in mozglue gets
  defined.

* `MFBT_API`'s symbol export rules match `JS_PUBLIC_API` and `EXPORT_JS_API`.

* We add mozglue to SpiderMonkey's `USE_LIBS` when jemalloc is disabled.
2017-08-31 15:59:13 -07:00
Tom Ritter
92ff663a31 Bug 1393498 Mark the stub_BaseThreadInitThunk as MOZ_NORETURN to silence a warning about a noreturn function not returning r=dmajor,froydnj
/home/worker/workspace/build/src/mozglue/build/WindowsDllBlocklist.cpp:816:1: error: 'noreturn' function does return [-Werror]

MozReview-Commit-ID: SYgPDW0sMV

--HG--
extra : rebase_source : 27b1dda404b3fc5fab95dd524677387bad921751
2017-08-24 22:49:09 -05:00
Tom Ritter
8dbe002119 Bug 1393538 Clean up unused variables in toolkit/ r=smaug
MozReview-Commit-ID: I6r50dqJJHJ

--HG--
extra : rebase_source : f1f773db8f0ec44c1cf6f194973f870b08f6138b
2017-08-24 15:07:59 -05:00
Bill McCloskey
f90a87caa9 Bug 1350432 - Initial Quantum DOM scheduler implementation, disabled by default (r=froydnj)
MozReview-Commit-ID: JWBxz3bwgwD
2017-08-25 10:28:23 -07:00
Bill McCloskey
06a265a5bd Bug 1350432 - Add TLS infallible init (r=froydnj)
MozReview-Commit-ID: 9Fgltrw4p8
2017-08-25 10:28:23 -07:00
Nathan Froyd
c5fa35746e Bug 1390568 - manually de-virtualize do_QueryReferent; r=ehsan
nsQueryReferent is defined as an nsCOMPtr_helper, which implies that
calling its operator() method requires a virtual call.  While
nsQueryReferent is marked `final`, compiler inlining decisions make it
impossible to de-virtualize the call to operator().  However, we have
many other classes returned by do_* functions that nsCOMPtr handles
directly, requiring no extra virtual calls, and we can give
nsQueryReferent the same treatment.
2017-08-24 20:04:31 -04:00
Tristan Bourvon
ba0998ae31 Bug 1380423 - Add static-analysis to enforce strict rules on functions which can run scripts. r=mystor
MozReview-Commit-ID: GGSyq0z5msB
2017-08-08 19:48:53 +03:00
Wes Kocher
fb8abb94c7 Merge inbound to central, a=merge
MozReview-Commit-ID: 1mWKzfX4kl
2017-08-23 18:07:24 -07:00
Luke Wagner
e59ff0294c Bug 1351488 - Add MOZ_XPCOM_ABI to mfbt (r=froydnj)
MozReview-Commit-ID: Hw3zDX3TOhs

--HG--
extra : rebase_source : 96d93215f9d79e376df25108d0f4d82a178bda28
2017-08-23 10:16:56 -05:00
James Cheng
5a887baca6 Bug 1392885 -Add debug message when misusing the guard object. r=froydnj
MozReview-Commit-ID: 78iFX5qUcTC

--HG--
extra : rebase_source : 320b23d8d6a1fcff7fe6573243f10393f1bf56cf
2017-08-23 11:59:21 +08:00
Xidorn Quan
667a3cb5a4 Bug 1391103 - Align Maybe::mStorage like when the type is in a struct. r=froydnj
MozReview-Commit-ID: 6ArNhZA4Wdf

--HG--
extra : rebase_source : f69ae80c146f2acb308a6c9707aac7ee22f5d992
2017-08-17 09:49:19 +10:00
Sylvestre Ledru
22a57591b0 Bug 1387002 - Replace .size() by .empty() when applicable in mfbt r=froydnj
MozReview-Commit-ID: 9S5oZQkykKv

--HG--
extra : rebase_source : dfc6b9bccb3a388486efb7179a5864b19e0952ec
2017-08-03 12:07:07 +02:00
Tristan Bourvon
2e77c99160 Bug 1374024 - add checker to prevent dangling pointers returned by method calls on temporaries. r=mystor
MozReview-Commit-ID: 9khNt59ONF
2017-07-05 16:14:21 +02:00
Cykesiopka
ec8581113b Bug 1355692 - Add MOZ_FALLTHROUGH macro definition for gcc 7 to suppress -Wimplicit-fallthrough warnings. r=glandium
The generic fallback MOZ_FALLTHROUGH definition is insufficient for GCC 7 and
above, resulting in --enable-warnings-as-errors builds failing.

The check for clang support is changed to use the __has_cpp_attribute macro,
which is more robust than checking the __cplusplus version.

Also, MOZ_FALLTHROUGH is now only defined in C++ code, since GCC errors out if
it encounters a scoped attribute being used with __has_cpp_attribute in C code.
No C code uses MOZ_FALLTHROUGH or derivatives at the moment.

MozReview-Commit-ID: 4nKFBRD5jSF

--HG--
extra : rebase_source : 0c37ae39c806ca24a3271d3ec19531dd16e05daf
2017-07-28 00:11:28 +08:00
Bill McCloskey
7e43e5439d Bug 1384395 - Use nsAutoOwningThread for mfbt/WeakPtr.h thread assertions (r=froydnj)
MozReview-Commit-ID: DF4DiffL4Qq
2017-07-28 13:11:44 -07:00
Carsten "Tomcat" Book
d360d49d2a merge mozilla-inbound to mozilla-central a=merge 2017-07-27 10:57:25 +02:00
Kartikaya Gupta
ba4b3b9101 Bug 1384233 - Remove SizePrintfMacros.h. r=froydnj
We have a minimum requirement of VS 2015 for Windows builds, which supports
the z length modifier for format specifiers. So we don't need SizePrintfMacros.h
any more, and can just use %zu and friends directly everywhere.

MozReview-Commit-ID: 6s78RvPFMzv

--HG--
extra : rebase_source : 009ea39eb4dac1c927aa03e4f97d8ab673de8a0e
2017-07-26 16:03:57 -04:00
Kris Maglione
8683b183cd Bug 1382645: Part 1 - Add memory reporter for StructuredCloneHolder binding implementation. r=billm
MozReview-Commit-ID: aK3ljfCJVi

--HG--
extra : rebase_source : d788c6c686cc72b423ca100795a379d343c398db
2017-07-25 14:53:41 -07:00
Michael Layzell
0969ebe118 Bug 1380410 - Add NeverAllocPolicy, r=erahm
MozReview-Commit-ID: 8U38Oj3vyaF
2017-07-25 11:26:21 -04:00
Jeff Hajewski
447dee122f Add IPC support for mozilla::Variant (bug 1371846); r=botond
Changes made:
* Add IPC::ParamTraits as a friend to mozilla::Variant in Variant.h.
  This is required so that `tag` can be accessed in the
  IPC::ParamTraits specialization.

* Add a IPC::ParamTraits specialization to IPCMessageUtils.h.

MozReview-Commit-ID: B3pGrZE1z0O

--HG--
extra : rebase_source : cb73873b87401846f79e124249c7ce00dff2de77
2017-07-21 07:18:02 -05:00
Nathan Froyd
fd24d774c3 Bug 1347963 - part 0 - use global qualification for GuardObjects.h macros; r=erahm
These macros can be used in cases where the `mozilla` namespace might
not refer to the toplevel `mozilla` namespace that was intended.  To
ensure that the macros always refer to the `mozilla` namespace in the
global namespace, use the appropriate qualification.
2017-07-24 17:05:01 -04:00