[webkit-changes] [WebKit/WebKit] a9590d: [JSC] Reduce cost of ValueProfile

Yusuke Suzuki noreply at github.com
Sat Sep 3 04:17:18 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a9590d7d9907dd267f35109c2783a54cd5dd346e
      https://github.com/WebKit/WebKit/commit/a9590d7d9907dd267f35109c2783a54cd5dd346e
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2022-09-03 (Sat, 03 Sep 2022)

  Changed paths:
    M Source/JavaScriptCore/bytecode/CodeBlock.cpp
    M Source/JavaScriptCore/bytecode/CodeBlock.h
    M Source/JavaScriptCore/bytecode/SpeculatedType.cpp
    M Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
    M Source/JavaScriptCore/runtime/JSType.h

  Log Message:
  -----------
  [JSC] Reduce cost of ValueProfile
https://bugs.webkit.org/show_bug.cgi?id=244722

Reviewed by Mark Lam.

Speedometer2.1 showed that prediction computation from ValueProfile's captured JSValue is a bit costly,
which can be called from CodeBlock::finalizeUnconditionally, operationOptimize etc. This patch attempts
to make it cheap by,

1. Dropping unused arguments value profiles in non LLInt / Baseline CodeBlock. We are always using them
   in LLInt / Baseline CodeBlock, so the other CodeBlocks (DFG / FTL) do not need to have them.
2. speculationFromStructure gets fast path for more JSTypes. Avoiding going through speculationFromClassInfoInheritance,
   which is more costly.
3. CodeBlock::finalizeUnconditionally do not need to call updateAllPredictions for all CodeBlocks. Only
   calling it for Baseline / LLInt is enough since DFG / FTL's ValueProfiles are the same to the corresponding
   Baseline / LLInt CodeBlocks' one.
4. Reduce lock-and-unlock.

AppleSilicon is neutral. Speedometer2.1 in Intel shows 0.21% improvement.

* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::setNumParameters):
(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::updateAllValueProfilePredictionsAndCountLiveness):
(JSC::CodeBlock::updateAllValueProfilePredictions):
(JSC::CodeBlock::updateAllArrayPredictions):
(JSC::CodeBlock::updateAllPredictions):
(JSC::CodeBlock::shouldOptimizeNow):
* Source/JavaScriptCore/bytecode/CodeBlock.h:
(JSC::CodeBlock::numberOfArgumentValueProfiles):
(JSC::CodeBlock::valueProfileForArgument):
* Source/JavaScriptCore/bytecode/SpeculatedType.cpp:
(JSC::speculationFromClassInfoInheritance):
(JSC::speculationFromStructure):
* Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:
(JSC::LLInt::jitCompileAndSetHeuristics):
* Source/JavaScriptCore/runtime/JSType.h:
(JSC::isObjectType):

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




More information about the webkit-changes mailing list