Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ad63895f25ec02cf2dd3de7694c801e53f0bb93d
      
https://github.com/WebKit/WebKit/commit/ad63895f25ec02cf2dd3de7694c801e53f0bb93d
  Author: Yusuke Suzuki <[email protected]>
  Date:   2024-06-13 (Thu, 13 Jun 2024)

  Changed paths:
    M Source/JavaScriptCore/bytecode/GetByStatus.cpp
    M Source/JavaScriptCore/bytecode/InlineCacheCompiler.cpp
    M Source/JavaScriptCore/bytecode/InlineCacheCompiler.h
    M Source/JavaScriptCore/bytecode/PutByStatus.cpp
    M Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.cpp
    M Source/JavaScriptCore/bytecode/StructureStubClearingWatchpoint.h
    M Source/JavaScriptCore/bytecode/StructureStubInfo.cpp
    M Source/JavaScriptCore/bytecode/StructureStubInfo.h
    M Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp
    M Source/JavaScriptCore/jit/GCAwareJITStubRoutine.h

  Log Message:
  -----------
  [JSC] Split large Handler IC into per AccessCase handlers
https://bugs.webkit.org/show_bug.cgi?id=275428
rdar://129733285

Reviewed by Keith Miller.

Before this patch, for multiple AccessCases IC, we are still generating 
sequence of code combining all AccessCases.
This generates very succinct small code, but it makes sharing hard. As a 
result, we end up generating code frequently.

In this patch, we split this large code. In Handler IC with constant-identifier 
case (we will eventually remove this limitation),
we generate code only one per AccessCase. And we chain these snippets as a 
chain of handlers. Each handler has next handler, and
code will jump to the next handler when it does not meet the handler's 
requirement. And the last handler holds the code for generic fallback.
By doing so, we can increase cache hit rate significantly. Pre-compiled Handler 
IC code can be easily reused, and even for code-generated case
can get a cached one easily since we no longer need to consider about the 
combination of AccessCases.

Because AccessCase code generation becomes super cheap (in most of cases, we no 
longer generate code), we remove AccessCase buffering in this case.
When a new AccessCase is added, we immediately generate a new Handler and chain 
it to the existing one. This makes IC setup super fast and it removes
a lot of complexity for IC code generation.

* Source/JavaScriptCore/bytecode/GetByStatus.cpp:
(JSC::GetByStatus::computeForStubInfoWithoutExitSiteFeedback):
* Source/JavaScriptCore/bytecode/InlineCacheCompiler.cpp:
(JSC::InlineCacheCompiler::useHandlerIC const):
(JSC::InlineCacheCompiler::succeed):
(JSC::InlineCacheCompiler::calculateLiveRegistersForCallAndExceptionHandling):
(JSC::InlineCacheCompiler::preserveLiveRegistersToStackForCallWithoutExceptions):
(JSC::InlineCacheCompiler::callSiteIndexForExceptionHandlingOrOriginal):
(JSC::InlineCacheCompiler::originalExceptionHandler):
(JSC::InlineCacheCompiler::originalCallSiteIndex const):
(JSC::InlineCacheCompiler::makeDefaultScratchAllocator):
(JSC::InlineCacheCompiler::emitDataICJumpNextHandler):
(JSC::InlineCacheHandler::InlineCacheHandler):
(JSC::m_next):
(JSC::InlineCacheHandler::create):
(JSC::InlineCacheHandler::createPreCompiled):
(JSC::InlineCacheCompiler::generateWithGuard):
(JSC::InlineCacheCompiler::generateWithoutGuard):
(JSC::InlineCacheCompiler::generateAccessCase):
(JSC::InlineCacheCompiler::emitDOMJITGetter):
(JSC::InlineCacheCompiler::emitModuleNamespaceLoad):
(JSC::InlineCacheCompiler::emitProxyObjectAccess):
(JSC::InlineCacheCompiler::emitIntrinsicGetter):
(JSC::InlineCacheCompiler::tryFoldToMegamorphic):
(JSC::InlineCacheCompiler::compile):
(JSC::getByIdLoadHandlerCodeGeneratorImpl):
(JSC::getByIdMissHandlerCodeGenerator):
(JSC::getByIdCustomHandlerImpl):
(JSC::getByIdGetterHandler):
(JSC::getByIdProxyObjectLoadHandler):
(JSC::putByIdReplaceHandlerCodeGenerator):
(JSC::putByIdTransitionHandlerCodeGeneratorImpl):
(JSC::putByIdCustomHandlerImpl):
(JSC::putByIdSetterHandlerImpl):
(JSC::InlineCacheCompiler::compileHandler):
(JSC::InlineCacheCompiler::compileOneAccessCaseHandler):
(JSC::PolymorphicAccess::addCases):
(JSC::m_watchpoint): Deleted.
(JSC::PolymorphicAccess::addCase): Deleted.
* Source/JavaScriptCore/bytecode/InlineCacheCompiler.h:
(JSC::InlineCacheCompiler::InlineCacheCompiler):
* Source/JavaScriptCore/bytecode/PutByStatus.cpp:
(JSC::PutByStatus::computeForStubInfo):
* Source/JavaScriptCore/bytecode/StructureStubInfo.cpp:
(JSC::StructureStubInfo::aboutToDie):
(JSC::StructureStubInfo::addAccessCase):
(JSC::StructureStubInfo::visitWeakReferences):
(JSC::StructureStubInfo::callLinkInfoAt):
(JSC::StructureStubInfo::containsPC const):
(JSC::StructureStubInfo::initializeFromUnlinkedStructureStubInfo):
(JSC::StructureStubInfo::replaceHandler):
(JSC::StructureStubInfo::prependHandler):
(JSC::StructureStubInfo::resetStubAsJumpInAccess):
* Source/JavaScriptCore/bytecode/StructureStubInfo.h:
(JSC::StructureStubInfo::useHandlerIC const):

Canonical link: https://commits.webkit.org/279991@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