Commit graph

316 commits

Author SHA1 Message Date
Marian-Vasile Laza
5e48e30b98 Backed out 10 changesets (bug 1746090) for causing build bustages on TestingFunctions.cpp. CLOSED TREE
Backed out changeset edbf96722e4b (bug 1746090)
Backed out changeset f4e4bf6ba8ff (bug 1746090)
Backed out changeset c288fe1c6c84 (bug 1746090)
Backed out changeset 2b0caa13d0fc (bug 1746090)
Backed out changeset 1ed9d77885c6 (bug 1746090)
Backed out changeset 54a60388fb11 (bug 1746090)
Backed out changeset a9c16e721533 (bug 1746090)
Backed out changeset 774bdb9939a9 (bug 1746090)
Backed out changeset 5c5742535301 (bug 1746090)
Backed out changeset ff509fe4671d (bug 1746090)
2022-01-20 02:39:17 +02:00
Steve Fink
aea0c2fa07 Bug 1746090 - Switch RootList::init from taking an AutoCheckCannotGC token to returning one r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D135297
2022-01-20 00:23:10 +00:00
Kagami Sascha Rosylight
624a3640bf Bug 1669552 - Add TestUtils support for WPT r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D135942
2022-01-14 18:36:59 +00:00
Steve Fink
ec62429c88 Bug 1672121 - Implement interruptible GC slice budgets r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D109630
2021-12-22 18:06:06 +00:00
Iulian Moraru
193ccd13ad Backed out 5 changesets (bug 1672121) for various crashes on mozalloc_handle_oom. CLOSED TREE
Backed out changeset 117756828ea7 (bug 1672121)
Backed out changeset 046e37035dbc (bug 1672121)
Backed out changeset de44a280103b (bug 1672121)
Backed out changeset 4acf4539a7b4 (bug 1672121)
Backed out changeset 8001b5433e38 (bug 1672121)
2021-11-30 02:59:20 +02:00
Steve Fink
0181c4d9ce Bug 1672121 - Implement interruptible GC slice budgets r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D109630
2021-11-29 19:59:52 +00:00
Tooru Fujisawa
e9ea4e3088 Bug 538450 - Part 6: Remove GCRuntime::triggerFullGCForAtoms. r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D131368
2021-11-19 04:43:08 +00:00
Jon Coppeard
163eb9cddd Bug 1740254 - Check GC heap parameters are reasonable r=sfink
This adds a 4GB max limit for GC parameters related to heap size and fixes the
test that set this to an over-large value.

Differential Revision: https://phabricator.services.mozilla.com/D130749
2021-11-15 09:35:41 +00:00
Jon Coppeard
0060571eef Bug 1737240 - Part 1: Implement JS_UpdateWeakPointerAfterGC APIs using TraceWeakEdge r=mccr8,sfink
This requires passing the JSTracer through to these APIs. They also get a
boolean return value that simplifies their use a little.

Differential Revision: https://phabricator.services.mozilla.com/D129243
2021-11-10 13:01:42 +00:00
Jon Coppeard
772dfd06f5 Bug 1736602 - Part 1: Pass JSTracer to embedding callbacks which update weak pointers after moving GC r=sfink
The callbacks previously took a JSContext pointer which was never used.

Differential Revision: https://phabricator.services.mozilla.com/D128899
2021-11-08 12:23:55 +00:00
Sandor Molnar
0f0829d865 Backed out 2 changesets (bug 1736602) for causing bug 1737399. CLOSED TREE
Backed out changeset f5ca68c50650 (bug 1736602)
Backed out changeset 4a1e6cfd73ef (bug 1736602)
2021-10-28 22:18:29 +03:00
Jon Coppeard
4c692b76eb Bug 1736602 - Part 1: Pass JSTracer to embedding callbacks which update weak pointers after moving GC r=sfink
The callbacks previously took a JSContext pointer which was never used.

Differential Revision: https://phabricator.services.mozilla.com/D128899
2021-10-20 09:21:39 +00:00
Jon Coppeard
ec270942e3 Bug 1536061 - Part 1: Change the gray root trace hook to allow gray roots to be marked incrementally r=sfink,mccr8
This adds a slice budget parameter and boolean return value to indicate whether tracing has finished.

Differential Revision: https://phabricator.services.mozilla.com/D125558
2021-10-10 11:06:50 +00:00
Jon Coppeard
94744c89a1 Bug 1731432 - Fix marking of gray roots during compacting GC r=sfink
There's a pretty serious bug in bug 1730140 which is that the check for whether
to trace a zone's gray roots only checks whether it is being marked gray, but
we also need to mark these roots when compacting. This only affects GCs when
we're not collecting the atoms zone though because we mark everything in that
case.

So this is a plausible culprit for the crashes here, which would have been
hidden by bug 1728273 since that made all compacting GCs full GCs.

Differential Revision: https://phabricator.services.mozilla.com/D126509
2021-09-23 15:06:43 +00:00
Marian-Vasile Laza
77d39d312e Backed out 3 changesets (bug 1536061) for conflicts with backout of bug 1730534 a=backout.
Backed out changeset 248ec4a96a70 (bug 1536061)
Backed out changeset 8c9135ac1d10 (bug 1536061)
Backed out changeset 08cdd990b675 (bug 1536061)
2021-09-20 13:20:17 +03:00
Jon Coppeard
113dc2399c Bug 1536061 - Change the gray root trace hook to allow gray roots to be marked incrementally r=sfink,mccr8
This adds a slice budget parameter and boolean return value to indicate whether tracing has finished.

Differential Revision: https://phabricator.services.mozilla.com/D125558
2021-09-17 10:00:11 +00:00
Jon Coppeard
fe43168478 Bug 1730140 - Remove the gray root buffer and mark gray roots after the start of collection r=sfink,mccr8
This removes gray root buffering from the first marking slice and traces the
gray roots directly in a later slice. This relies on Heap<T> read barriers
being sufficient to ensure correctness.

This is conservative in that it makes no effort to skip tracing roots added
after the start of GC. It also doesn't trace roots removed after the start of
GC, but this is OK because barriers ensure marking of any observed values.

The gray root tracing callback will be called once per sweep group, which means
we will trace all zone holders and xpconnect gray roots for every group rather
than just once. This should not be a problem in practice as we expect the
number of zones and hence zone groups to decrease with fission.

On the plus side we no longer have to do a virtual dispatch per root traced
(for the buffering tracer), allocate memory for the buffer, or trace each root
twice.

Note that this doesn't make the gray root marking itself incremental yet.

Differential Revision: https://phabricator.services.mozilla.com/D125188
2021-09-14 07:49:39 +00:00
Jon Coppeard
68d56c9d2a Bug 1725584 - Update JS_SetGCParametersBasedOnAvailableMemory with reasonable current values r=sfink
This function is only used by the shell, and then only when --avilable-memory
is passed, but it could be used as a source of parameter values for low memory
systems so we should make them resonable at least.

Looking at this the current normal values are out of date with the defaults,
and one parameter is repeated several times. I'm not sure what happened here.

Depends on D122601

Differential Revision: https://phabricator.services.mozilla.com/D122602
2021-08-13 13:58:25 +00:00
Jon Coppeard
1d3904469d Bug 1725584 - Rename urgent threshold parameter to reflect that the value is in MB r=sfink
Depends on D122599

Differential Revision: https://phabricator.services.mozilla.com/D122600
2021-08-13 13:58:24 +00:00
Jon Coppeard
36c27d22e5 Bug 1375566 - Remove the now unused malloc growth factor parameter r=sfink
Depends on D121625

Differential Revision: https://phabricator.services.mozilla.com/D121626
2021-08-03 17:28:34 +00:00
Ted Campbell
6ac8f441c7 Bug 1688794 - Remove code for the (now unused) self-hosting zone. r=jandem,jonco
The dedicated zone for self-hosting can now be removed entirely. Also remove the
object cloning code that was only used for the old self-hosting mechanism.

Differential Revision: https://phabricator.services.mozilla.com/D120547
2021-07-29 01:53:36 +00:00
Cosmin Sabou
8dd2d16e8a Backed out 12 changesets (bug 1688794) for xpcshell failures on test_ext_background_service_worker.js. CLOSED TREE
Backed out changeset 121b0b4cf551 (bug 1688794)
Backed out changeset 4888b8daa6b9 (bug 1688794)
Backed out changeset 79d28566a20c (bug 1688794)
Backed out changeset 5f36aebf0f6e (bug 1688794)
Backed out changeset eacb72c5069a (bug 1688794)
Backed out changeset 073610dd3479 (bug 1688794)
Backed out changeset 4230722c8e8e (bug 1688794)
Backed out changeset 7c57cdfa5b32 (bug 1688794)
Backed out changeset f370efcfeb76 (bug 1688794)
Backed out changeset d1285544f83c (bug 1688794)
Backed out changeset 936e59acffdc (bug 1688794)
Backed out changeset 2cdb8f0337ee (bug 1688794)
2021-07-28 20:41:24 +03:00
Ted Campbell
f3326c91ec Bug 1688794 - Remove code for the (now unused) self-hosting zone. r=jandem,jonco
The dedicated zone for self-hosting can now be removed entirely. Also remove the
object cloning code that was only used for the old self-hosting mechanism.

Differential Revision: https://phabricator.services.mozilla.com/D120547
2021-07-28 14:10:01 +00:00
Jon Coppeard
96e702158d Bug 1721549 - Add JS::GCReason::FIRST_RESERVED_REASON r=sfink
Since this would be useful let's add it.

Differential Revision: https://phabricator.services.mozilla.com/D120707
2021-07-23 17:48:16 +00:00
Jon Coppeard
73b17b4824 Bug 1434542 - Increase the slice budget and frequency as we approach the incremental GC limit r=sfink
This adds an 'urgent' threshold, which is at a configurable point before we
reach the incremental limit. We calculate how close we are to the limit as a
fraction of bytes remaining until we hit it, giving a value in the range 1 to 0
as we apprach it. Then we increase the slice budget in inverse proportion to
this value, and decreases the allocation threshold for the next slice in
proportion to it.

The value for the urgent threshold is chosen as 16MB since the values for the
incremental limit ratio is chosen so that there is always more than 16MB
between the original GC threshold and the incremental limit. This also allows
the effect to vary from subtle to large over several slices, since alloc
triggered slices are initially 1MB apart.

The calculation is chosen to have no effect at the start (at the urgent
threshold itself), rise slowly but becomes asymptotic as we approach the
incremental limit, with the aim of never reaching this limit.

I couldn't think of a better name than 'urgent threshold'. I think it's
reasonable but it's not very descriptive of how it's used. I'd appreciate any
ideas.

Differential Revision: https://phabricator.services.mozilla.com/D120320
2021-07-21 17:43:42 +00:00
Jon Coppeard
67edae11b1 Bug 1721549 - Provide some GC reasons for embedders to use r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D120455
2021-07-21 17:01:54 +00:00
Ted Campbell
b172dd415c Bug 1716250 - Remove JS_FRIEND_API. r=jandem,sfink
Convert all JS_FRIEND_API to JS_PUBLIC_API. At this point, the JS_PUBLIC_API has
no formal curation process and in practice we add a lot of new features to
JS_FRIEND_API without giving much thought to if they should be public. The
result is that all embedders need to use the friend API in some form and the
distinction has lost meaning.

Going forward, we should continue to use the js/public/experimental directory as
a place to expose new APIs, and in general should strive for high quality of the
APIs that are exposed. If a particular API is tricky or discouraged, comments
explaining that will be more helpful that a losely applied FRIEND_API marker.

Differential Revision: https://phabricator.services.mozilla.com/D117607
2021-06-16 19:38:10 +00:00
Jon Coppeard
e436a16c30 Bug 1715759 - Add a pref to control allocation site based pretrening r=jandem
This doesn't change the state of this feature which currently enabled, but will
allow us to disable it easily if necessary.

Differential Revision: https://phabricator.services.mozilla.com/D117441
2021-06-14 14:22:57 +00:00
Jon Coppeard
39dcc0ea21 Bug 1714561 - Allow single-zone JS holders to contain pointers into the atoms zone r=mccr8,sfink
Differential Revision: https://phabricator.services.mozilla.com/D116848
2021-06-07 15:19:29 +00:00
Jon Coppeard
b7dc1c7729 Bug 1711423 - Move GC zeal APIs to GCAPI.h r=yulia
Depends on D115192

Differential Revision: https://phabricator.services.mozilla.com/D115193
2021-05-17 14:19:11 +00:00
Jon Coppeard
52d33f4288 Bug 1709849 - Replace use of JSGCInvocationKind with JS::GCOptions in the browser r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D114512
2021-05-07 07:39:50 +00:00
Jon Coppeard
af64c74e04 Bug 1709849 - Replace JSGCInvocationKind with JS::GCOptions enum r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D114511
2021-05-07 07:39:49 +00:00
Yoshi Cheng-Hao Huang
8fbec92c35 Bug 1691920 - Add a systemPageSizeKB parameter. r=jonco
Add a read-only parameter systemPageSizeKB to get the same result from
js::Nursery::roundSize.

Differential Revision: https://phabricator.services.mozilla.com/D106188
2021-02-24 22:04:16 +00:00
Jon Coppeard
6d59bf19ea Bug 1689394 - Increase idle time nursery collection timeout to make it less agressive r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D106127
2021-02-24 15:14:15 +00:00
Jon Coppeard
f754b66918 Bug 1694372 - Make the idle time nursery collection timeout a GC parameter r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D106126
2021-02-24 13:56:17 +00:00
Jon Coppeard
681a1c23e1 Bug 1689140 - Refactor SliceBudget API r=sfink
This patch does several things:
 - make the counter type int64_t like the work budget parameter (the original purpose of this bug)
 - simplify implementation by using a Variant to discriminate between different kinds of budget
 - remove the global initialization
 - remove makeUnlimited() (and replace uses with assignment from SliceBudget::unlimited())
 - add convenience methods to get the original budget parameters
 - add basic API tests

The use of Variant had the consequence that we now have to pass SliceBudget by reference now to make the linter happy.

Differential Revision: https://phabricator.services.mozilla.com/D103318
2021-01-28 19:11:42 +00:00
Jon Coppeard
7d27eb1bf3 Bug 1686249 - Replace the 'GC mode' with two GC parameters r=sfink
This doesn't change the current defaults, only the comments and default values which were wrong/misleading - see the current call to setGCMode() in the GCRuntime constructor.

Differential Revision: https://phabricator.services.mozilla.com/D102717
2021-01-23 08:49:17 +00:00
Jon Coppeard
fc91cd019c Bug 1681533 - Only collect the nursery when necessary in major GC r=sfink
This rearranges a few things so that we can run a minor GC inside a major GC
slice, so we don't have to be conservative about collecting the nursery at the
start of a slice.

Differential Revision: https://phabricator.services.mozilla.com/D99366
2021-01-04 17:01:50 +00:00
smolnar
fbf90ef232 Backed out changeset 7da8f779dc24 (bug 1681533) at developer's request for causing Bug 1683870. a=backout DONTBUILD 2020-12-28 12:18:01 +02:00
Jon Coppeard
af859fd8ec Bug 1681533 - Only collect the nursery when necessary in major GC r=sfink
This rearranges a few things so that we can run a minor GC inside a major GC
slice, so we don't have to be conservative about collecting the nursery at the
start of a slice.

Differential Revision: https://phabricator.services.mozilla.com/D99366
2020-12-17 17:57:33 +00:00
Jon Coppeard
a3c605929b Bug 1681268 - Check zone pointers passed into the API and add a callback for zone destruction r=sfink
This adds assertions that zone pointers passed in refer to zones we know about
and adds and API that's called when zones are destroyed. It also adds some
standard assertions for other related APIs.

Differential Revision: https://phabricator.services.mozilla.com/D99071
2020-12-15 09:36:12 +00:00
Steve Fink
dad68c3ddf Bug 1662254 - Rename CC_WAITING -> CC_FINISHED r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D94792
2020-12-11 19:04:31 +00:00
Yoshi Cheng-Hao Huang
42632a40d3 Bug 1522186 - Disable string pretenuring once the finalization rate is high. r=jonco
Compare the number of finalizations tenured strings with the number of
strings before a major GC. Stop the string pretenuring once the finalization
rate is too high.

Differential Revision: https://phabricator.services.mozilla.com/D94277
2020-12-08 21:04:15 +00:00
Bogdan Tara
3667467db8 Backed out 10 changesets (bug 1662254) for lint failure on generate_static_pref_list.py CLOSED TREE
Backed out changeset 972e63387191 (bug 1662254)
Backed out changeset 3a9d6f0aa380 (bug 1662254)
Backed out changeset 4b3ffe7fe1af (bug 1662254)
Backed out changeset 4834b1025611 (bug 1662254)
Backed out changeset ec1f7afe8a2d (bug 1662254)
Backed out changeset c7a6b927b1de (bug 1662254)
Backed out changeset 2427d85b2605 (bug 1662254)
Backed out changeset 979bf4ac97bb (bug 1662254)
Backed out changeset 3e443333c636 (bug 1662254)
Backed out changeset a5261578ebfc (bug 1662254)
2020-11-12 23:59:07 +02:00
Steve Fink
9ab0a6a530 Bug 1662254 - Rename CC_WAITING -> CC_FINISHED r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D94792
2020-11-12 19:05:32 +00:00
Yoshi Cheng-Hao Huang
8c9a4c00bb Bug 1522187 - Decide string pretenuring base on pretenure rate. r=jonco
Choose the string pretenuring threshold as 0.55, as it's the most common
pretured rate when the number of strings pretenured exceeds 30,000 in JetStream2
benchmark.  (about 0.55~0.57 in my tests).

However this threshold shouldn't have any major impact on benchmarks like Octane,
JetStream2 and Kraken, as in these benchmarks when the pretenuring condition is
met, the tenured rate is 99%.

Differential Revision: https://phabricator.services.mozilla.com/D92762
2020-10-15 10:02:21 +00:00
Jon Coppeard
8090e12074 Bug 1669468 - Remove separate GC reasons incremental/non-incremental trigger kinds and reasons. r=sfink
This simplifies the threshold checks and the decision to make a collection
non-incremental ultimately happens in GCRuntime::budgetIncrementalGC anyway. We
still have telemetry for incremental/non-incremental collections and
non-incremental reason.

Differential Revision: https://phabricator.services.mozilla.com/D92592
2020-10-07 18:50:08 +00:00
Jeff Walden
b5ec4c7eba Bug 1663365 - Create a new js/public/String.h header seeded with the inline string functions previously found in jsfriendapi.h. (More functions ought be added/moved here, but these make a good start.) r=jandem,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D89330
2020-09-08 22:50:52 +00:00
Jon Coppeard
911a5d3265 Bug 1657850 - Add prefs to control how many background threads are used for GC r=sfink
This adds a thread count for GC parallel tasks calculated from GC parameters
for a helper thread ratio and max helper thread count. It also adds one to
report the number of helper threads used for GC.

This is slightly complicated by the fact that the helper thread system is
per-process and there are potentially many JS runtimes in a process. I
disallowed setting these parameters from workers (i.e. child JS runtimes), but
there may be more than one non-worker JS runtime so this isn't perfect.

I had to swap the mutex order for the GC and helper thread locks.  Whatever
reason they were the other way round seems to have gone and this order makes
more sense to me (I see the GC lock as being 'coarser' than the helper thread
lock).

Differential Revision: https://phabricator.services.mozilla.com/D86725
2020-08-18 15:38:24 +00:00
Csoregi Natalia
c9c139cfd7 Backed out changeset fb664f6d43ed (bug 1657850) for failures on helper-thread-params.js. CLOSED TREE 2020-08-13 21:41:13 +03:00