Commit Graph

2279 Commits

Author SHA1 Message Date
Butkovits Atila
c5ea1e4659 Backed out 21 changesets (bug 1341265) for causing Bug 1724298. CLOSED TREE
Backed out changeset ad0987b840c1 (bug 1341265)
Backed out changeset c3094bf07295 (bug 1341265)
Backed out changeset 199d9708682d (bug 1341265)
Backed out changeset 991572f50cf9 (bug 1341265)
Backed out changeset bf631916de9b (bug 1341265)
Backed out changeset 5d9d8af2f4ac (bug 1341265)
Backed out changeset 720032f06c94 (bug 1341265)
Backed out changeset 85f8b1c24e9d (bug 1341265)
Backed out changeset 13da03ae88a8 (bug 1341265)
Backed out changeset 6716962a06ed (bug 1341265)
Backed out changeset 26787054e0db (bug 1341265)
Backed out changeset 21199bd4965d (bug 1341265)
Backed out changeset bd5e0950f9d9 (bug 1341265)
Backed out changeset 3fa14377770a (bug 1341265)
Backed out changeset 56ec3626f0ba (bug 1341265)
Backed out changeset 09f04c26176c (bug 1341265)
Backed out changeset b861bb6771c7 (bug 1341265)
Backed out changeset 820e01c32bcd (bug 1341265)
Backed out changeset 88e497d213fe (bug 1341265)
Backed out changeset e9272f7d1823 (bug 1341265)
Backed out changeset 33a140c71ff0 (bug 1341265)
2021-08-07 19:07:28 +03:00
André Bargull
58f4af8485 Bug 1341265 - Part 11: Optimise Set.prototype.has for objects in CacheIR. r=iain
Inline `Set.prototype.has` in CacheIR when called with objects.

Implementing `MacroAssembler::hashObject()` on 32-bit platforms is difficult,
because it uses 64-bit operations, so we either have to allocate twice as much
registers for `Register64` or alternatively spill the values on the stack. For
now just punt and only support this optimisation on 64-bit platforms.

Differential Revision: https://phabricator.services.mozilla.com/D118977
2021-08-02 16:38:04 +00:00
André Bargull
93463e429d Bug 1341265 - Part 1: Remove stale fixme comment. r=iain
Bug 775896 has been fixed, so we can remove the fixme comment.

Differential Revision: https://phabricator.services.mozilla.com/D118967
2021-08-02 16:38:00 +00:00
Iain Ireland
094d5b88a8 Bug 1719396: Don't hash sizeof(size_t) in HashBytes r=glandium
The loop in HashBytes currently hashes both a word of data (as intended) and the length of that word of data (a constant).

This was [acknowledged as a bug](https://bugzilla.mozilla.org/show_bug.cgi?id=729940#c49) when first written, but slipped through the cracks and was never fixed.

Differential Revision: https://phabricator.services.mozilla.com/D119466
2021-07-19 21:35:40 +00:00
Gerald Squelart
81d28b5530 Bug 1719959 - Better Tag type choice, fixed corresponding test - r=emilio
On some systems, uint_fast8_t may be as big as size_t! So the `static_assert(sizeof(aIndex) < sizeof(size_t))` could fail there. The better test here is to check for the expected type (uint_fast8_t).

Now, since uint_fast8_t can be bigger than 8 bits, we may as well choose it for variant sizes greater than 255, up to UINT_FAST8_MAX.
(The added parentheses help clang-format distinguish '<' for tests vs for templates.)

Differential Revision: https://phabricator.services.mozilla.com/D119574
2021-07-11 09:43:50 +00:00
Nika Layzell
0e22f3df51 Bug 1717808 - aIter must be valid after extracting last segment of a BufferList, r=glandium
When advancing to Beta, we stop adding sentinels after serialized data
in IPC::Message objects. These sentinels would cause all Extract calls
to not reach the end of the message buffer on Nightly. This patch fixes
an assertion failure which can occur when extract calls fully empty the
buffer, and the finished iterator is advanced by 0 bytes.

Differential Revision: https://phabricator.services.mozilla.com/D118838
2021-07-07 18:03:03 +00:00
Nika Layzell
82ee49b019 Bug 1717778 - Upgrade some LinkedList asserts to RELEASE_ASSERT, r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D118719
2021-06-25 16:53:39 +00:00
Nika Layzell
5731c1747c Bug 1717526 - String's implicit conversion operator causes COW relocations, r=xpcom-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D118430
2021-06-23 01:57:00 +00:00
Alexandru Michis
e3d24b013a Backed out changeset 3beb01f5d643 (bug 1717526) for causing gtest failures in SpanTest.from_xpcom_collections
CLOSED TREE
2021-06-23 01:58:49 +03:00
Nika Layzell
c14de7eabc Bug 1717526 - String's implicit conversion operator causes COW relocations, r=xpcom-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D118430
2021-06-22 21:18:03 +00:00
Nika Layzell
10e86924f0 Bug 1706374 - Part 14: Track the absolute offset on iterators, r=glandium
This should improve the performance of large calls to AdvanceAcrossSegments
when using a very large BufferList, as we no longer need to iterate over each
element to find the destination when the call is closer to the end.

This will be used most frequently with the new footer code to seek to the end
of an IPC message to read out the footer.

Differential Revision: https://phabricator.services.mozilla.com/D116667
2021-06-22 18:17:23 +00:00
Nika Layzell
599b58f458 Bug 1706374 - Part 13: Remove the event footer from an IPC::Message when deserializing, r=handyman,glandium
This unfortunately requires a new method to be added to BufferList to
support truncating the buffer to a particular iterator.

Differential Revision: https://phabricator.services.mozilla.com/D116666
2021-06-22 18:17:23 +00:00
Butkovits Atila
83f57b5c69 Backed out 22 changesets (bug 1714226, bug 1706374, bug 1713148) for causing build bustages on MessageChannel.cpp. CLOSED TREE
Backed out changeset ea469eaa54ca (bug 1713148)
Backed out changeset fd8523d5126e (bug 1713148)
Backed out changeset f2e5309c914c (bug 1713148)
Backed out changeset 2da57973ed55 (bug 1713148)
Backed out changeset 677e1ee99bb2 (bug 1713148)
Backed out changeset b4c0619e79bf (bug 1706374)
Backed out changeset c02fa459e77d (bug 1706374)
Backed out changeset 72dc6537cf0b (bug 1706374)
Backed out changeset 48088463c656 (bug 1706374)
Backed out changeset b09ae4c3a94b (bug 1706374)
Backed out changeset 04422175004b (bug 1706374)
Backed out changeset 110b2384e7d1 (bug 1706374)
Backed out changeset ab2b086abbd4 (bug 1706374)
Backed out changeset ffde07f73249 (bug 1706374)
Backed out changeset c6303af17ff4 (bug 1706374)
Backed out changeset 02249671c2f9 (bug 1706374)
Backed out changeset a6a5d05b5636 (bug 1706374)
Backed out changeset e21b6defb805 (bug 1706374)
Backed out changeset c72c5be9ddb1 (bug 1706374)
Backed out changeset 23cd961575a6 (bug 1706374)
Backed out changeset b412d6e9e145 (bug 1706374)
Backed out changeset a8ec285d6472 (bug 1714226)
2021-06-22 04:03:56 +03:00
Nika Layzell
96dd5437ae Bug 1706374 - Part 14: Track the absolute offset on iterators, r=glandium
This should improve the performance of large calls to AdvanceAcrossSegments
when using a very large BufferList, as we no longer need to iterate over each
element to find the destination when the call is closer to the end.

This will be used most frequently with the new footer code to seek to the end
of an IPC message to read out the footer.

Differential Revision: https://phabricator.services.mozilla.com/D116667
2021-06-21 21:53:12 +00:00
Nika Layzell
344d8d6622 Bug 1706374 - Part 13: Remove the event footer from an IPC::Message when deserializing, r=handyman,glandium
This unfortunately requires a new method to be added to BufferList to
support truncating the buffer to a particular iterator.

Differential Revision: https://phabricator.services.mozilla.com/D116666
2021-06-21 21:53:11 +00:00
Toshihito Kikuchi
deeb00a274 Bug 1695817 - Part 5: Add std::equal_range equivalent in MFBT. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D114598
2021-05-28 22:35:58 +00:00
Alexandru Michis
8fbcd44dc4 Backed out 9 changesets (bug 1695817) for causing bc failures in content/aboutThirdParty.js
CLOSED TREE

Backed out changeset 6b7f451e911e (bug 1695817)
Backed out changeset ad3ea67b3d70 (bug 1695817)
Backed out changeset b4f971059f3f (bug 1695817)
Backed out changeset 9c9a928d4a70 (bug 1695817)
Backed out changeset 4a9bcb38fddf (bug 1695817)
Backed out changeset 48c0eed38628 (bug 1695817)
Backed out changeset 7583675dccb1 (bug 1695817)
Backed out changeset e3f2bed63c33 (bug 1695817)
Backed out changeset 1c45ba4fba61 (bug 1695817)
2021-05-28 21:53:41 +03:00
Toshihito Kikuchi
0441dec54b Bug 1695817 - Part 5: Add std::equal_range equivalent in MFBT. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D114598
2021-05-28 15:32:31 +00:00
Butkovits Atila
3735a33d14 Backed out 9 changesets (bug 1695817) for causing build bustages. CLOSED TREE
Backed out changeset 49be1caf6501 (bug 1695817)
Backed out changeset 30f1382d6058 (bug 1695817)
Backed out changeset ab9fa7f3b633 (bug 1695817)
Backed out changeset b03b122438cc (bug 1695817)
Backed out changeset 812a6bbfbe0e (bug 1695817)
Backed out changeset 3551230a7522 (bug 1695817)
Backed out changeset c7354b48fbee (bug 1695817)
Backed out changeset 4860450c2e23 (bug 1695817)
Backed out changeset 29dee289f866 (bug 1695817)
2021-05-28 07:52:30 +03:00
Toshihito Kikuchi
f86792fbca Bug 1695817 - Part 5: Add std::equal_range equivalent in MFBT. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D114598
2021-05-28 04:19:07 +00:00
Butkovits Atila
711401ea39 Backed out 9 changesets (bug 1695817) for causing failures at browser_all_files_referenced.js. CLOSED TREE
Backed out changeset df4086427aaf (bug 1695817)
Backed out changeset 119a24f8be08 (bug 1695817)
Backed out changeset fd277ae2a7b8 (bug 1695817)
Backed out changeset a2c86a645fa8 (bug 1695817)
Backed out changeset c73705233fc4 (bug 1695817)
Backed out changeset 0a80eea3c0fa (bug 1695817)
Backed out changeset 9af42c7a3ca7 (bug 1695817)
Backed out changeset a2d11a0849d5 (bug 1695817)
Backed out changeset ba3ddcc28cbf (bug 1695817)
2021-05-28 03:05:09 +03:00
Toshihito Kikuchi
1a79ad5407 Bug 1695817 - Part 5: Add std::equal_range equivalent in MFBT. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D114598
2021-05-27 21:14:14 +00:00
Jan Varga
c06f56c861 Bug 1709352 - Allow QMResult errors to use existing stack id and to increase the frame id during error propagation; r=dom-storage-reviewers,asuth,glandium
Differential Revision: https://phabricator.services.mozilla.com/D114243
2021-05-25 07:28:20 +00:00
Gerald Squelart
5cbf88670f Bug 1710145 - Deduction guide RefPtr(already_AddRefed<T>) -> RefPtr<T> - r=kmag
Differential Revision: https://phabricator.services.mozilla.com/D114809
2021-05-11 21:55:21 +00:00
Andi-Bogdan Postelnicu
eab549fd19 Bug 1519636 - Initial reformat of C/C++ code with clang-format version 12.0.0. r=sylvestre
clang-format version 12.0.0 (taskcluster-KEgO7qdgQ8uaewA6NkRnRA)

Differential Revision: https://phabricator.services.mozilla.com/D114211
2021-05-10 07:15:07 +00:00
Chris Fallin
2e5115af2e Bug 1704775 part 10 - Disable unsupported c++ tests. r=glandium
WASI doesn't support some c++ tests for threads, so
in this patch we just stubbed them out.

Differential Revision: https://phabricator.services.mozilla.com/D111815
2021-04-27 06:09:27 +00:00
Jan de Mooij
dca62ba9ee Bug 1706900 part 6 - Replace ShapeTable's custom hash table with a HashSet. r=jonco
This is much simpler and lets us tidy up the addProperty code more. It also makes
it easier to change ShapeTable for property maps in the future.

Lookup performance and memory usage appear to be similar for the two versions,
probably because ShapeTable used the same double-hashing algorithm and because
we can purge most ShapeTables on GC.

Differential Revision: https://phabricator.services.mozilla.com/D113089
2021-04-26 11:00:06 +00:00
Chris Fallin
c0d9956b61 Bug 1701885 part 6 - Fix signals for WASI. r=jandem,wingo
WASI lacks of the signals support yet, so this patch stubs out
uses of signals for WASI.

Differential Revision: https://phabricator.services.mozilla.com/D110216
2021-04-20 05:15:28 +00:00
Dmitry Bezhetskov
3cc53df2c0 Bug 1701879 part 5 - Add stub atomics implementation for WASI. r=wingo,glandium
WASI lacks of the <atomic> support yet, so this patch is adding stub
implementation of atomics for WASI.

Differential Revision: https://phabricator.services.mozilla.com/D110215
2021-04-20 05:15:28 +00:00
Mike Hommey
6a41d8d7ad Bug 1515229 - Make MozStackWalk/MozWalkTheStack frame skipping more reliable. r=gerald,nika,bobowen,jld
Differential Revision: https://phabricator.services.mozilla.com/D110899
2021-04-16 04:06:02 +00:00
Butkovits Atila
8255e3083f Backed out changeset 5c6b15fcea71 (bug 1515229) for causing GTest failures. CLOSED TREE 2021-04-15 13:37:29 +03:00
Mike Hommey
2eacd46d46 Bug 1515229 - Make MozStackWalk/MozWalkTheStack frame skipping more reliable. r=gerald,nika,bobowen,jld
Differential Revision: https://phabricator.services.mozilla.com/D110899
2021-04-14 22:31:36 +00:00
Emilio Cobos Álvarez
80439edf68 Bug 1699844 - Add an escape hatch for the refcounted inside lambda checker. r=andi
Allow using the MOZ_KnownLive function to get around it.

Use case is the following: I have an std::function member variable, and I want
that member to be able to capture `this`.

Using a strong reference creates a cycle and thus would leak. I know `this` to
always outlive the member, so it is fine to use a weak capture there.

Differential Revision: https://phabricator.services.mozilla.com/D111850
2021-04-14 19:12:02 +00:00
smolnar
22c6eb14ba Backed out changeset f7b0cdc3aeb0 (bug 1515229) for causing xpc failures in test_feature_stackwalking. CLOSED TREE 2021-04-14 12:25:37 +03:00
Mike Hommey
133396cb94 Bug 1515229 - Make MozStackWalk/MozWalkTheStack frame skipping more reliable. r=gerald,nika,bobowen,jld
Differential Revision: https://phabricator.services.mozilla.com/D110899
2021-04-14 04:47:09 +00:00
Chris Fallin
605271bd29 Bug 1701620 part 4 - Fix memory support for WASI. r=jandem,sfink
WASI lacks of support many memory stuff like mmap, memory protections and etc, but
it has malloc so we can use it instead. Also, here we are stubbing out all
uses of the missing WASI memory functionality.

Differential Revision: https://phabricator.services.mozilla.com/D110075
2021-04-13 08:25:10 +00:00
Csoregi Natalia
91bd333c25 Backed out changeset f48cb748519b (bug 1701620) for bustage on Memory.cpp. CLOSED TREE 2021-04-13 10:09:41 +03:00
Chris Fallin
4e5ae46c03 Bug 1701620 part 4 - Fix memory support for WASI. r=jandem,sfink
WASI lacks of support many memory stuff like mmap, memory protections and etc, but
it has malloc so we can use it instead. Also, here we are stubbing out all
uses of the missing WASI memory functionality.

Differential Revision: https://phabricator.services.mozilla.com/D110075
2021-04-13 06:50:13 +00:00
Chris Fallin
f062cdc9ba Bug 1701613 part 3 - Add stub thread implementation for WASI. r=jandem,wingo
WASI lacks thread support so the stub implementation for threads has been added.

Differential Revision: https://phabricator.services.mozilla.com/D110073
2021-04-08 08:02:16 +00:00
Emilio Cobos Álvarez
0b9fa22976 Bug 1701942 - Use bitwise equality for font variation value comparisons. r=jfkthame
Just like we do for font sizes / size-adjust in gfxFontStyle.

Differential Revision: https://phabricator.services.mozilla.com/D110519
2021-04-02 12:37:23 +00:00
Simon Giesecke
f1f098cdaa Bug 1700336 - Use MaybeStorageBase in Maybe. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D109487
2021-03-24 13:21:31 +00:00
Simon Giesecke
ae75c3faa8 Bug 1601556 - Make Result<V, E> a literal type if V and E are literal types and PackingStrategy is not Variant. r=emilio
Also make CompactPair<A, B> a literal type if A and B are literal types,
and add MaybeStorageBase that ought to be used as a basis of MaybeStorage
in a follow-up patch.

Differential Revision: https://phabricator.services.mozilla.com/D55930
2021-03-23 12:35:19 +00:00
Mike Hommey
4d8e18962b Bug 1699375 - Move WalkTheStack to mozglue. r=nika
A long standing issue is that MOZ_ASSERT and related don't print stack
traces in debug builds when they're directly or indirectly emitted from
non-libxul code. Moving WalkTheStack to mozglue alleviates the problem.

It's also not printing stack traces when emitted from C code (and for
some C third party libraries, we do redirect assert to MOZ_ASSERT),
which we solve by making the corresponding API available without C++
(which WalkTheStack being a static method of the nsTraceRefCnt class
didn't allow, or the use of a closure on Android).

This requires some adjustements to headers that indirectly assume that
Assertions.h includes ErrorList.h through nsError.h through nscore.h
through nsTraceRefcnt.h.

We also remove TestStackCrawl.cpp because it hasn't been built since
bug 158528, 19 years ago.

Differential Revision: https://phabricator.services.mozilla.com/D108913
2021-03-22 21:25:30 +00:00
Chris Peterson
7cba58e66d Bug 1571631 - Remove MOZ_MUST_USE definition. r=sg
Depends on D108345

Differential Revision: https://phabricator.services.mozilla.com/D108346
2021-03-17 03:01:21 +00:00
Chris Peterson
7bc752e42b Bug 1571631 - Replace MOZ_MUST_USE with [[nodiscard]] in mfbt. r=sg
Also move MOZ_MUST_USE before function declarations' specifiers and return type. While clang and gcc's __attribute__((warn_unused_result)) can appear before, between, or after function specifiers and return types, the [[nodiscard]] attribute must precede the function specifiers.

Depends on D108344

Differential Revision: https://phabricator.services.mozilla.com/D108345
2021-03-17 03:01:21 +00:00
Mike Hommey
f00f1ea9b3 Bug 1690167 - Allocate some memory before running RandomNum tests. r=Gankra
Because the previous commit changed how MFBT tests are linked, they now
use mozjemalloc. Mozjemalloc randomizes small allocations, which id does
by using MFBT's RandomNum. The code in RandomNum, on mac, uses a system
API that allocates memory. So mozjemalloc has some code to handle the
recursion gracefully.

When the RandomNum test runs, it essentially only runs the RNG... which
goes on to allocate memory, which then goes into the RNG. Needless to
say, that doesn't go well. In typical cases, this is not the type of
things that would happen, but it does happen for that one test.

We work around the issue by allocating memory first, which is actually
hard, because compilers like to optimize unused allocations away. So we
turn the existing code into one that uses an allocation instead of an
array on the stack.

Differential Revision: https://phabricator.services.mozilla.com/D105242
2021-03-10 23:52:41 +00:00
Mike Hommey
9c0fcac97c Bug 1690167 - Change VsprintfLiteral/SprintfLiteral to rely on PrintfTarget. r=nika,Gankra,firefox-build-system-reviewers,mhentges
Instead of snprintf.

Because some standalone code uses those functions directly or indirectly,
and PrintfTarget lives in mozglue, they now need to depend on mozglue
instead of mfbt. Except logalloc/replay, which cherry-picks what it
uses, and the updater, for which we keep using vsnprintf.

Differential Revision: https://phabricator.services.mozilla.com/D103730
2021-03-10 23:52:40 +00:00
Mike Hommey
3e40e0ce40 Bug 1690167 - Move Sprintf.h and IntegerPrintfMacros.h next to Printf.h. r=jwalden
Which means they move from MFBT to mozglue.

Differential Revision: https://phabricator.services.mozilla.com/D103728
2021-03-10 23:52:39 +00:00
Kagami Sascha Rosylight
a2323b59a0 Bug 1691515 - Add MOZ_KNOWN_LIVE member annotation r=andi
Differential Revision: https://phabricator.services.mozilla.com/D107321
2021-03-05 23:23:03 +00:00
Andreea Pavel
64289058b6 Backed out 5 changesets (bug 1690167) for failing xpcshell at bootstrapSvc.js on a CLOSED TREE
Backed out changeset d28c0f11743f (bug 1690167)
Backed out changeset 3b2bebed9128 (bug 1690167)
Backed out changeset 7e925e90a251 (bug 1690167)
Backed out changeset f85934a2b7ad (bug 1690167)
Backed out changeset 6d83474e81bb (bug 1690167)
2021-02-17 07:10:58 +02:00
Tooru Fujisawa
037aa4c5dc Bug 1690274 - Part 2: Add mozilla::BitBloomFilter. r=sg
Differential Revision: https://phabricator.services.mozilla.com/D104690
2021-02-16 22:07:05 +00:00
Tooru Fujisawa
b1044551e9 Bug 1690274 - Part 1: Rename mozilla::BloomFilter to mozilla::CountingBloomFilter. r=sg
Differential Revision: https://phabricator.services.mozilla.com/D104689
2021-02-16 22:07:05 +00:00
Mike Hommey
25c8cf7dd2 Bug 1690167 - Allocate some memory before running RandomNum tests. r=Gankra
Because the previous commit changed how MFBT tests are linked, they now
use mozjemalloc. Mozjemalloc randomizes small allocations, which id does
by using MFBT's RandomNum. The code in RandomNum, on mac, uses a system
API that allocates memory. So mozjemalloc has some code to handle the
recursion gracefully.

When the RandomNum test runs, it essentially only runs the RNG... which
goes on to allocate memory, which then goes into the RNG. Needless to
say, that doesn't go well. In typical cases, this is not the type of
things that would happen, but it does happen for that one test.

We work around the issue by allocating memory first, which is actually
hard, because compilers like to optimize unused allocations away. So we
turn the existing code into one that uses an allocation instead of an
array on the stack.

Differential Revision: https://phabricator.services.mozilla.com/D105242
2021-02-16 21:20:05 +00:00
Mike Hommey
622b111f9e Bug 1690167 - Change VsprintfLiteral/SprintfLiteral to rely on PrintfTarget. r=nika,Gankra,firefox-build-system-reviewers,mhentges
Instead of snprintf.

Because some standalone code uses those functions directly or indirectly,
and PrintfTarget lives in mozglue, they now need to depend on mozglue
instead of mfbt. Except logalloc/replay, which cherry-picks what it
uses.

Differential Revision: https://phabricator.services.mozilla.com/D103730
2021-02-16 21:20:04 +00:00
Mike Hommey
900d63959b Bug 1690167 - Move Sprintf.h and IntegerPrintfMacros.h next to Printf.h. r=jwalden
Which means they move from MFBT to mozglue.

Differential Revision: https://phabricator.services.mozilla.com/D103728
2021-02-16 21:20:03 +00:00
Mihai Alexandru Michis
9154148880 Backed out 4 changesets (bug 1690167) for causing cppunit failures in TestIntegerPrintfMacros.
CLOSED TREE

Backed out changeset 27dee66eba83 (bug 1690167)
Backed out changeset cfffb092a39f (bug 1690167)
Backed out changeset 87b2a2a66fd9 (bug 1690167)
Backed out changeset cac4879f50b4 (bug 1690167)
2021-02-13 00:07:00 +02:00
Mike Hommey
47675f5460 Bug 1690167 - Change VsprintfLiteral/SprintfLiteral to rely on PrintfTarget. r=nika,Gankra,firefox-build-system-reviewers,mhentges
Instead of snprintf.

Because some standalone code uses those functions directly or indirectly,
and PrintfTarget lives in mozglue, they now need to depend on mozglue
instead of mfbt. Except logalloc/replay, which cherry-picks what it
uses.

Differential Revision: https://phabricator.services.mozilla.com/D103730
2021-02-12 20:21:50 +00:00
Mike Hommey
6c2fd9938a Bug 1690167 - Move Sprintf.h and IntegerPrintfMacros.h next to Printf.h. r=jwalden
Which means they move from MFBT to mozglue.

Differential Revision: https://phabricator.services.mozilla.com/D103728
2021-02-12 20:21:49 +00:00
Andreas Pehrson
4c76709406 Bug 1666487 - Constify some RollingMean getters. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D95697
2021-02-11 13:38:48 +00:00
Jan de Mooij
f6d06e1e8c Bug 944846 part 3 - Increase DoubleToStringConverter::kMaxFixedDigitsAfterPoint from 60 to 100. r=glandium
We need to support values up to 100 for `Number.prototype.toFixed`.

See https://262.ecma-international.org/11.0/#sec-number.prototype.tofixed

Differential Revision: https://phabricator.services.mozilla.com/D104521
2021-02-10 13:42:17 +00:00
Sean Feng
3ae0be12e8 Bug 1667836 - Add CC support to LinkedList r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D103798
2021-02-09 18:54:47 +00:00
Nika Layzell
f07fc1f61f Bug 1687391 - Avoid using a spinlock in ThreadSafeWeakReference, r=glandium,mccr8,Gankra,sg
This new approach to weak references is roughly modeled after the approach used
by Rust's Arc<T>, and uses an atomic compare-and-swap loop to perform weak to
strong reference upgrades. This approach ends up moving the strong reference
count out of the tracked object and into the weak reference object, as the
strong reference count atomic needs to outlife the object itself.

Rust's Arc Weak::upgrade implementation:
d98d2f57d9/library/alloc/src/sync.rs (L1806-L1837)

Differential Revision: https://phabricator.services.mozilla.com/D102245
2021-02-03 17:00:04 +00:00
Bogdan Tara
369c9ff89b Backed out changeset cf95a79e64f6 (bug 1687391) for bustges complaining about ThreadSafeWeakPtr CLOSED TREE 2021-02-03 18:39:22 +02:00
Nika Layzell
33d14ac4a6 Bug 1687391 - Avoid using a spinlock in ThreadSafeWeakReference, r=glandium,mccr8,Gankra,sg
This new approach to weak references is roughly modeled after the approach used
by Rust's Arc<T>, and uses an atomic compare-and-swap loop to perform weak to
strong reference upgrades. This approach ends up moving the strong reference
count out of the tracked object and into the weak reference object, as the
strong reference count atomic needs to outlife the object itself.

Rust's Arc Weak::upgrade implementation:
d98d2f57d9/library/alloc/src/sync.rs (L1806-L1837)

Differential Revision: https://phabricator.services.mozilla.com/D102245
2021-02-03 16:16:44 +00:00
Simon Giesecke
9c23bfdb2e Bug 1685677 - Extract functions from CheckTemporaryStorageLimits and rename it to CleanupTemporaryStorage. r=dom-workers-and-storage-reviewers,janv
Extracts parts of CheckTemporaryStorageLimits into the following new private
member functions of QuotaManager:
* LockedGetOriginInfosExceedingGroupLimit
* LockedGetOriginInfosExceedingGlobalLimit
* GetOriginInfosExceedingLimits
* ClearOrigins

Differential Revision: https://phabricator.services.mozilla.com/D101145
2021-02-02 17:46:40 +00:00
Csoregi Natalia
74e4cf16bf Backed out 5 changesets (bug 1689967, bug 1685677) for bustage on TestFlatten.cpp. CLOSED TREE
Backed out changeset 129b45a961fb (bug 1689967)
Backed out changeset d354b3d5312c (bug 1685677)
Backed out changeset 3c1b1f51f19c (bug 1685677)
Backed out changeset cc4f20677a7e (bug 1685677)
Backed out changeset bcbba85964cb (bug 1685677)
2021-02-02 17:05:23 +02:00
Simon Giesecke
e4a5513e58 Bug 1685677 - Extract functions from CheckTemporaryStorageLimits and rename it to CleanupTemporaryStorage. r=dom-workers-and-storage-reviewers,janv
Extracts parts of CheckTemporaryStorageLimits into the following new private
member functions of QuotaManager:
* LockedGetOriginInfosExceedingGroupLimit
* LockedGetOriginInfosExceedingGlobalLimit
* GetOriginInfosExceedingLimits
* ClearOrigins

Differential Revision: https://phabricator.services.mozilla.com/D101145
2021-02-02 12:53:44 +00:00
smolnar
d18d54a300 Backed out 4 changesets (bug 1685677) for causing build bustage in TestFlatten. CLOSED TREE DONTBUILD
Backed out changeset 0110eb26213b (bug 1685677)
Backed out changeset e3223c398959 (bug 1685677)
Backed out changeset d1fbaf6882a3 (bug 1685677)
Backed out changeset e1e26422161e (bug 1685677)
2021-02-02 14:46:30 +02:00
Simon Giesecke
0da4951ba0 Bug 1685677 - Extract functions from CheckTemporaryStorageLimits and rename it to CleanupTemporaryStorage. r=dom-workers-and-storage-reviewers,janv
Extracts parts of CheckTemporaryStorageLimits into the following new private
member functions of QuotaManager:
* LockedGetOriginInfosExceedingGroupLimit
* LockedGetOriginInfosExceedingGlobalLimit
* GetOriginInfosExceedingLimits
* ClearOrigins

Differential Revision: https://phabricator.services.mozilla.com/D101145
2021-02-02 10:10:21 +00:00
Butkovits Atila
cc5cb272ff Backed out 2 changesets (bug 1685677) for causing xpcshell failure. CLOSED TREE
Backed out changeset 26e9adf102c8 (bug 1685677)
Backed out changeset ed3a62552625 (bug 1685677)
2021-02-01 22:54:39 +02:00
Simon Giesecke
f78d2e7d7e Bug 1685677 - Extract functions from CheckTemporaryStorageLimits and rename it to CleanupTemporaryStorage. r=dom-workers-and-storage-reviewers,janv
Extracts parts of CheckTemporaryStorageLimits into the following new private
member functions of QuotaManager:
* LockedGetOriginInfosExceedingGroupLimit
* LockedGetOriginInfosExceedingGlobalLimit
* GetOriginInfosExceedingLimits
* ClearOrigins

Differential Revision: https://phabricator.services.mozilla.com/D101145
2021-02-01 14:42:15 +00:00
Jan Varga
165dbaf2e5 Bug 1689802 - Fix construction of MovingNotNull from NotNull; r=sg
Depends on D103556

Differential Revision: https://phabricator.services.mozilla.com/D103632
2021-02-01 13:52:31 +00:00
smolnar
0fc1e1e521 Backed out 4 changesets (bug 1685677) for causing xpcshell failures in test_storagePressure. CLOSED TREE
Backed out changeset 263d593f8609 (bug 1685677)
Backed out changeset 81a737afce4f (bug 1685677)
Backed out changeset ea958694bd17 (bug 1685677)
Backed out changeset 121e93b3787f (bug 1685677)
2021-02-01 16:38:01 +02:00
Simon Giesecke
1134a78170 Bug 1685677 - Extract functions from CheckTemporaryStorageLimits and rename it to CleanupTemporaryStorage. r=dom-workers-and-storage-reviewers,janv
Extracts parts of CheckTemporaryStorageLimits into the following new private
member functions of QuotaManager:
* LockedGetOriginInfosExceedingGroupLimit
* LockedGetOriginInfosExceedingGlobalLimit
* GetOriginInfosExceedingLimits
* ClearOrigins

Differential Revision: https://phabricator.services.mozilla.com/D101145
2021-02-01 13:37:30 +00:00
Mike Hommey
990995c428 Bug 1689281 - Remove MFBT_DATA for kBase10MaximalLength. r=nika
It was added in bug 614188. 8 years have passed, and it doesn't seem
necessary anymore (if it ever was).

Differential Revision: https://phabricator.services.mozilla.com/D103265
2021-01-28 16:50:14 +00:00
Mike Hommey
2b96dd066d Bug 1686831 - Allow double-conversion's ToFixed to handle ±DBL_MAX. r=nika
While at this point PrintfTarget doesn't use double-conversion, add a
test that it can (and thus will) handle the largest double output possible
with the default %f precision.

Differential Revision: https://phabricator.services.mozilla.com/D103431
2021-01-29 16:54:03 +00:00
Mike Hommey
504ef77af2 Bug 1686831 - Handle trailing zero removal in double-conversion. r=nika,jwalden,Gankra
Bug 608915 switched nsString::AppendFloat to double-conversion, while
handling trailing zero removal on its own. This can be made more
effectively when doing so in double-conversion itself, support for which
was merged upstream in https://github.com/google/double-conversion/pull/149.

This makes the used_exponential_notation outparam unnecessary.

Differential Revision: https://phabricator.services.mozilla.com/D102698
2021-01-29 04:25:53 +00:00
Mike Hommey
cc35b21767 Bug 1686831 - Update double-conversion to upstream revision bf46072. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D103134
2021-01-29 04:25:27 +00:00
Tooru Fujisawa
78aa883d23 Bug 1687428 - Part 28: Store TaggedParserAtomIndex in ParserAtomsTable. r=nbp
As a preparation to remove `index_` field from ParserAtomEntry,
ParserAtomsTable should maintain a map from ParserAtomEntry pointer to
TaggedParserAtomIndex.

Differential Revision: https://phabricator.services.mozilla.com/D102559
2021-01-29 19:43:02 +00:00
Csoregi Natalia
8db3ebb5da Backed out 9 changesets (bug 1686831) for sanitizer failures on nsTSubstring.cpp. CLOSED TREE
Backed out changeset 0e03d508c8d4 (bug 1686831)
Backed out changeset cf6dd6eab427 (bug 1686831)
Backed out changeset 308000f1e14b (bug 1686831)
Backed out changeset c4d470be0184 (bug 1686831)
Backed out changeset 9751918b1ccb (bug 1686831)
Backed out changeset dd9b7e71dcfb (bug 1686831)
Backed out changeset 486a184530a7 (bug 1686831)
Backed out changeset b64d3e89bf68 (bug 1686831)
Backed out changeset dcc6396e455a (bug 1686831)
2021-01-28 09:55:28 +02:00
Mike Hommey
411ab98ac3 Bug 1686831 - Handle trailing zero removal in double-conversion. r=nika,jwalden,Gankra
Bug 608915 switched nsString::AppendFloat to double-conversion, while
handling trailing zero removal on its own. This can be made more
effectively when doing so in double-conversion itself, support for which
was merged upstream in https://github.com/google/double-conversion/pull/149.

This makes the used_exponential_notation outparam unnecessary.

Differential Revision: https://phabricator.services.mozilla.com/D102698
2021-01-27 01:06:34 +00:00
Mike Hommey
f1201eb9e4 Bug 1686831 - Update double-conversion to upstream revision bf46072. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D103134
2021-01-28 05:01:47 +00:00
Jan de Mooij
8a7633e993 Bug 1687441 part 7 - Add NumberEqualsInt64 and NumberIsInt64 to MFBT. r=sg
Tests based on the Int32 tests, with changes/tests for very large/small values.

Differential Revision: https://phabricator.services.mozilla.com/D102724
2021-01-27 15:52:29 +00:00
Jon Coppeard
692d8936cd Bug 1686219 - Add BitSet::SetAll and ResetAll methods r=heycam
These set or clear every bit, taking care not to set trailing unused bits at the end of storage.

Differential Revision: https://phabricator.services.mozilla.com/D101775
2021-01-20 10:03:53 +00:00
Ryan VanderMeulen
0eb8fd796c Bug 1682604 - Update lz4 to 1.9.3. r=sg
Differential Revision: https://phabricator.services.mozilla.com/D99816
2021-01-19 14:13:47 +00:00
Simon Giesecke
55236f5ccb Bug 1685679 - Add do_Init function to allow assignment to InitializedOnce variables. r=janv
Differential Revision: https://phabricator.services.mozilla.com/D101143
2021-01-15 11:23:41 +00:00
Ryan VanderMeulen
691f671c7b Bug 1656894 - Update xxHash to version 0.8.0. r=dthayer
Differential Revision: https://phabricator.services.mozilla.com/D85767
2021-01-12 16:20:32 +00:00
Kartik Gautam
7ae6aea145 Bug 1684173 - Add newline character at end of files when missing r=sylvestre,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D100484
2021-01-07 08:53:08 +00:00
Masatoshi Kimura
fa4cb37973 Bug 1684110 - Stop using some 'A'-functions in mfbt/. r=dmajor
Depends on D100464

Differential Revision: https://phabricator.services.mozilla.com/D100465
2021-01-04 14:40:48 +00:00
Cosmin Sabou
2978aa00a3 Backed out changeset dbed1cdf588f (bug 1684173) for mochitest plain and devtools failures. a=backout DONTBUILD 2020-12-28 00:43:51 +02:00
Kartik Gautam
775cdec032 Bug 1684173 - Add newline character at end of files when missing r=sylvestre
Depends on D100443

Differential Revision: https://phabricator.services.mozilla.com/D100484
2020-12-27 11:43:41 +00:00
Simon Giesecke
7326b3cd81 Bug 1410760 - Fix comment on NotNull<UniquePtr<T>>. r=gerald DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D100322
2020-12-22 11:11:21 +00:00
Ting-Yu Lin
fd531e4c1a Bug 1683227 - Add a note to Maybe::valueOr() about a suboptimal usage. r=sg DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D100071
2020-12-21 18:32:26 +00:00
Alexis Beingessner
70c9b7ef2c Bug 1681546 - rename MOZ_ATOMIC_BITFIELDS methods to Load/Store. r=valentin,necko-reviewers
I was running into issues where these names would conflict with the type's own Get/Set methods
and these names have the added benefit of indicating a bit more that atomic stuff is going on.

Differential Revision: https://phabricator.services.mozilla.com/D99268
2020-12-09 18:14:55 +00:00
Simon Giesecke
8c5c02b43d Bug 1680724 - Add a utility function that converts a T* to a Maybe<T&>. r=jwalden
Differential Revision: https://phabricator.services.mozilla.com/D98783
2020-12-08 17:49:22 +00:00
Chris Fronk
a7c75776e8 Bug 1432988 - Add hash for pair types. r=botond
Add HashFunctions for std::pair and CompactPair to mfbt

Differential Revision: https://phabricator.services.mozilla.com/D97865
2020-12-04 21:57:03 +00:00
André Bargull
24afd99138 Bug 1679611 - Part 2: Add test for BufferList::RangeLength. r=sfink
Add tests to cover the cases when the start iterator is in different segments
and within segments at different positions.

Also assert that `mSegment <= aTarget.mSegment`, so it's more easy to see
that `aTarget` mustn't point to an earlier segment.

Depends on D98340

Differential Revision: https://phabricator.services.mozilla.com/D98462
2020-12-02 18:48:22 +00:00
André Bargull
d0ba81b597 Bug 1679611 - Part 1: Use next segment as the starting point. r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D98340
2020-12-02 17:23:07 +00:00
Gerald Squelart
0e7e45ed66 Bug 1500811 - Variant::as()&&, match()&& - r=sg
`as<...>()` on an rvalue variant returns the contained value as rvalue-reference.
`match()` on an rvalue variant forwards the contained value as rvalue-reference.
So now the contained values can be efficiently moved-from.

There are also equivalents for `const&&`, which should be rare.

For `match(2+ matchers)`, the static_assert for same return types has been moved to `Impl::matchN`. Also, it doesn't rely on `FunctionTypeTraits` anymore, which has the added benefit of allowing `auto` in individual matchers.

Differential Revision: https://phabricator.services.mozilla.com/D98050
2020-12-02 00:17:46 +00:00
Gerald Squelart
32c0d65819 Bug 1500811 - Maybe::operator*()&&, ref()&&, value()&& - r=sg,sfink
There are also equivalents for `const&&`, which should be rare.

The small change in `LiveSavedFrameCache::insert` was necessary because `*lookup.framePtr()` now returns an rvalue-ref (as it should).

Differential Revision: https://phabricator.services.mozilla.com/D98049
2020-12-02 00:14:41 +00:00