Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ee4792cb07c7986456e697d040a9034a3bd6e280
      
https://github.com/WebKit/WebKit/commit/ee4792cb07c7986456e697d040a9034a3bd6e280
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-09-26 (Sat, 26 Sep 2026)

  Changed paths:
    A JSTests/stress/ftl-osr-exit-many-exits-fire-repeatedly.js
    M 
Source/JavaScriptCore/SaferCPPExpectations/NoUncountedMemberCheckerExpectations
    M Source/JavaScriptCore/bytecode/CodeBlock.cpp
    M Source/JavaScriptCore/dfg/DFGOSRExit.cpp
    M Source/JavaScriptCore/dfg/DFGOSRExitBase.cpp
    M Source/JavaScriptCore/dfg/DFGOSRExitBase.h
    M Source/JavaScriptCore/ftl/FTLJITCode.cpp
    M Source/JavaScriptCore/ftl/FTLJITCode.h
    M Source/JavaScriptCore/ftl/FTLLink.cpp
    M Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
    M Source/JavaScriptCore/ftl/FTLOSRExit.cpp
    M Source/JavaScriptCore/ftl/FTLOSRExit.h
    M Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp
    M Source/JavaScriptCore/ftl/FTLOSRExitHandle.cpp
    M Source/JavaScriptCore/ftl/FTLOSRExitHandle.h
    M Source/JavaScriptCore/ftl/FTLPatchpointExceptionHandle.cpp
    M Source/JavaScriptCore/ftl/FTLState.h

  Log Message:
  -----------
  [JSC] Store FTL OSR exits as a byte stream
https://bugs.webkit.org/show_bug.cgi?id=324517

Reviewed by Yusuke Suzuki.

This is the FTL counterpart of 321231@main. Every FTL OSR exit keeps a
56-byte FTL::OSRExit for as long as the FTL code lives, although it is only
read when the exit fires for the first time, when the code block is
jettisoned, or when an inline cache needs the registers live at an
exception handler. On JetStream3, 0.5% of the exits ever fire.

This patch stores them as an FTL::OSRExitStream, which has the format of
DFG::OSRExitStream with the FTL's fields in place of the DFG's (the format
is in the comment above the class), and shares the code origin encoding
with the DFG. Unlike the DFG's, the FTL's entrances are not contiguous,
so the stream also keeps where each entrance is and an exit firing for the
first time is found by decoding from the start, as the linear search did before.

One JetStream3 run, 166k exits:

                   Before     After

    Total          9.3 MB     2.0 MB
    Per exit       56 B       12.1 B

Tests: JSTests/stress/ftl-osr-exit-many-exits-fire-repeatedly.js

* JSTests/stress/ftl-osr-exit-many-exits-fire-repeatedly.js: Added.
(shouldBe):
(sum):
(make):
* Source/JavaScriptCore/bytecode/CodeBlock.cpp:
(JSC::CodeBlock::tallyFrequentExitSites):
* Source/JavaScriptCore/dfg/DFGOSRExit.cpp:
(JSC::DFG::codeOriginTag): Deleted.
(JSC::DFG::codeOriginTagFromFlags): Deleted.
(JSC::DFG::encodeCodeOrigin): Deleted.
(JSC::DFG::decodeCodeOrigin): Deleted.
* Source/JavaScriptCore/dfg/DFGOSRExitBase.cpp:
(JSC::DFG::codeOriginTag):
(JSC::DFG::encodeCodeOrigin):
(JSC::DFG::decodeCodeOrigin):
* Source/JavaScriptCore/dfg/DFGOSRExitBase.h:
(JSC::DFG::OSRExitBase::OSRExitBase):
(JSC::DFG::codeOriginTagFromFlags):
* Source/JavaScriptCore/ftl/FTLJITCode.cpp:
(JSC::FTL::JITCode::shrinkToFit):
(JSC::FTL::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
(JSC::FTL::JITCode::findPC):
* Source/JavaScriptCore/ftl/FTLJITCode.h:
(JSC::FTL::JITCode::osrExit const):
(JSC::FTL::JITCode::osrExitEntrance const):
(JSC::FTL::JITCode::osrExitIndexForReturnPC const):
(JSC::FTL::JITCode::appendOSRExitDescriptor):
* Source/JavaScriptCore/ftl/FTLLink.cpp:
(JSC::FTL::link):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* Source/JavaScriptCore/ftl/FTLOSRExit.cpp:
(JSC::FTL::OSRExitDescriptor::OSRExitDescriptor):
(JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle):
(JSC::FTL::OSRExit::OSRExit):
(JSC::FTL::OSRExitStream::OSRExitStream):
(JSC::FTL::OSRExitStream::decode const):
(JSC::FTL::OSRExitStream::at const):
(JSC::FTL::OSRExitStream::indexForEntranceOffset const):
* Source/JavaScriptCore/ftl/FTLOSRExit.h:
* Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::JSC_DEFINE_NOEXCEPT_JIT_OPERATION):
* Source/JavaScriptCore/ftl/FTLOSRExitHandle.cpp:
(JSC::FTL::OSRExitHandle::emitExitThunk):
* Source/JavaScriptCore/ftl/FTLOSRExitHandle.h:
(JSC::FTL::OSRExitHandle::OSRExitHandle):
* Source/JavaScriptCore/ftl/FTLPatchpointExceptionHandle.cpp:
(JSC::FTL::PatchpointExceptionHandle::scheduleExitCreationForUnwind):
* Source/JavaScriptCore/ftl/FTLState.h:

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



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

Reply via email to