[gjs: 10/12] context: Use JS::JobQueueIsEmpty optimization




commit 3076e5bd455ad58483c7eef1c056bdc50c342e80
Author: Philip Chimento <philip chimento gmail com>
Date:   Thu Feb 18 23:06:14 2021 -0800

    context: Use JS::JobQueueIsEmpty optimization
    
    This is a new optimization in SpiderMonkey. When the queue is empty, we
    can notify the engine with JS::JobQueueIsEmpty() and it can execute some
    jobs immediately. We then have to call JS::JobQueueMayNotBeEmpty() when
    the next job is enqueued.

 gjs/context.cpp | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 443355a1..cb918675 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -798,6 +798,7 @@ bool GjsContextPrivate::enqueuePromiseJob(
         return false;
     }
 
+    JS::JobQueueMayNotBeEmpty(m_cx);
     start_draining_job_queue();
     return true;
 }
@@ -876,6 +877,7 @@ bool GjsContextPrivate::run_jobs_fallible(void) {
 
     m_job_queue.clear();
     stop_draining_job_queue();
+    JS::JobQueueIsEmpty(m_cx);
     return retval;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]