[webkit-changes] [WebKit/WebKit] d62f98: [JSC] Remove locking for profile updates

Yusuke Suzuki noreply at github.com
Thu Oct 5 13:09:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d62f981d7a110a91b051ec431559dfc1972f7f8d
      https://github.com/WebKit/WebKit/commit/d62f981d7a110a91b051ec431559dfc1972f7f8d
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-10-05 (Thu, 05 Oct 2023)

  Changed paths:
    M Source/JavaScriptCore/bytecode/ArrayProfile.cpp
    M Source/JavaScriptCore/bytecode/ArrayProfile.h
    M Source/JavaScriptCore/bytecode/CodeBlock.cpp
    M Source/JavaScriptCore/bytecode/CodeBlock.h
    M Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp
    M Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h
    M Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.cpp
    M Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
    M Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
    M Source/JavaScriptCore/jit/JITOperations.cpp
    M Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
    M Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp

  Log Message:
  -----------
  [JSC] Remove locking for profile updates
https://bugs.webkit.org/show_bug.cgi?id=262689
rdar://116512260

Reviewed by Mark Lam.

1. ArrayProfile update actually does not need to have a lock. Let's just make it racy, and it is fine.
   Removing locking.
2. We use ConcurrentVector and storeStoreFence carefully to make LazyOperandValueProfile concurrently accessible.
   It is always added from the mutator, and read by the compiler threads. So we can ensure the accessible size
   by using storeStoreFence.

As a result, we no longer need to take a lock for profile update on 64bit (Note that valueProfileLock is NoLockingNecessary in 64bit).

* Source/JavaScriptCore/bytecode/ArrayProfile.cpp:
(JSC::ArrayProfile::computeUpdatedPrediction):
(JSC::ArrayProfile::briefDescription):
(JSC::ArrayProfile::briefDescriptionWithoutUpdating):
* Source/JavaScriptCore/bytecode/ArrayProfile.h:
* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::updateAllLazyValueProfilePredictions):
(JSC::CodeBlock::updateAllArrayProfilePredictions):
(JSC::CodeBlock::updateAllPredictions):
(JSC::CodeBlock::shouldOptimizeNowFromBaseline):
* Source/JavaScriptCore/bytecode/CodeBlock.h:
(JSC::CodeBlock::lazyOperandValueProfiles):
* Source/JavaScriptCore/bytecode/LazyOperandValueProfile.cpp:
(JSC::CompressedLazyOperandValueProfileHolder::computeUpdatedPredictions):
(JSC::CompressedLazyOperandValueProfileHolder::add):
(JSC::LazyOperandValueProfileParser::initialize):
(JSC::LazyOperandValueProfileParser::getIfPresent const):
(JSC::LazyOperandValueProfileParser::prediction const):
* Source/JavaScriptCore/bytecode/LazyOperandValueProfile.h:
* Source/JavaScriptCore/bytecode/MethodOfGettingAValueProfile.cpp:
(JSC::MethodOfGettingAValueProfile::emitReportValue const):
* Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::getArrayMode):
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
* Source/JavaScriptCore/dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::attemptToMakeGetArrayLength):
* Source/JavaScriptCore/jit/JITOperations.cpp:
(JSC::JSC_DEFINE_JIT_OPERATION):
(JSC::putByValOptimize):
(JSC::directPutByValOptimize):
* Source/JavaScriptCore/llint/LLIntSlowPaths.cpp:
(JSC::LLInt::jitCompileAndSetHeuristics):
* Source/JavaScriptCore/profiler/ProfilerBytecodeSequence.cpp:
(JSC::Profiler::BytecodeSequence::BytecodeSequence):

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




More information about the webkit-changes mailing list