Commit Graph

884 Commits

Author SHA1 Message Date
Jon Coppeard
e429b81609 Bug 1895661 - Part 2: Add browser prefs for GC zeal r=sfink
There was existing code to read the prefs, but the prefs themselves had been removed.

I renamed the prefs in line with all the other JS GC options, so starting
javascript.options.mem.gc_.

Differential Revision: https://phabricator.services.mozilla.com/D210059
2024-05-13 16:31:20 +00:00
Jon Coppeard
524de2ba8b Bug 1895661 - Part 1: Move GC zeal functions to JS namespace and add separate constants for browser and shell frequency r=sfink
Sensible defaults are very different for the browser and the shell so I added
separate constants. I think the JS testing functions can get called from the
browser and so may pick the wrong default but it's not too serious.

Differential Revision: https://phabricator.services.mozilla.com/D210058
2024-05-13 16:31:20 +00:00
Alexandre Poirot
d6657b7af7 Bug 1821250 - Use a timer on debugger control runnable to ensure running them even if worker uses Atomics.wait. r=asuth
Atomics.wait prevent WorkerDebuggerRunnable's from running by blocking the event loop.
While dispatching these runnables, also spawn a short timer which would interrupt the worker
and tentatively try to drain the debugger queue and resume any debugger runnable which may be blocked.

Differential Revision: https://phabricator.services.mozilla.com/D194081
2024-05-13 11:52:08 +00:00
Steve Fink
1f2a9f02c3 Bug 1891277 - correctly match JS GC memory pref names r=arai
Differential Revision: https://phabricator.services.mozilla.com/D207351
2024-04-22 23:55:57 +00:00
Eden Chuang
a718e4758f Bug 1769913 - P3 Remove WorkerRunnable::mWorkerPrivate. r=dom-worker-reviewers,asuth
WorkerRunnable no longer keeps a raw pointer(mWorkerPrivate) for the associated WorkerPrivate in this patch.
Removing the WorkerRunnable::mWorkerPrivate needs to fix the following problems.

1. Thread assertions in WorkerRunnable::Dispatch()

To fix this problem, the associated WorkerPrivate is as a parameter and passed to WorkerRunnable::Dispatch() for the dispatching thread assertions. This associated WorkerPrivate is also propagated to PreDispatch() and PostDispatch() for the children classes of WorkerRunnable()

2. Get the associated WorkerPrivate in WorkerRunnable::Run() for environment setup(GlobabObject, JSContext setting for the runnable)

- For WorkerThreadRunnable

Since WorkerThreadRunnable is supposed to run on the worker thread, it does not need to keep a raw pointer to WorkerPrivate as its class member. GetCurrentThreadWorkerPrivate() should always get the correct WorkerPrivate for WorkerThreadRunnable.

- For WorkerParentThreadRunnable

WorkerParentRef is introduced to keep a RefPtr<WorkerPrivate> for WorkerParentThreadRunnable instead of using a raw pointer.
Checking the associated WorkerPrivate existence by WorkerParentRef at the beginning of WorkerParentThreadRunnable::Run(). If the Worker has already shut down, WorkerParentThreadRunnable cannot do anything with the associated WorkerPrivate, so WorkerParentThreadRunnable::Run() will return NS_OK directly but with a warning.

The associated WorkerPrivate is also passed into WorkerRun(), PreRun(), and PostRun(), so the majority of implementations of child classes of WorkerRunnable do not need to be changed.

If there are any cases in which the child classes of WorkerThreadRunnable/WorkerParentThreadRunnable want to keep the associated WorkerPrivate, they should use WorkerRefs instead of raw pointers.

Depends on D205679

Differential Revision: https://phabricator.services.mozilla.com/D207039
2024-04-19 09:41:58 +00:00
Eden Chuang
11d8c5840b Bug 1769913 - P2 WorkerParentThreadRunnable for the runnables dispatched to worker's parent thread. r=dom-worker-reviewers,asuth
In this patch, WorkerParentThreadRunnable is extracted from WorkerThreadRunnable for runnable on the parent thread.

WorkerParentControlRunnable and WorkerParentDebuggeeRunnable are also created for control runnable and debuggee runnable on the parent thread.

Instead of using WorkerRunnable::Target to indicate the thread target, inheriting WorkerThreadRunnable or WorkerParentThreadRunnable to point out that this runnable should run on the worker thread or on the parent thread. So WorkerRunnable::Target is removed in this patch.

This patch also move the dispatching logic into WorkerPrivate to simplify WorkerRunnable::DispatchInternal()'s implementation.

Depends on D205178

Differential Revision: https://phabricator.services.mozilla.com/D205679
2024-04-19 09:41:57 +00:00
Eden Chuang
f9b64790d7 Bug 1769913 - P1 Make WorkerRunnable to be a base class for runnables on Worker thread and Worker's parent thread. r=dom-worker-reviewers,asuth
This is the first step in splitting the parent thread runnable out of WorkerRunnable.

To reuse the runnable dispatching codes in Worker, we still need a base class for runnable on the worker thread and the parent thread.

In this patch, we rename the original WorkerRunnable to WorkerThreadRunnable and make WorkerRunnable to be WorkerThreadRunnable's parent class.

In the second patch, we will create WorkerParentThreadRunnable and its sub-classes, split from WorkerThreadRunnable for runnable on the Worker's parent thread.

And in the third patch, we will re-structure the content of WorkerParentThreadRunnable to remove unnecessary members.

Differential Revision: https://phabricator.services.mozilla.com/D205178
2024-04-19 09:41:57 +00:00
Jon Coppeard
e8a9833660 Bug 1821671 - Part 2: Add pref for setting the maximum number of marking threads to use r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D207288
2024-04-16 14:33:15 +00:00
Jon Coppeard
8f75b5a7cf Bug 1787526 - Part 1: Add configuration for semispace nursery r=sfink
Add a GC parameter and pref for semispace nursery which is disabled by default.

Enable it for the shell rootanalysis job to get get some test coverage.

Differential Revision: https://phabricator.services.mozilla.com/D196431
2024-03-18 16:13:50 +00:00
Jan Varga
492e6f8efc Bug 1855142 - Ensure IndexedDabaseManager::mLocale separately; r=dom-storage-reviewers,jari
mLocale is currently initialized in IndexedDatabaseManager::Init which is
called from IndexedDatabaseManager::GetOrCreate if the manager doesn't exist.
This can be a problem when IndexedDatabaseManager::GetOrCreate is called very
early,for example in nsLayoutStatics::Initialize in the parent process.

This is a preparation for moving IndexedDatabaseManager::GetOrCreate from
FactoryOp::Open to InitializeQuotaManager.

Differential Revision: https://phabricator.services.mozilla.com/D189891
2024-02-29 15:28:47 +00:00
Jon Coppeard
85179f3c49 Bug 1881303 - Part 2: Expose eager nursery collection tunables as prefs r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D202476
2024-02-23 09:20:31 +00:00
Jon Coppeard
1b29ae75b0 Bug 1875304 - Enable parallel marking on workers r=sfink
This adds a per-process count of helper threads 'reserved' for parallel
marking. This means reserved with respect to parallel marking but not anything
else, so helper threads can still be used for other tasks (including GC
parallel tasks) but the number of runtimes that can mark in parallel is
limited.

The main runtime reserves threads when parallel marking is enabled to
priviledge it over worker runtimes. Workers reserve threads only for the
duration of collection. Failure to reserve threads means parallel marking is
not used.

I don't love the term 'reserved' beacuse it implies the threads cannot be used
for anything else, but I couldn't think of anything better. I've added comments
to describe what it actually means.

Differential Revision: https://phabricator.services.mozilla.com/D201695
2024-02-19 15:45:02 +00:00
Cristian Tuns
b8e971d10b Backed out 2 changesets (bug 1821250) for causing dt failures in Mutex_posix.cpp CLOSED TREE
Backed out changeset d46945ada9ec (bug 1821250)
Backed out changeset 94145877428a (bug 1821250)
2024-02-14 16:58:46 -05:00
Alexandre Poirot
aa44b4dd66 Bug 1821250 - Use a timer on debugger control runnable to ensure running them even if worker uses Atomics.wait. r=asuth
Atomics.wait prevent WorkerDebuggerRunnable's from running by blocking the event loop.
While dispatching these runnables, also spawn a short timer which would interrupt the worker
and tentatively try to drain the debugger queue and resume any debugger runnable which may be blocked.

Differential Revision: https://phabricator.services.mozilla.com/D194081
2024-02-14 17:18:44 +00:00
Jens Stutte
aa54dcc26f Bug 1875800 - Add name support to WorkerRunnable. r=dom-worker-reviewers,asuth,smaug
Differential Revision: https://phabricator.services.mozilla.com/D199228
2024-01-24 16:00:26 +00:00
Daniel Holbert
70297ae259 Bug 1875430 part 2: Convert 'static UniquePtr' global vars to use StaticAutoPtr, in dom/workers. r=dom-worker-reviewers,smaug
Depends on D199167

Differential Revision: https://phabricator.services.mozilla.com/D199168
2024-01-23 19:00:49 +00:00
Cristian Tuns
5de093dcd2 Backed out changeset f3efca74da0f (bug 1875800) for causing build bustages in WorkerPrivate.cpp CLOSED TREE 2024-01-23 11:20:38 -05:00
Jens Stutte
926a1907f0 Bug 1875800 - Add name support to WorkerRunnable. r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D199228
2024-01-23 11:23:41 +00:00
Tooru Fujisawa
209a1f050c Bug 1864168 - Part 1: Use 1-origin column number in nsIContentSecurityPolicy. r=smaug,devtools-reviewers,ochameau,ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D193369
2023-11-22 12:31:30 +00:00
Natalia Csoregi
e0d56104a6 Backed out 14 changesets (bug 1865005, bug 1864168, bug 1864155, bug 1862814, bug 1862693) for causing bustage on nsRFPService.cpp. CLOSED TREE
Backed out changeset a4f3e7625abf (bug 1865005)
Backed out changeset ab38141e470b (bug 1862814)
Backed out changeset a679b50dc4a9 (bug 1862814)
Backed out changeset e340886ce62a (bug 1862814)
Backed out changeset 1378502e64b0 (bug 1862814)
Backed out changeset 8ee94e5e79c2 (bug 1862814)
Backed out changeset 6d4ef1cdfabb (bug 1864168)
Backed out changeset 2c30c4d757fc (bug 1864168)
Backed out changeset d4db9576559b (bug 1864168)
Backed out changeset 8ffec0d83028 (bug 1864168)
Backed out changeset fa77d852b494 (bug 1864168)
Backed out changeset f6646771a26a (bug 1864168)
Backed out changeset 7bd0ff6986df (bug 1864155)
Backed out changeset 39867b503289 (bug 1862693)
2023-11-22 14:01:55 +02:00
Tooru Fujisawa
676bd2ea73 Bug 1864168 - Part 1: Use 1-origin column number in nsIContentSecurityPolicy. r=smaug,devtools-reviewers,ochameau,ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D193369
2023-11-22 11:13:54 +00:00
Eden Chuang
5ca02c8ea0 Bug 1836700 - Remove BusyCount of WorkerPrivate. r=asuth,ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D182718
2023-11-13 04:00:40 +00:00
Tooru Fujisawa
8b51569f3f Bug 1862692 - Part 16: Use 1-origin column number type in JS::DescribeScriptedCaller. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D193029
2023-11-09 11:41:10 +00:00
Tooru Fujisawa
b4da7fa0cf Bug 1847469 - Part 24: Use column number types in JS::DescribeScriptedCaller. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185762
2023-08-16 17:31:42 +00:00
Cristian Tuns
77d753c741 Backed out 27 changesets (bug 1847469) for causing spidermonkey bustages in Script.cpp CLOSED TREE
Backed out changeset 9d6e2651a013 (bug 1847469)
Backed out changeset 9b72d668efd2 (bug 1847469)
Backed out changeset 86abf5cf0a22 (bug 1847469)
Backed out changeset 46833087f8ac (bug 1847469)
Backed out changeset f3e2207fdeec (bug 1847469)
Backed out changeset aed75776cfff (bug 1847469)
Backed out changeset 8292a38bd99f (bug 1847469)
Backed out changeset 1320f83fb8c7 (bug 1847469)
Backed out changeset df9f925f9837 (bug 1847469)
Backed out changeset 69f32cf1862a (bug 1847469)
Backed out changeset b2ddddec8818 (bug 1847469)
Backed out changeset 056eed7abc97 (bug 1847469)
Backed out changeset 5df4f43ac0bf (bug 1847469)
Backed out changeset cb57923f6532 (bug 1847469)
Backed out changeset a0993f2a2195 (bug 1847469)
Backed out changeset 782499fbedf2 (bug 1847469)
Backed out changeset cf84fb98c5e1 (bug 1847469)
Backed out changeset 1fa5ab59814b (bug 1847469)
Backed out changeset f5f78944df81 (bug 1847469)
Backed out changeset aa14337bf5c6 (bug 1847469)
Backed out changeset 6757db4575d7 (bug 1847469)
Backed out changeset 236ff135701e (bug 1847469)
Backed out changeset 9b4d5b435020 (bug 1847469)
Backed out changeset a0f789621bc8 (bug 1847469)
Backed out changeset c19b81f48055 (bug 1847469)
Backed out changeset b4521e546d7e (bug 1847469)
Backed out changeset f26a10289316 (bug 1847469)
2023-08-16 07:08:01 -04:00
Tooru Fujisawa
fb38c26358 Bug 1847469 - Part 24: Use column number types in JS::DescribeScriptedCaller. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185762
2023-08-16 10:26:33 +00:00
Tom Schuster
2454d6dc41 Bug 1843841 - Make navigator.appName constant. r=dom-worker-reviewers,webidl,smaug,timhuang
This is supposed to constant per https://html.spec.whatwg.org/#client-identification.

Differential Revision: https://phabricator.services.mozilla.com/D183723
2023-07-19 17:00:53 +00:00
Barret Rennie
f555038ba5 Bug 1786885 - Remove OS.Constants r=nika
Differential Revision: https://phabricator.services.mozilla.com/D179384
2023-07-12 03:57:12 +00:00
Eden Chuang
b1c66d53bf Bug 1800659 - P2 remove nsICancelableRunnable inheriting form WorkerRunnable. r=asuth
This patch is only remove the inheriting, but keeping Cancel() implmentation.
The Cancel() is needed in some special cases, such as Worker enters Canceling when WorkerScope is not created.

Depends on D176915

Differential Revision: https://phabricator.services.mozilla.com/D173850
2023-06-06 06:36:50 +00:00
Jens Stutte
df968c6e08 Bug 1830278 - CC on worker shutdown until there remains nothing we can collect. r=dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D176651
2023-04-27 12:58:38 +00:00
Jens Stutte
f445a26b69 Bug 1826416 - Avoid the use of strong references to check if global scope is alive. r=dom-worker-reviewers,mccr8,asuth
Differential Revision: https://phabricator.services.mozilla.com/D174743
2023-04-12 08:54:09 +00:00
Cristina Horotan
6acde38519 Backed out changeset 0825b12caee2 (bug 1826416) for causing multiple failures at RuntimeService.cpp 2023-04-12 10:40:45 +03:00
Jens Stutte
4896bc6f38 Bug 1826416 - Avoid the use of strong references to check if global scope is alive. r=dom-worker-reviewers,mccr8,asuth
Differential Revision: https://phabricator.services.mozilla.com/D174743
2023-04-12 07:04:08 +00:00
Jens Stutte
c5fa7ccd1e Bug 1825589 - Relax globalScopeAlive assertion to happen after potentially deferred CC release have happened on JS context destruction. r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D174496
2023-04-03 18:44:40 +00:00
Butkovits Atila
5ff465c923 Backed out changeset b5217784536c (bug 1777921) for causing assertion failures at WorkerPrivate.h. CLOSED TREE 2023-03-31 18:36:39 +03:00
Jens Stutte
7a7df1c06d Bug 1777921 - Assert that StrongWorkerRefs are not lazily released during final GC/CC. r=dom-worker-reviewers,smaug,asuth
And relax the check if someone carries away a stale reference to our global scope to happen after the JS context has gone out of scope.

Differential Revision: https://phabricator.services.mozilla.com/D150942
2023-03-31 14:33:15 +00:00
Joshua Marshall
e90e9dc56f Bug 1805613 - Dump worker info on shutdown hang r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D173430
2023-03-30 13:44:34 +00:00
Yulia
09b46d0966 Bug 1540913 - Part 2: Clear and shutdown ModuleLoader at worker termination; r=asuth,jonco
When running an infinitely-looping dynamic import, it is possible for the module loader to still be
holding on to that module at shutdown. Shutdown on the worker means that we will no longer run the
event loop, which will execute the dynamic import promises necessary to clear the global. The result
is that the global is kept alive. By calling `Shutdown()` we prevent this partially. We additionally
need to address the failure in the module code (next patch).

Differential Revision: https://phabricator.services.mozilla.com/D171683
2023-03-14 18:16:31 +00:00
Jon Coppeard
58d22da98a Bug 1817757 - Part 1: Remove support for parallel marking from workers r=sfink
Depends on D170374

Differential Revision: https://phabricator.services.mozilla.com/D170375
2023-02-22 08:56:28 +00:00
Nika Layzell
3652956b7b Bug 1809753 - Part 4: Remove unnecessary GetMainThreadEventTarget, r=mccr8
This method always returned GetMainThreadSerialEventTarget(). This patch
switches all callers over to use that method instead.

We can't easily switch all calls to be calls to NS_GetMainThread(), as there is
no version of that method returning a bare nsIThread* instance.

I didn't introduce one, as we may want to add a lock around mMainThread in the
future, which would require removing nsThreadManager::GetMainThreadWeak. As
this method only returns nsISerialEventTarget, it method could remain
implemented, however, by returning a statically allocated fake event target
which forwards dispatches (and QIs to nsIThread) to the real main thread.

Differential Revision: https://phabricator.services.mozilla.com/D166608
2023-01-16 23:14:12 +00:00
Sandor Molnar
f236c54e45 Backed out 6 changesets (bug 1809752, bug 1809753) for causing perma failures in browser/components/firefoxview/tests/browser/browser_feature_callout_position.js
Backed out changeset ea05784d74c4 (bug 1809753)
Backed out changeset 7c9b20eebcc8 (bug 1809753)
Backed out changeset d0267ac2256d (bug 1809753)
Backed out changeset aa9f2971bd6f (bug 1809753)
Backed out changeset f0d9fcfaa6f8 (bug 1809752)
Backed out changeset 6d58c799cffe (bug 1809752)
2023-01-17 03:19:24 +02:00
Nika Layzell
d61ced88a2 Bug 1809753 - Part 4: Remove unnecessary GetMainThreadEventTarget, r=mccr8
This method always returned GetMainThreadSerialEventTarget(). This patch
switches all callers over to use that method instead.

We can't easily switch all calls to be calls to NS_GetMainThread(), as there is
no version of that method returning a bare nsIThread* instance.

I didn't introduce one, as we may want to add a lock around mMainThread in the
future, which would require removing nsThreadManager::GetMainThreadWeak. As
this method only returns nsISerialEventTarget, it method could remain
implemented, however, by returning a statically allocated fake event target
which forwards dispatches (and QIs to nsIThread) to the real main thread.

Differential Revision: https://phabricator.services.mozilla.com/D166608
2023-01-16 23:14:12 +00:00
Jan Varga
8b0b833dff Bug 1809044 - Implement WorkerEventTarget::RegisterShutdownTask and WorkerEventTarget::UnregisterShutdownTask; r=dom-worker-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D166309
2023-01-11 18:52:36 +00:00
Tom Schuster
3ce17fcff1 Bug 1774866 - Always allow cloning error stacks. r=nika,sfink,smaug
Differential Revision: https://phabricator.services.mozilla.com/D164577
2022-12-15 19:03:53 +00:00
Nika Layzell
b6897a896a Bug 1804093 - Part 5: Eliminate WorkerPrincipal and WorkletPrincipals, r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D163856
2022-12-12 22:08:36 +00:00
Jon Coppeard
9e110ab0ca Bug 1802897 - Part 1: Add a pref for parallel marking, disabled by default r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D163461
2022-12-07 12:58:49 +00:00
Jens Stutte
e750afe8b6 Bug 1803540 - Process all events caused as side effect by GCCC during worker shutdown. r=dom-worker-reviewers,smaug
Differential Revision: https://phabricator.services.mozilla.com/D163916
2022-12-07 08:45:44 +00:00
Cristian Tuns
019896256a Backed out 13 changesets (bug 1802897) for causing build bustages on Marking.cpp CLOSED TREE
Backed out changeset 61a336a6d2c9
Backed out changeset 5c3c2afd76af (bug 1802897)
Backed out changeset 1b2d9c4afee8 (bug 1802897)
Backed out changeset bf236f6a197c (bug 1802897)
Backed out changeset b3e82a32e13e (bug 1802897)
Backed out changeset 9fcff7ae8aac (bug 1802897)
Backed out changeset f21b54985888 (bug 1802897)
Backed out changeset d6c6eaa2508a (bug 1802897)
Backed out changeset ab00bd1ada69 (bug 1802897)
Backed out changeset f98def4568e6 (bug 1802897)
Backed out changeset 68880308ca96 (bug 1802897)
Backed out changeset 73ad67b6e4f6 (bug 1802897)
Backed out changeset 28c061eb2993 (bug 1802897)
2022-12-06 14:44:08 -05:00
Jon Coppeard
96d17de98f Bug 1802897 - Part 1: Add a pref for parallel marking, disabled by default r=sfink
Differential Revision: https://phabricator.services.mozilla.com/D163461
2022-12-06 18:19:28 +00:00
Simon Friedberger
6b0a251a63 Bug 1549057 - Rename (Gg)etCSP to (Gg)etCsp - r=freddyb
Differential Revision: https://phabricator.services.mozilla.com/D159268
2022-10-24 20:38:11 +00:00