Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d8043dd24f7eddc83c06c6730d025e8ce98684c5
      
https://github.com/WebKit/WebKit/commit/d8043dd24f7eddc83c06c6730d025e8ce98684c5
  Author: Yijia Huang <[email protected]>
  Date:   2025-03-29 (Sat, 29 Mar 2025)

  Changed paths:
    M Source/JavaScriptCore/dfg/DFGLoopUnrollingPhase.cpp

  Log Message:
  -----------
  [JSC] Improve loop unrolling heuristics by counting only material nodes
https://bugs.webkit.org/show_bug.cgi?id=290513
rdar://147993710

Reviewed by Justin Michaud and Yusuke Suzuki.

This patch refines the loop unrolling heuristic in the DFG by counting only
nodes that would actually emit code ("material" nodes) when estimating the
loop body size. This prevents loops from being prematurely disqualified for
unrolling due to non-material nodes such as Phantom or ExitOK.

Previously, loop body size was estimated using BasicBlock::size(), which
includes all nodes, even those that don't lower to code. This patch introduces
a new helper `isMaterialNode()` to check whether a node is code-generating.
This logic is aligned with DFGDCEPhase and LowerDFGToB3::compileNode.

We also removed the separate `canCloneLoop()` method and merged cloneability
checks directly into `shouldUnrollLoop()` to avoid double iteration and 
simplify control flow.

* Source/JavaScriptCore/dfg/DFGLoopUnrollingPhase.cpp:
(JSC::DFG::LoopUnrollingPhase::tryUnroll):
(JSC::DFG::LoopUnrollingPhase::identifyInductionVariable):
(JSC::DFG::LoopUnrollingPhase::shouldUnrollLoop):
(JSC::DFG::LoopUnrollingPhase::isMaterialNode):
(JSC::DFG::LoopUnrollingPhase::canCloneLoop): Deleted.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to