1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibJS: Inline part of VM::run_queued_promise_jobs()

Most of the time there are no queued promise jobs to run after exiting
a stack frame. By moving the check inline, leaving a function call gets
a measurable speedup in the common case.
This commit is contained in:
Andreas Kling 2025-04-28 11:53:15 +02:00 committed by Tim Flynn
parent b4554c01db
commit 233097c250
Notes: github-actions[bot] 2025-04-28 14:40:38 +00:00
2 changed files with 10 additions and 2 deletions

View file

@ -419,7 +419,7 @@ bool VM::in_strict_mode() const
return running_execution_context().is_strict_mode;
}
void VM::run_queued_promise_jobs()
void VM::run_queued_promise_jobs_impl()
{
dbgln_if(PROMISE_DEBUG, "Running queued promise jobs");

View file

@ -228,7 +228,13 @@ public:
GC::Ptr<PrimitiveString> object_Object;
} cached_strings;
void run_queued_promise_jobs();
void run_queued_promise_jobs()
{
if (m_promise_jobs.is_empty())
return;
run_queued_promise_jobs_impl();
}
void enqueue_promise_job(GC::Ref<GC::Function<ThrowCompletionOr<Value>()>> job, Realm*);
void run_queued_finalization_registry_cleanup_jobs();
@ -299,6 +305,8 @@ private:
void set_well_known_symbols(WellKnownSymbols well_known_symbols) { m_well_known_symbols = move(well_known_symbols); }
void run_queued_promise_jobs_impl();
HashMap<String, GC::Ptr<PrimitiveString>> m_string_cache;
HashMap<Utf16String, GC::Ptr<PrimitiveString>> m_utf16_string_cache;