Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 824017ee2ca01569f75426e73345bc9f7cb95cf8
      
https://github.com/WebKit/WebKit/commit/824017ee2ca01569f75426e73345bc9f7cb95cf8
  Author: Yusuke Suzuki <[email protected]>
  Date:   2025-12-05 (Fri, 05 Dec 2025)

  Changed paths:
    M Source/JavaScriptCore/builtins/BuiltinNames.h
    M Source/JavaScriptCore/builtins/PromiseConstructor.js
    M Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h
    M Source/JavaScriptCore/bytecode/LinkTimeConstant.h
    M Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
    M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
    M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
    M Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp
    M Source/JavaScriptCore/dfg/DFGOperations.cpp
    M Source/JavaScriptCore/dfg/DFGOperations.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
    M Source/JavaScriptCore/ftl/FTLOperations.cpp
    M Source/JavaScriptCore/runtime/Intrinsic.h
    M Source/JavaScriptCore/runtime/JSFunctionWithFields.h
    M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
    M Source/JavaScriptCore/runtime/JSGlobalObject.h
    M Source/JavaScriptCore/runtime/JSMicrotask.cpp
    M Source/JavaScriptCore/runtime/JSPromise.cpp
    M Source/JavaScriptCore/runtime/JSPromiseAllContext.cpp
    M Source/JavaScriptCore/runtime/JSPromiseAllContext.h
    M Source/JavaScriptCore/runtime/JSPromiseAllGlobalContext.cpp
    M Source/JavaScriptCore/runtime/JSPromiseAllGlobalContext.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.all implementation to C++
https://bugs.webkit.org/show_bug.cgi?id=303603
rdar://165891602

Reviewed by Sosuke Suzuki.

JS version of that has serious performance issue for the startup case.
Once it gets FTL, it gets much better. But Baseline / DFG are really
slow compared to C++ native code.

1. We move all of Promise.all code from JS to C++. We reimplement it in
   the same way to what Promise.race is doing. We leverage existing
   JSPromise related helper functions so not so many new code is
   necessary.
2. We introduce `PromiseAllResolveJob` InternalMicrotask which is used
   for fast path Promise.all driving function. We can avoid passing a
   function and we can fully execute these reaction job in C++ in
   runInternalMicrotask.
3. We make JSPromiseAllContext / JSPromiseAllGlobalContext just cells
   instead of objects since they are no longer exposed to builtin JS.
   Also we can remove many of DFG / FTL handlings for these objects
   since they are no longer necessary.

* Source/JavaScriptCore/builtins/BuiltinNames.h:
* Source/JavaScriptCore/builtins/PromiseConstructor.js:
(linkTimeConstant.promiseAllSlow): Deleted.
(linkTimeConstant.promiseNewOnRejected): Deleted.
(linkTimeConstant.promiseAllNewResolveElement): Deleted.
(all): Deleted.
* Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h:
* Source/JavaScriptCore/bytecode/LinkTimeConstant.h:
* Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::emitIsPromise):
(JSC::BytecodeGenerator::emitIsPromiseAllContext): Deleted.
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::promiseAllContextInternalFieldIndex): Deleted.
(JSC::promiseAllGlobalContextInternalFieldIndex): Deleted.
(JSC::BytecodeIntrinsicNode::emit_intrinsic_getPromiseAllContextInternalField): 
Deleted.
(JSC::BytecodeIntrinsicNode::emit_intrinsic_getPromiseAllGlobalContextInternalField):
 Deleted.
(JSC::BytecodeIntrinsicNode::emit_intrinsic_putPromiseAllContextInternalField): 
Deleted.
(JSC::BytecodeIntrinsicNode::emit_intrinsic_putPromiseAllGlobalContextInternalField):
 Deleted.
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::handleIntrinsicCall):
* Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp:
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
* Source/JavaScriptCore/dfg/DFGOperations.h:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNewInternalFieldObject):
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* Source/JavaScriptCore/ftl/FTLOperations.cpp:
(JSC::FTL::JSC_DEFINE_NOEXCEPT_JIT_OPERATION):
* Source/JavaScriptCore/runtime/Intrinsic.h:
* Source/JavaScriptCore/runtime/JSFunctionWithFields.h:
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
(JSC::JSGlobalObject::visitChildrenImpl):
* Source/JavaScriptCore/runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::wrapForValidIteratorStructure const):
(JSC::JSGlobalObject::promiseAllContextStructure const): Deleted.
(JSC::JSGlobalObject::promiseAllGlobalContextStructure const): Deleted.
* Source/JavaScriptCore/runtime/JSMicrotask.cpp:
(JSC::runInternalMicrotask):
* Source/JavaScriptCore/runtime/JSPromise.cpp:
* Source/JavaScriptCore/runtime/JSPromiseAllContext.cpp:
(JSC::JSPromiseAllContext::create):
(JSC::JSPromiseAllContext::visitChildrenImpl):
(JSC::JSPromiseAllContext::createWithInitialValues): Deleted.
(JSC::JSPromiseAllContext::finishCreation): Deleted.
(JSC::JSC_DEFINE_HOST_FUNCTION): Deleted.
* Source/JavaScriptCore/runtime/JSPromiseAllContext.h:
* Source/JavaScriptCore/runtime/JSPromiseAllGlobalContext.cpp:
(JSC::JSPromiseAllGlobalContext::create):
(JSC::JSPromiseAllGlobalContext::createStructure):
(JSC::JSPromiseAllGlobalContext::visitChildrenImpl):
(JSC::JSPromiseAllGlobalContext::createWithInitialValues): Deleted.
(JSC::JSPromiseAllGlobalContext::finishCreation): Deleted.
(JSC::JSC_DEFINE_HOST_FUNCTION): Deleted.
* Source/JavaScriptCore/runtime/JSPromiseAllGlobalContext.h:
* Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::promiseAllSlow):
* 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::promiseAllFulfillFunctionExecutableSlow):
(JSC::VM::promiseAllSlowFulfillFunctionExecutableSlow):
(JSC::VM::visitAggregateImpl):
* Source/JavaScriptCore/runtime/VM.h:
(JSC::VM::promiseAllFulfillFunctionExecutable):
(JSC::VM::promiseAllSlowFulfillFunctionExecutable):

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



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

Reply via email to