Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a82152a948706387199daa4d8c53c74dcca27318
      
https://github.com/WebKit/WebKit/commit/a82152a948706387199daa4d8c53c74dcca27318
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-02-03 (Tue, 03 Feb 2026)

  Changed paths:
    A JSTests/microbenchmarks/spread-map-keys.js
    A JSTests/microbenchmarks/spread-map-values.js
    A JSTests/stress/spread-map-iterator-dfg-ftl.js
    A JSTests/stress/spread-map-iterator-having-a-bad-time.js
    A JSTests/stress/spread-map-iterator-osr-exit.js
    A JSTests/stress/spread-map-iterator.js
    M Source/JavaScriptCore/bytecode/SpeculatedType.h
    M Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
    M Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
    M Source/JavaScriptCore/dfg/DFGGraph.h
    M Source/JavaScriptCore/dfg/DFGJITCode.cpp
    M Source/JavaScriptCore/dfg/DFGJITCode.h
    M Source/JavaScriptCore/dfg/DFGNode.h
    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/runtime/CommonSlowPathsInlines.h
    M Source/JavaScriptCore/runtime/JSCellButterfly.cpp
    M Source/JavaScriptCore/runtime/JSCellButterfly.h
    M Source/JavaScriptCore/runtime/JSMapIterator.h
    M Source/JavaScriptCore/runtime/JSMapIteratorInlines.h

  Log Message:
  -----------
  [JSC] Optimize `[...map.keys()]` and `[...map.values()]`
https://bugs.webkit.org/show_bug.cgi?id=306740

Reviewed by Yusuke Suzuki.

This patch changes to optimize `[...map.keys()]` and `[...map.values()]`.

                           TipOfTree                  Patched

spread-map-keys          6.1927+-0.1612     ^      1.6373+-0.1146        ^ 
definitely 3.7822x faster
spread-map-values        6.3760+-0.1259     ^      1.6840+-0.0844        ^ 
definitely 3.7862x faster

* JSTests/microbenchmarks/spread-map-keys.js: Added.
(benchmarkSpreadMapKeys):
* JSTests/microbenchmarks/spread-map-values.js: Added.
(benchmarkSpreadMapValues):
* JSTests/stress/spread-map-iterator-dfg-ftl.js: Added.
(shouldBe):
(shouldBeArray):
(testSpreadKeys):
(testSpreadValues):
(testPartialIteratorKeys):
(testPartialIteratorValues):
(testConsistentStructure):
* JSTests/stress/spread-map-iterator-having-a-bad-time.js: Added.
(shouldBe):
(shouldBeArray):
(shouldBe.spreadKeys):
(shouldBe.spreadValues):
(spreadKeys):
(spreadValues):
(shouldBeArray.testSpread):
(spreadTest):
* JSTests/stress/spread-map-iterator-osr-exit.js: Added.
(shouldBe):
(shouldBeArray):
(shouldBe.spreadKeys):
(shouldBe.MapIteratorPrototype.next):
(spreadValues):
(MapIteratorPrototype.Symbol.iterator):
(testMixed):
(spreadKeysWithModification):
(set shouldBeArray):
* JSTests/stress/spread-map-iterator.js: Added.
(shouldBe):
(shouldBeArray):
* Source/JavaScriptCore/bytecode/SpeculatedType.h:
(JSC::isMapIteratorSpeculation):
* Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* Source/JavaScriptCore/dfg/DFGGraph.h:
* Source/JavaScriptCore/dfg/DFGJITCode.cpp:
(JSC::DFG::JITData::JITData):
(JSC::DFG::JITData::tryInitialize):
* Source/JavaScriptCore/dfg/DFGJITCode.h:
* Source/JavaScriptCore/dfg/DFGNode.h:
(JSC::DFG::Node::shouldSpeculateMapIteratorObject):
* Source/JavaScriptCore/dfg/DFGOperations.cpp:
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/dfg/DFGOperations.h:
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileSpread):
* Source/JavaScriptCore/runtime/CommonSlowPathsInlines.h:
(JSC::CommonSlowPaths::trySpreadFast):
* Source/JavaScriptCore/runtime/JSCellButterfly.cpp:
(JSC::JSCellButterfly::createFromMapIterator):
* Source/JavaScriptCore/runtime/JSCellButterfly.h:
* Source/JavaScriptCore/runtime/JSMapIterator.h:
* Source/JavaScriptCore/runtime/JSMapIteratorInlines.h:
(JSC::JSMapIterator::isIteratorProtocolFastAndNonObservable):

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



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

Reply via email to