Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7c3a43aeff3abf9c456b20ca8514c329013c3dcb
      
https://github.com/WebKit/WebKit/commit/7c3a43aeff3abf9c456b20ca8514c329013c3dcb
  Author: Yusuke Suzuki <[email protected]>
  Date:   2025-12-08 (Mon, 08 Dec 2025)

  Changed paths:
    A JSTests/microbenchmarks/promise-any.js
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/Sources.txt
    M Source/JavaScriptCore/builtins/PromiseConstructor.js
    M Source/JavaScriptCore/heap/Heap.cpp
    M Source/JavaScriptCore/heap/Heap.h
    M Source/JavaScriptCore/interpreter/Interpreter.cpp
    M Source/JavaScriptCore/runtime/JSCast.h
    M Source/JavaScriptCore/runtime/JSFunctionWithFields.h
    M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
    M Source/JavaScriptCore/runtime/JSMicrotask.cpp
    M Source/JavaScriptCore/runtime/JSPromise.cpp
    R Source/JavaScriptCore/runtime/JSPromiseAllContext.cpp
    R Source/JavaScriptCore/runtime/JSPromiseAllContext.h
    R Source/JavaScriptCore/runtime/JSPromiseAllContextInlines.h
    R Source/JavaScriptCore/runtime/JSPromiseAllGlobalContext.cpp
    R Source/JavaScriptCore/runtime/JSPromiseAllGlobalContext.h
    A Source/JavaScriptCore/runtime/JSPromiseCombinatorsContext.cpp
    A Source/JavaScriptCore/runtime/JSPromiseCombinatorsContext.h
    A Source/JavaScriptCore/runtime/JSPromiseCombinatorsContextInlines.h
    A Source/JavaScriptCore/runtime/JSPromiseCombinatorsGlobalContext.cpp
    A Source/JavaScriptCore/runtime/JSPromiseCombinatorsGlobalContext.h
    M Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
    M Source/JavaScriptCore/runtime/JSPromiseConstructor.h
    M Source/JavaScriptCore/runtime/JSType.cpp
    M Source/JavaScriptCore/runtime/JSType.h
    M Source/JavaScriptCore/runtime/Microtask.h
    M Source/JavaScriptCore/runtime/VM.cpp
    M Source/JavaScriptCore/runtime/VM.h

  Log Message:
  -----------
  [JSC] Move Promise.any to C++
https://bugs.webkit.org/show_bug.cgi?id=303732
rdar://166035878

Reviewed by Sosuke Suzuki.

This patch moves Promise.any implementation from JS to C++ in the same
way to Promise.all and Promise.allSettled. We use existing helpers and
making it much faster than old Promise.any implementation. We define
internal microtask for major case, so no longer need to invoke a custom
function through Interpreter. Also we rename JSPromiseAllContext to
JSPromiseCombinatorsContext since it is used by Promise.all /
Promise.allSettled / Promise.any at this point.

                               ToT                     Patched

    promise-any          10.2568+-0.3150     ^      6.4039+-0.0927        ^ 
definitely 1.6016x faster

Test: JSTests/microbenchmarks/promise-any.js

* JSTests/microbenchmarks/promise-any.js: Added.
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/Sources.txt:
* Source/JavaScriptCore/builtins/PromiseConstructor.js:
(any): Deleted.
* Source/JavaScriptCore/heap/Heap.cpp:
* Source/JavaScriptCore/heap/Heap.h:
* Source/JavaScriptCore/interpreter/Interpreter.cpp:
(JSC::Interpreter::getAsyncStackTrace):
* Source/JavaScriptCore/runtime/JSCast.h:
* Source/JavaScriptCore/runtime/JSFunctionWithFields.h:
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
* Source/JavaScriptCore/runtime/JSMicrotask.cpp:
(JSC::runInternalMicrotask):
* Source/JavaScriptCore/runtime/JSPromise.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/JSPromiseCombinatorsContext.cpp: Renamed from 
Source/JavaScriptCore/runtime/JSPromiseAllContext.cpp.
(JSC::JSPromiseCombinatorsContext::create):
(JSC::JSPromiseCombinatorsContext::visitChildrenImpl):
* Source/JavaScriptCore/runtime/JSPromiseCombinatorsContext.h: Renamed from 
Source/JavaScriptCore/runtime/JSPromiseAllContext.h.
* Source/JavaScriptCore/runtime/JSPromiseCombinatorsContextInlines.h: Renamed 
from Source/JavaScriptCore/runtime/JSPromiseAllContextInlines.h.
(JSC::JSPromiseCombinatorsContext::createStructure):
* Source/JavaScriptCore/runtime/JSPromiseCombinatorsGlobalContext.cpp: Renamed 
from Source/JavaScriptCore/runtime/JSPromiseAllGlobalContext.cpp.
(JSC::JSPromiseCombinatorsGlobalContext::create):
(JSC::JSPromiseCombinatorsGlobalContext::createStructure):
(JSC::JSPromiseCombinatorsGlobalContext::visitChildrenImpl):
* Source/JavaScriptCore/runtime/JSPromiseCombinatorsGlobalContext.h: Renamed 
from Source/JavaScriptCore/runtime/JSPromiseAllGlobalContext.h.
* Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp:
(JSC::promiseAllSlow):
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::promiseAllSettledSlow):
(JSC::promiseAnySlow):
* Source/JavaScriptCore/runtime/JSPromiseConstructor.h:
* Source/JavaScriptCore/runtime/JSType.cpp:
(WTF::printInternal):
* Source/JavaScriptCore/runtime/JSType.h:
* Source/JavaScriptCore/runtime/Microtask.h:
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::VM):
(JSC::VM::promiseAnyRejectFunctionExecutableSlow):
(JSC::VM::promiseAnySlowRejectFunctionExecutableSlow):
(JSC::VM::visitAggregateImpl):
* Source/JavaScriptCore/runtime/VM.h:
(JSC::VM::promiseAnyRejectFunctionExecutable):
(JSC::VM::promiseAnySlowRejectFunctionExecutable):

Canonical link: https://commits.webkit.org/304084@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to