[webkit-changes] [WebKit/WebKit] 5afa83: [JSC] Lower ValueBitXXX into ArithBitXXX when AI p...

Yusuke Suzuki noreply at github.com
Fri Oct 4 21:07:14 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5afa83f749d015298572502c49d8a2fe65d141c1
      https://github.com/WebKit/WebKit/commit/5afa83f749d015298572502c49d8a2fe65d141c1
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2024-10-04 (Fri, 04 Oct 2024)

  Changed paths:
    M Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
    M Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp

  Log Message:
  -----------
  [JSC] Lower ValueBitXXX into ArithBitXXX when AI proved input are Int32
https://bugs.webkit.org/show_bug.cgi?id=280916
rdar://137314028

Reviewed by Keith Miller.

We found that in some cases, we failed to track accurate types in
prediction, and end up using conservative node.

    if (typeof x === 'number') {
        x | 0 // Depending on the use of x, but the prediction can be String|Int32 still.
    } else {
        x + "42"
    }

And passing String|Int32 to x, end up generating ValueBitOr. But when
inlining them and running AI, we may prove that x is always Int32 later.

In this patch, we attempt to lower these cases into more optimized
nodes, like ValueBitOr => ArithBitOr when we prove that both input are
definitely Int32. We also expand CompareEq etc.'s coverage onto the
proven types and some more additional handling in ArithBitOr in AI.

* Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):

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



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


More information about the webkit-changes mailing list