commit ff03e52ebf738ece9bbe7d0bf9ed94a892b28f97
parent 120f48b684865bbc169066d3236d4469026779e9
Author: Matthew Gaudet <mgaudet@mozilla.com>
Date: Fri, 28 Nov 2025 16:31:04 +0000
Bug 2002876 - Remove un-necessary copy & move root out of loop r=smaug
Using the assignment ends up triggering a copy which is un-necesary.
Differential Revision: https://phabricator.services.mozilla.com/D274353
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp
@@ -1197,7 +1197,7 @@ bool CycleCollectedJSContext::PerformMicroTaskCheckPoint(bool aForce) {
while (JS::HasAnyMicroTasks(cx)) {
MOZ_ASSERT(mDebuggerMicroTaskQueue.empty());
MOZ_ASSERT(mPendingMicroTaskRunnables.empty());
- job = DequeueNextMicroTask(cx);
+ job.set(DequeueNextMicroTask(cx));
// To avoid us accidentally re-enqueing a SuppressionMicroTaskList in
// itself, we determine here if the job is actually the suppression task
@@ -1327,11 +1327,11 @@ void CycleCollectedJSContext::PerformDebuggerMicroTaskCheckpoint() {
JSContext* cx = Context();
if (StaticPrefs::javascript_options_use_js_microtask_queue()) {
+ JS::Rooted<MustConsumeMicroTask> job(cx);
while (JS::HasDebuggerMicroTasks(cx)) {
MOZ_ASSERT(mDebuggerMicroTaskQueue.empty());
MOZ_ASSERT(mPendingMicroTaskRunnables.empty());
- JS::Rooted<MustConsumeMicroTask> job(cx);
job.set(DequeueNextDebuggerMicroTask(cx));
RunMicroTask(cx, &job);