Граф коммитов

2367 Коммитов

Автор SHA1 Сообщение Дата
Julian Seward 518297a7d8 Bug 1795644 - A bit of tuning of inlining in the JS parser. r=arai.
Some profiling of tcampbell's React benchmark [1] shows 6.1 million calls to
js::frontend::GeneralTokenStreamChars<..>::getFullAsciiCodePoint, using 110.57
million instructions (x86_64).  That comes out to only 18 insns per call,
which suggests the method is a good candidate for inlining, but it isn't
inlined.

Merely parking an inline annotation on it doesn't help much, because it gets
inlined into js::frontend::TokenStreamSpecific<..>::getCodePoint, but that
isn't inlined into *its* caller(s), so the 6.1 million calls move to
::getCodePoint instead.

This patch requests inlining for both ::getFullAsciiCodePoint and
::getCodePoint and adds some MOZ_NEVER_INLINE annotations to ensure that cold
paths *don't* get inlined into these two, to reduce code bloat and avoid
excessive register pressure.

IsAscii functions in mfbt/TextUtils.h have been marked inline as a precaution;
this probably isn't necessary.

Run time with config [2] is reduced from 0.390 seconds to 0.379 seconds
(2.8% speedup, best of 50 runs), and from 0.402 to 0.396 seconds
(median of 50 runs).

Instruction count falls from 3511.8 million to 3395.8 million, and the number
of data accesses from 1563.7 million to 1487.4 million -- a 4.8% reduction
that is probably caused by avoidance of save/restore sequences in the inlined
fns.

[1] https://github.com/mozilla-spidermonkey/matrix-react-bench

[2] Fedora 35, x86_64, Intel Core i5 1135G7 at 4 ish GHz
    configure: --disable-debug --enable-optimize="-g -O2"
    run:       --no-threads

Differential Revision: https://phabricator.services.mozilla.com/D159500
2022-10-18 05:22:03 +00:00
Nika Layzell 7210a4bca7 Bug 1783242 - Part 3: Remove BufferList::Extract, r=glandium,ipc-reviewers,mccr8
The only uses of this method were removed in Part 1, meaning that it can
now be removed. Support for this method adds a significant amount of
complexity to `BufferList` and IPC serialization.

Differential Revision: https://phabricator.services.mozilla.com/D154439
2022-09-28 19:25:14 +00:00
Peter Van der Beken bd1c6c4d03 Bug 1788969 - Correct ForEach Tuple helper functions. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D156322
2022-09-22 18:28:15 +00:00
Sandor Molnar 141cdeeed6 Backed out 11 changesets (bug 1788969, bug 1782400, bug 1777145) for causing bp-hybri bustages. CLOSED TREE
Backed out changeset 8acabb924ef7 (bug 1782400)
Backed out changeset e3d452e99f77 (bug 1782400)
Backed out changeset 5727bc4895d2 (bug 1777145)
Backed out changeset cf375034e2b8 (bug 1777145)
Backed out changeset a50fd5608d8d (bug 1777145)
Backed out changeset f24853cacd7a (bug 1777145)
Backed out changeset c714f3a35b11 (bug 1777145)
Backed out changeset 56682c253427 (bug 1788969)
Backed out changeset edaf37ffc49d (bug 1788969)
Backed out changeset d19caa9f062b (bug 1788969)
Backed out changeset 18b26912dc03 (bug 1788969)
2022-09-22 19:13:01 +03:00
Peter Van der Beken 7650d454e8 Bug 1788969 - Correct ForEach Tuple helper functions. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D156322
2022-09-22 15:02:22 +00:00
Jan-Niklas Jaeschke 4265f72859 Bug 1777925: Replaced MutationObserver array container type with linked list. r=smaug
Deletion of mutation observers from a list resulted in O(n^2) behavior and could lead to massive freezes.
This is resolved by using a LinkedList instead, reducing complexity to O(n).

A safely iterable doubly linked list was implemented based on `mozilla::DoublyLinkedList`,
allowing to insert and remove elements while iterating the list.

Due to the nature of `mozilla::DoublyLinkedList`, every Mutation Observer now inherits `mozilla::DoublyLinkedListElement<T>`.
This implies that a Mutation Observer can only be part of one DoublyLinkedList.
This conflicts with some Mutation Observers, which are being added to multiple `nsINode`s.
To continue supporting this, new MutationObserver base classes `nsMultiMutationObserver` and `nsStubMultiMutationObserver` are introduced,
which create `MutationObserverWrapper` objects each time they are added to a `nsINode`.
The wrapper objects forward every call to the actual observer.

Differential Revision: https://phabricator.services.mozilla.com/D157031
2022-09-21 11:31:44 +00:00
Ryan VanderMeulen 9dc15db244 Bug 1784990 - Update lz4 to 1.9.4. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D154770
2022-08-31 16:10:45 +00:00
Nicolas B. Pierron 4d9b0fe251 Bug 1779940 part 2 - Add HashMap::put which relies on lookup. r=arai
The next patch is creating a cache which is capable of looking up different kind
of string types. However, each string type need some contextual information to
be able to compare them against each others, which adds complexity to the lookup
type. In addition, the keys are of only one string type, and therefore we try to
avoid storing this context as part of each key, but instead provide it with the
contextual information coming with the Lookup type.

Therefore, when we want to insert a key, which might already be present, using
`put`. We have to provide a `aLookup` argument which knows how to compare keys.

This also make the interface similar to `putNew` which already has the
distinctions between the `Lookup` argument and the `KeyInput` argument.

Differential Revision: https://phabricator.services.mozilla.com/D154512
2022-08-25 15:03:29 +00:00
Nick Alexander ba86996b7a Bug 1783051 - Turn default browser agent's `EventLog` into a Windows-only header utility. r=rkraesig
Differential Revision: https://phabricator.services.mozilla.com/D153658
2022-08-17 20:01:58 +00:00
Gerald Squelart 42904cee2c Bug 1784812 - Make all JSONWriteFunc-derived classes and their overriden methods final - r=canaltinova
All JSONWriteFuncs are effectively final, this patch enforces that, hopefully
helping the compiler to de-virtualize some calls.

Differential Revision: https://phabricator.services.mozilla.com/D154619
2022-08-17 07:07:54 +00:00
Gerald Squelart eb90b3b175 Bug 1784812 - JSONWriter may optionally not own its writer - r=canaltinova
mWriter is now a reference, and the ownership is optional through a separate
member variable that could stay null.
User can now choose to keep the JSONWriteFunc on their stack, which saves a
heap allocation, and makes it easier to access the concrete JSONWriteFunc
implementation directly (instead of through WriteFunc()).

Differential Revision: https://phabricator.services.mozilla.com/D154617
2022-08-17 07:07:53 +00:00
Gerald Squelart 24798f281f Bug 1784812 - JSONWriter::WriteFunc() returns a reference - r=canaltinova
mWriter is never null (and lots of calls just dereference it without checking),
so we may as well enforce it:
- The constructor MOZ_RELEASE_ASSERTs that it's not null.
- The accessor WriteFunc() returns a reference instead of a scary raw pointer.

(Note that we can't make mWriter a NotNull<...>, because the next patch will
give the option to keep that owning pointer null.)

Differential Revision: https://phabricator.services.mozilla.com/D154616
2022-08-17 07:07:53 +00:00
André Bargull e9319e5454 Bug 1768632: Make EnumSet compile for MSVC. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D154338
2022-08-17 06:39:12 +00:00
Iulian Moraru 859487ba6b Backed out 4 changesets (bug 1784812) for causing build bustages on DDMediaLogs. CLOSED TREE
Backed out changeset c9998c927079 (bug 1784812)
Backed out changeset d2568bc2f8a6 (bug 1784812)
Backed out changeset 9f01bf89c583 (bug 1784812)
Backed out changeset d8506496d8f2 (bug 1784812)
2022-08-17 05:48:36 +03:00
Gerald Squelart d7c05cb55e Bug 1784812 - Make all JSONWriteFunc-derived classes and their overriden methods final - r=canaltinova
All JSONWriteFuncs are effectively final, this patch enforces that, hopefully
helping the compiler to de-virtualize some calls.

Depends on D154618

Differential Revision: https://phabricator.services.mozilla.com/D154619
2022-08-16 22:57:50 +00:00
Gerald Squelart 722fbce3cc Bug 1784812 - JSONWriter may optionally not own its writer - r=canaltinova
mWriter is now a reference, and the ownership is optional through a separate
member variable that could stay null.
User can now choose to keep the JSONWriteFunc on their stack, which saves a
heap allocation, and makes it easier to access the concrete JSONWriteFunc
implementation directly (instead of through WriteFunc()).

Depends on D154616

Differential Revision: https://phabricator.services.mozilla.com/D154617
2022-08-16 22:57:49 +00:00
Gerald Squelart 68a8dee9cc Bug 1784812 - JSONWriter::WriteFunc() returns a reference - r=canaltinova
mWriter is never null (and lots of calls just dereference it without checking),
so we may as well enforce it:
- The constructor MOZ_RELEASE_ASSERTs that it's not null.
- The accessor WriteFunc() returns a reference instead of a scary raw pointer.

(Note that we can't make mWriter a NotNull<...>, because the next patch will
give the option to keep that owning pointer null.)

Differential Revision: https://phabricator.services.mozilla.com/D154616
2022-08-16 22:57:48 +00:00
Ryan VanderMeulen 0a7a824985 Bug 1749348 - Update double-conversion to version 3.2.1. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D153810
2022-08-09 13:47:44 +00:00
Steve Fink bd14b2f73a Bug 1782562 - be more conservative in max Vector size r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D153682
2022-08-08 22:59:15 +00:00
Cristian Tuns d5fa74099d Backed out changeset 939dbca534a5 (bug 1782562) for causing SM bustages CLOSED TREE 2022-08-08 18:55:29 -04:00
Steve Fink f444f5dc7c Bug 1782562 - be more conservative in max Vector size r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D153682
2022-08-08 21:41:06 +00:00
Cristian Tuns 9b82462b70 Backed out changeset 7519215902c9 (bug 1782562) for causing spidermonkey bustages on bug1782468-ptrdiff-veclen.js CLOSED TREE 2022-08-08 13:05:40 -04:00
Steve Fink 002a3bad41 Bug 1782562 - be more conservative in max Vector size r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D153682
2022-08-08 16:38:52 +00:00
Emily McDonough 4bf16448f0 Bug 1782604 - Make UniquePtr(nullptr) constexpr r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D153405
2022-08-03 21:21:09 +00:00
Fabrice Desré c50cb528fc Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 16:39:41 +00:00
Andreea Pavel 3ccd75af8d Backed out changeset b9d2965591b9 (bug 1761040) for landing with wrong author CLOSED TREE DONTBUILD 2022-08-03 18:55:00 +03:00
Andreea Pavel fdb7cb2ecd Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-03 15:27:43 +00:00
Andreea Pavel 89d63c91e6 Backed out changeset a907159a482f (bug 1761040) for causing build bustages on a CLOSED TREE 2022-08-02 04:59:08 +03:00
Fabrice Desré 0f4ac7ad97 Bug 1761040 - Prefix thread safety macros with MOZ_ r=geckoview-reviewers,media-playback-reviewers,alwu,jesup,m_kato
Differential Revision: https://phabricator.services.mozilla.com/D152575
2022-08-02 00:49:41 +00:00
Doug Thayer a104274600 Bug 1782141 - Move SIMD/SSE files to mozglue r=iain
Differential Revision: https://phabricator.services.mozilla.com/D153264
2022-08-01 16:40:57 +00:00
Cristian Tuns c555cec677 Backed out 2 changesets (bug 1782141) for causing spidermonkey bustages on dependent.js CLOSED TREE
Backed out changeset 81b72f893608 (bug 1782141)
Backed out changeset bd07c6d3d9fe (bug 1782141)
2022-07-29 23:52:46 -04:00
Doug Thayer 2f04b79528 Bug 1782141 - Move SIMD/SSE files to mozglue r=iain
Differential Revision: https://phabricator.services.mozilla.com/D153264
2022-07-30 03:26:44 +00:00
Nika Layzell 997047e2a4 Bug 1772006 - Part 4: Simplify and move the string comparison APIs from ns[T]StringObsolete, r=xpcom-reviewers,necko-reviewers,dragana,barret
This patch moves EqualsIgnoreCase to ns[T]StringObsolete, and removes
the aCount argument, instead migrating callers to use `StringBeginsWith`
with a case-insensitive comparator.

In addition, nsTStringRepr::Compare was removed and replaced with either
calls to methods like `StringBeginsWith` or the global `Compare` method.

These changes required some modifications at call-sites but should make
the behaviour less surprising and more consistent.

Differential Revision: https://phabricator.services.mozilla.com/D148299
2022-07-30 00:12:48 +00:00
Doug Thayer 7768043bd0 Bug 1779807 - Split AVX2 code into its own compilation unit r=iain
I split this out into its own commit because it's a bit awkward to go back and
shuffle the old code around. If you'd like me to apply it to the history
though, just let me know.

This patch just moves all of the AVX2 code out from SIMD.cpp into SIMD_avx2.cpp
and removes the -mavx2 flag when compiling SIMD.cpp. On try this removes the
failure on M1 hardware when running the x64 binary.

Differential Revision: https://phabricator.services.mozilla.com/D152920
2022-07-29 03:26:07 +00:00
Doug Thayer c2cde6897f Bug 1779807 - Implement memchr64 in AVX2 r=iain
This only makes sense for AVX2, because widening it from a 64-bit comparison
to a 128-bit comparison is hardly worth it, and there are gaps in the SSE2
instruction set (missing _mm_cmpeq_epi64, which is introduced in SSE4.1) that
would require us to compensate and probably take a sizeable perf hit.

Differential Revision: https://phabricator.services.mozilla.com/D152297
2022-07-29 03:26:06 +00:00
Doug Thayer 1f10d44d74 Bug 1779807 - Support AVX2 for SIMD memchr r=iain
This showed a modest improvement in the geomean of my benchmarking, but
importantly it showed a consistent and relatively strong improvement across
all of the cases which I would guess are more realistic. Notably this change
makes it perform better at iteratively searching for the next occurrence of X
in the HTML of a large web page.

Differential Revision: https://phabricator.services.mozilla.com/D152296
2022-07-29 03:26:06 +00:00
Gerald Squelart d4726a9eca Bug 1774329 - If SingleLineStyle is set at construction, also remove spaces after colons and commas - r=florian
These were the last remaining JSON whitespace characters, so we can now our
regression tests can check that there are non of these left.

Differential Revision: https://phabricator.services.mozilla.com/D152607
2022-07-28 12:41:56 +00:00
Gerald Squelart a05b4ea2c2 Bug 1774329 - JSONWriter() can be single-line from the top, removing the final newline - r=florian
Differential Revision: https://phabricator.services.mozilla.com/D152602
2022-07-28 12:41:54 +00:00
Steve Fink 07e0016fe5 Bug 1774733 - Allow AllocPolicy to determine Vector growth policy, and be aggressive about StringBuilder allocation strategy to reduce memcpy'ing. r=jandem
Condition computeGrowth behavior on existence of AP::computeGrowth<S> method

Differential Revision: https://phabricator.services.mozilla.com/D151674
2022-07-27 22:59:51 +00:00
smolnar af5711925c Backed out 3 changesets (bug 1779807) for causing SM build failures. CLOSED TREE
Backed out changeset 68e92976dc0f (bug 1779807)
Backed out changeset f11ef6602f59 (bug 1779807)
Backed out changeset faa38e8360b1 (bug 1779807)
2022-07-26 00:44:58 +03:00
Doug Thayer 92a5c81749 Bug 1779807 - Implement memchr64 in AVX2 r=iain
This only makes sense for AVX2, because widening it from a 64-bit comparison
to a 128-bit comparison is hardly worth it, and there are gaps in the SSE2
instruction set (missing _mm_cmpeq_epi64, which is introduced in SSE4.1) that
would require us to compensate and probably take a sizeable perf hit.

Differential Revision: https://phabricator.services.mozilla.com/D152297
2022-07-25 21:21:37 +00:00
Doug Thayer 2a9b76d986 Bug 1779807 - Support AVX2 for SIMD memchr r=iain
This showed a modest improvement in the geomean of my benchmarking, but
importantly it showed a consistent and relatively strong improvement across
all of the cases which I would guess are more realistic. Notably this change
makes it perform better at iteratively searching for the next occurrence of X
in the HTML of a large web page.

Differential Revision: https://phabricator.services.mozilla.com/D152296
2022-07-25 21:21:37 +00:00
jake a61c54713b Bug 1780215 - Use arc4random_buf within GenerateRandomBytesFromOS when compiling to wasi r=jandem
wasi-libc provides arc4random methods - 7a21011e98/libc-top-half/musl/include/stdlib.h (L205-L213)

Without this change, js::GenerateRandomSeed will fallback to using a timestamp for the random seed (https://searchfox.org/mozilla-central/rev/3e1a721bce1da3ae04675539b39a4e95b25a046d/js/src/jsmath.cpp#491-494) which is used as both seed values within the PRNG(https://searchfox.org/mozilla-central/rev/3e1a721bce1da3ae04675539b39a4e95b25a046d/js/src/jsmath.cpp#501-502) - having the same value for both seeds seems to cause the first two PRNG calls to produce the same first 4 decimal places.

This change stops the timestamp fallback from being used when compiling to wasm/wasi which avoids this issue.

Differential Revision: https://phabricator.services.mozilla.com/D152180
2022-07-20 13:17:54 +00:00
Doug Thayer 67331b011d Bug 1776013 - Add SIMD memchr-like implementations to MFBT r=iain
Differential Revision: https://phabricator.services.mozilla.com/D150067
2022-07-14 18:30:27 +00:00
Norisz Fay 9112cf321e Backed out 2 changesets (bug 1776013) for causing spidermonkey bustages on SIMD.cpp CLOSED TREE
Backed out changeset bb467568da37 (bug 1776013)
Backed out changeset 9669cd465518 (bug 1776013)
2022-07-14 03:53:22 +03:00
Doug Thayer 2778034398 Bug 1776013 - Add SIMD memchr-like implementations to MFBT r=iain
Differential Revision: https://phabricator.services.mozilla.com/D150067
2022-07-14 00:39:22 +00:00
serge-sans-paille a909699ad6 Bug 1774863 - Cleanup mfbt includes r=sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D149669
2022-06-22 09:47:14 +00:00
Sylvestre Ledru 42f6811d95 Bug 1519636 - Reformat recent changes to the Google coding style r=andi,media-playback-reviewers,necko-reviewers,padenot,dragana
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D148375
2022-06-07 12:32:55 +00:00
Nika Layzell 0e6bc87c63 Bug 1743020 - Part 3: Export mozilla::MoveOnlyFunction based on function2, r=glandium
A custom defintion wrapping fu2::function_base is used to customize the
inline buffer's size and alignment to make it compatible with nsTArray.
Without the custom wrapper, `alignof(max_align_t)` is used, which is
larger than nsTArray's max alignment on some platforms.

Differential Revision: https://phabricator.services.mozilla.com/D145691
2022-06-02 13:24:10 +00:00
Jan de Mooij 69dd9e0ace Bug 1770158 part 1 - Add MFBT_API to StringToDouble. r=glandium
The update script successfully applies this diff to the upstream code.

Differential Revision: https://phabricator.services.mozilla.com/D146878
2022-05-31 07:48:15 +00:00