This patch does not make some header files stop including the inline
header because fixing them require more changes.
Note that `#include "nsComponentManagerUtils.h"` is fixing a bustage
caused by "use of undeclared identifier 'do_CreateInstance'" error.
Differential Revision: https://phabricator.services.mozilla.com/D304432
MakeAndAddRef ensures that the freshly-allocated object immediately gets a
refcount of 1 (before it's even passed to AddScriptRunner). This avoids
several potential footguns that otherwise exist with a zero-refcount
freshly-allocated object.
It also makes the ownership-transfer semantics more clear
(via the already_AddRefed type that it produces) - AddScriptRunner is taking
ownership of the object, rather than using it temporarily while the caller
maintains ownership.
Differential Revision: https://phabricator.services.mozilla.com/D299039
After GC/CC completion, jemalloc_free_dirty_pages() synchronously purges
every arena on the main thread. This is redundant when the idle purge
infrastructure (memory.lazypurge.*) is enabled, since arenas are already
queued for deferred purge during GC by the allocation path.
Add TaskController::RequestIdleMemoryCleanup() which kicks the idle purge
runner without the pending-task guard that MayScheduleIdleMemoryCleanup
has, and falls back to synchronous purge when lazy purge is disabled.
Replace the two jemalloc_free_dirty_pages() calls in nsJSEnvironment.cpp
(GC and CC completion) with this new method.
Differential Revision: https://phabricator.services.mozilla.com/D284731
A worker can be GC'ed and shutdown even if there are async tasks pending
if a StrongWorkerRef is not held by the async task. This can result in
a worker being terminated too early if it's just waiting on a WebAssembly
compile task.
Add two new JS-API callbacks for monitoring the progress of async tasks,
and use this in the workers code to create and release StrongWorkerRefs.
These callbacks are used with the Atomics.waitAsync background tasks,
which are tasks that can be canceled if there is an explicit shutdown
request. This previously was handled automatically, but now if there
is StrongWorkerRef for these tasks, it seems like we need a way to
cancel these tasks. A JS::CancelAsyncTasks embedder function is added
to do this and is invoked when the worker is explicitly asked to
shutdown.
Differential Revision: https://phabricator.services.mozilla.com/D265016
A worker can be GC'ed and shutdown even if there are async tasks pending
if a StrongWorkerRef is not held by the async task. This can result in
a worker being terminated too early if it's just waiting on a WebAssembly
compile task.
Add two new JS-API callbacks for monitoring the progress of async tasks,
and use this in the workers code to create and release StrongWorkerRefs.
These callbacks are used with the Atomics.waitAsync background tasks,
which are tasks that can be canceled if there is an explicit shutdown
request. This previously was handled automatically, but now if there
is StrongWorkerRef for these tasks, it seems like we need a way to
cancel these tasks. A JS::CancelAsyncTasks embedder function is added
to do this and is invoked when the worker is explicitly asked to
shutdown.
Differential Revision: https://phabricator.services.mozilla.com/D265016
It seems in bug 1377131 this used to call
nsViewManager::GetLastUserEventTime.
Bug 1727972 changed that but likely forgot to remove the early returns.
Differential Revision: https://phabricator.services.mozilla.com/D269030
It seems in bug 1377131 this used to call
nsViewManager::GetLastUserEventTime.
Bug 1727972 changed that but likely forgot to remove the early returns.
Differential Revision: https://phabricator.services.mozilla.com/D269030
Most changes are automated. Relevant bit is dom/.clang-format. I had to
manually disable clang-format in a few places where importing external
files and so on that aren't self-contained, and fix a couple includes /
forward declarations.
Differential Revision: https://phabricator.services.mozilla.com/D256800
This patch is a major refactoring that introduces a concept of ownership of JS::Dispatchables via
UniquePtrs. Embeddings must now use UniquePtrs to reference Dispatchables passed by the engine.
Two static methods are introduced to Dispatchable: Run and ReleaseFailedTask.
Run is used to release the UniquePtr prior to running. We do this because we still rely on the
js_delete(this) call inside of OffThreadPromiseTask::run in cases of web assembly, namely cases when
we never dispatch to the embedding and need to clean up
[1](https://searchfox.org/mozilla-central/rev/6cc05c6620814bf3eb05278ccf3b1f49690b7740/js/src/vm/HelperThreads.cpp#1542).
This will be refactored in a future step covered by Bug# 1959032.
ReleaseFailedTask similarily releases the task. This relies on the task having been registered with
the OffThreadPromiseRuntimeState class. As the only override of `run` is in OffThreadPromiseTask,
thus far there have been no guarantees of how this is done. This will be addressed in the next
patch.
Depends on D212878
Differential Revision: https://phabricator.services.mozilla.com/D244936
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
Current static variable is just used as a placeholder for in-place
initialization. So use an appropriate static storage instead.
This has the advantage of *not* requiring global initialization,
removing the useless current one (which was overridden by the in-place
new anyway).
It also fixes an initialization order dependency \o/
Differential Revision: https://phabricator.services.mozilla.com/D191489
This doesn't cover all the page loads, need to run some more performance tests before using this everywhere.
Depends on D189917
Differential Revision: https://phabricator.services.mozilla.com/D189918