⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 276224 in webkit


Ignore:
Timestamp:
Apr 18, 2021, 12:14:07 AM (5 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Make more DFG/FTL data FixedVector/Vector
https://bugs.webkit.org/show_bug.cgi?id=224713

Reviewed by Darin Adler.

  1. DFG::JITCode::m_osrEntry / DFG::JITCode::m_osrExit / DFG::JITCode::m_speculationRecovery are changed to FixedVector. They are added at compiling time, and after that, these vectors are not modified. So when finalizing, we can easily make it FixedVector. We also change OSREntry::{m_reshufflings,m_expectedValues} to FixedVector and FixedOperands.
  2. FTL::JITCode::m_osrExit is changed from SegmentedVector to Vector. We are still using Vector since it also involves osrExitDescriptor. But later, we should merge m_osrExit to osrExitDescriptor. Vector is still better than SegmentedVector since it wastes several entries per segment. SegmentedVector was used to use a direct pointer of OSRExit (this is not possible in Vector since this pointer can be invalidated after growing), but usage of that is fairly limited so that we can just replace them with m_index + osrExit vector.
  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::tallyFrequentExitSites):

  • bytecode/Operands.h:

(JSC::Operands::Operands):

  • dfg/DFGJITCode.cpp:

(JSC::DFG::JITCode::shrinkToFit):
(JSC::DFG::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
(JSC::DFG::JITCode::validateReferences):
(JSC::DFG::JITCode::findPC):
(JSC::DFG::JITCode::finalizeOSREntrypoints):

  • dfg/DFGJITCode.h:
  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::linkOSRExits):
(JSC::DFG::JITCompiler::link):
(JSC::DFG::JITCompiler::noticeOSREntry):
(JSC::DFG::JITCompiler::appendExceptionHandlingOSRExit):

  • dfg/DFGJITCompiler.h:

(JSC::DFG::JITCompiler::appendOSRExit):
(JSC::DFG::JITCompiler::appendSpeculationRecovery):

  • dfg/DFGOSREntry.h:
  • dfg/DFGOSRExit.cpp:

(JSC::DFG::JSC_DEFINE_JIT_OPERATION):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::speculationCheck):
(JSC::DFG::SpeculativeJIT::emitInvalidationPoint):
(JSC::DFG::SpeculativeJIT::linkOSREntries):

  • ftl/FTLJITCode.cpp:

(JSC::FTL::JITCode::shrinkToFit):
(JSC::FTL::JITCode::validateReferences):
(JSC::FTL::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
(JSC::FTL::JITCode::findPC):

  • ftl/FTLJITCode.h:
  • ftl/FTLOSRExit.cpp:

(JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle):
(JSC::FTL::OSRExit::OSRExit):

  • ftl/FTLOSRExit.h:
  • ftl/FTLOSRExitCompiler.cpp:

(JSC::FTL::JSC_DEFINE_JIT_OPERATION):

  • ftl/FTLOSRExitHandle.cpp:

(JSC::FTL::OSRExitHandle::emitExitThunk):

  • ftl/FTLOSRExitHandle.h:

(JSC::FTL::OSRExitHandle::OSRExitHandle):

  • ftl/FTLPatchpointExceptionHandle.cpp:

(JSC::FTL::PatchpointExceptionHandle::scheduleExitCreationForUnwind):

Location:
trunk/Source/JavaScriptCore
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r276217 r276224  
     12021-04-18  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Make more DFG/FTL data FixedVector/Vector
     4        https://bugs.webkit.org/show_bug.cgi?id=224713
     5
     6        Reviewed by Darin Adler.
     7
     8        1. DFG::JITCode::m_osrEntry / DFG::JITCode::m_osrExit / DFG::JITCode::m_speculationRecovery are changed to FixedVector.
     9           They are added at compiling time, and after that, these vectors are not modified. So when finalizing, we can easily make it FixedVector.
     10           We also change OSREntry::{m_reshufflings,m_expectedValues} to FixedVector and FixedOperands.
     11        2. FTL::JITCode::m_osrExit is changed from SegmentedVector to Vector. We are still using Vector since it also involves osrExitDescriptor.
     12           But later, we should merge m_osrExit to osrExitDescriptor. Vector is still better than SegmentedVector since it wastes several entries
     13           per segment. SegmentedVector was used to use a direct pointer of OSRExit (this is not possible in Vector since this pointer can be invalidated
     14           after growing), but usage of that is fairly limited so that we can just replace them with m_index + osrExit vector.
     15
     16        * bytecode/CodeBlock.cpp:
     17        (JSC::CodeBlock::tallyFrequentExitSites):
     18        * bytecode/Operands.h:
     19        (JSC::Operands::Operands):
     20        * dfg/DFGJITCode.cpp:
     21        (JSC::DFG::JITCode::shrinkToFit):
     22        (JSC::DFG::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
     23        (JSC::DFG::JITCode::validateReferences):
     24        (JSC::DFG::JITCode::findPC):
     25        (JSC::DFG::JITCode::finalizeOSREntrypoints):
     26        * dfg/DFGJITCode.h:
     27        * dfg/DFGJITCompiler.cpp:
     28        (JSC::DFG::JITCompiler::linkOSRExits):
     29        (JSC::DFG::JITCompiler::link):
     30        (JSC::DFG::JITCompiler::noticeOSREntry):
     31        (JSC::DFG::JITCompiler::appendExceptionHandlingOSRExit):
     32        * dfg/DFGJITCompiler.h:
     33        (JSC::DFG::JITCompiler::appendOSRExit):
     34        (JSC::DFG::JITCompiler::appendSpeculationRecovery):
     35        * dfg/DFGOSREntry.h:
     36        * dfg/DFGOSRExit.cpp:
     37        (JSC::DFG::JSC_DEFINE_JIT_OPERATION):
     38        * dfg/DFGSpeculativeJIT.cpp:
     39        (JSC::DFG::SpeculativeJIT::speculationCheck):
     40        (JSC::DFG::SpeculativeJIT::emitInvalidationPoint):
     41        (JSC::DFG::SpeculativeJIT::linkOSREntries):
     42        * ftl/FTLJITCode.cpp:
     43        (JSC::FTL::JITCode::shrinkToFit):
     44        (JSC::FTL::JITCode::validateReferences):
     45        (JSC::FTL::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
     46        (JSC::FTL::JITCode::findPC):
     47        * ftl/FTLJITCode.h:
     48        * ftl/FTLOSRExit.cpp:
     49        (JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle):
     50        (JSC::FTL::OSRExit::OSRExit):
     51        * ftl/FTLOSRExit.h:
     52        * ftl/FTLOSRExitCompiler.cpp:
     53        (JSC::FTL::JSC_DEFINE_JIT_OPERATION):
     54        * ftl/FTLOSRExitHandle.cpp:
     55        (JSC::FTL::OSRExitHandle::emitExitThunk):
     56        * ftl/FTLOSRExitHandle.h:
     57        (JSC::FTL::OSRExitHandle::OSRExitHandle):
     58        * ftl/FTLPatchpointExceptionHandle.cpp:
     59        (JSC::FTL::PatchpointExceptionHandle::scheduleExitCreationForUnwind):
     60
    1612021-04-17  Yusuke Suzuki  <ysuzuki@apple.com>
    262
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r276102 r276224  
    29742974    case JITType::DFGJIT: {
    29752975        DFG::JITCode* jitCode = m_jitCode->dfg();
    2976         for (auto& exit : jitCode->osrExit)
     2976        for (auto& exit : jitCode->m_osrExit)
    29772977            exit.considerAddingAsFrequentExitSite(profiledBlock);
    29782978        break;
     
    29812981#if ENABLE(FTL_JIT)
    29822982    case JITType::FTLJIT: {
    2983         // There is no easy way to avoid duplicating this code since the FTL::JITCode::osrExit
     2983        // There is no easy way to avoid duplicating this code since the FTL::JITCode::m_osrExit
    29842984        // vector contains a totally different type, that just so happens to behave like
    2985         // DFG::JITCode::osrExit.
     2985        // DFG::JITCode::m_osrExit.
    29862986        FTL::JITCode* jitCode = m_jitCode->ftl();
    2987         for (unsigned i = 0; i < jitCode->osrExit.size(); ++i) {
    2988             FTL::OSRExit& exit = jitCode->osrExit[i];
     2987        for (auto& exit : jitCode->m_osrExit)
    29892988            exit.considerAddingAsFrequentExitSite(profiledBlock);
    2990         }
    29912989        break;
    29922990    }
  • trunk/Source/JavaScriptCore/bytecode/Operands.h

    r275542 r276224  
    139139class Operands {
    140140public:
     141    template<typename, typename> friend class Operands;
     142
    141143    using Storage = StorageArg;
    142144    using RefType = std::conditional_t<std::is_same_v<T, bool>, FastBitReference, T&>;
     
    169171    {
    170172        m_values.fill(initialValue);
     173    }
     174
     175    template<typename U>
     176    explicit Operands(const Operands<T, U>& other)
     177        : m_values(other.m_values)
     178        , m_numArguments(other.m_numArguments)
     179        , m_numLocals(other.m_numLocals)
     180    {
    171181    }
    172182
  • trunk/Source/JavaScriptCore/dfg/DFGJITCode.cpp

    r261755 r276224  
    6060{
    6161    common.shrinkToFit();
    62     osrEntry.shrinkToFit();
    63     osrExit.shrinkToFit();
    64     speculationRecovery.shrinkToFit();
    6562    minifiedDFG.prepareAndShrink();
    6663    variableEventStream.shrinkToFit();
     
    8784RegisterSet JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite(CodeBlock* codeBlock, CallSiteIndex callSiteIndex)
    8885{
    89     for (OSRExit& exit : osrExit) {
     86    for (OSRExit& exit : m_osrExit) {
    9087        if (exit.isExceptionHandler() && exit.m_exceptionHandlerCallSiteIndex.bits() == callSiteIndex.bits()) {
    9188            Operands<ValueRecovery> valueRecoveries;
     
    220217    common.validateReferences(trackedReferences);
    221218   
    222     for (OSREntryData& entry : osrEntry) {
     219    for (OSREntryData& entry : m_osrEntry) {
    223220        for (unsigned i = entry.m_expectedValues.size(); i--;)
    224221            entry.m_expectedValues[i].validateReferences(trackedReferences);
     
    230227Optional<CodeOrigin> JITCode::findPC(CodeBlock*, void* pc)
    231228{
    232     for (OSRExit& exit : osrExit) {
     229    for (OSRExit& exit : m_osrExit) {
    233230        if (ExecutableMemoryHandle* handle = exit.m_code.executableMemory()) {
    234231            if (handle->start().untaggedPtr() <= pc && pc < handle->end().untaggedPtr())
     
    240237}
    241238
    242 void JITCode::finalizeOSREntrypoints()
     239void JITCode::finalizeOSREntrypoints(Vector<OSREntryData>&& osrEntry)
    243240{
    244241    auto comparator = [] (const auto& a, const auto& b) {
     
    254251    verifyIsSorted(osrEntry);
    255252#endif
     253    m_osrEntry = WTFMove(osrEntry);
    256254}
    257255
  • trunk/Source/JavaScriptCore/dfg/DFGJITCode.h

    r275542 r276224  
    5555    JITCode* dfg() final;
    5656   
    57     OSREntryData* appendOSREntryData(BytecodeIndex bytecodeIndex, CodeLocationLabel<OSREntryPtrTag> machineCode)
    58     {
    59         DFG::OSREntryData entry;
    60         entry.m_bytecodeIndex = bytecodeIndex;
    61         entry.m_machineCode = machineCode;
    62         osrEntry.append(entry);
    63         return &osrEntry.last();
    64     }
    65    
    6657    OSREntryData* osrEntryDataForBytecodeIndex(BytecodeIndex bytecodeIndex)
    6758    {
    6859        return tryBinarySearch<OSREntryData, BytecodeIndex>(
    69             osrEntry, osrEntry.size(), bytecodeIndex,
     60            m_osrEntry, m_osrEntry.size(), bytecodeIndex,
    7061            getOSREntryDataBytecodeIndex);
    7162    }
    7263
    73     void finalizeOSREntrypoints();
    74 
    75     unsigned appendOSRExit(const OSRExit& exit)
    76     {
    77         unsigned result = osrExit.size();
    78         osrExit.append(exit);
    79         return result;
    80     }
    81    
    82     OSRExit& lastOSRExit()
    83     {
    84         return osrExit.last();
    85     }
    86    
    87     unsigned appendSpeculationRecovery(const SpeculationRecovery& recovery)
    88     {
    89         unsigned result = speculationRecovery.size();
    90         speculationRecovery.append(recovery);
    91         return result;
    92     }
     64    void finalizeOSREntrypoints(Vector<DFG::OSREntryData>&&);
    9365   
    9466    void reconstruct(
     
    136108public:
    137109    CommonData common;
    138     Vector<DFG::OSREntryData> osrEntry;
    139     SegmentedVector<DFG::OSRExit, 8> osrExit;
    140     Vector<DFG::SpeculationRecovery> speculationRecovery;
     110    FixedVector<DFG::OSREntryData> m_osrEntry;
     111    FixedVector<DFG::OSRExit> m_osrExit;
     112    FixedVector<DFG::SpeculationRecovery> m_speculationRecovery;
    141113    DFG::VariableEventStream variableEventStream;
    142114    DFG::MinifiedGraph minifiedDFG;
  • trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.cpp

    r276005 r276224  
    6767void JITCompiler::linkOSRExits()
    6868{
    69     ASSERT(m_jitCode->osrExit.size() == m_exitCompilationInfo.size());
     69    ASSERT(m_osrExit.size() == m_exitCompilationInfo.size());
    7070    if (UNLIKELY(m_graph.compilation())) {
    71         for (unsigned i = 0; i < m_jitCode->osrExit.size(); ++i) {
     71        for (unsigned i = 0; i < m_osrExit.size(); ++i) {
    7272            OSRExitCompilationInfo& info = m_exitCompilationInfo[i];
    7373            Vector<Label> labels;
     
    8181    }
    8282   
    83     for (unsigned i = 0; i < m_jitCode->osrExit.size(); ++i) {
     83    for (unsigned i = 0; i < m_osrExit.size(); ++i) {
    8484        OSRExitCompilationInfo& info = m_exitCompilationInfo[i];
    8585        JumpList& failureJumps = info.m_failureJumps;
     
    279279    MacroAssemblerCodeRef<JITThunkPtrTag> osrExitThunk = vm().getCTIStub(osrExitGenerationThunkGenerator);
    280280    auto target = CodeLocationLabel<JITThunkPtrTag>(osrExitThunk.code());
    281     for (unsigned i = 0; i < m_jitCode->osrExit.size(); ++i) {
     281    for (unsigned i = 0; i < m_osrExit.size(); ++i) {
    282282        OSRExitCompilationInfo& info = m_exitCompilationInfo[i];
    283283        if (!Options::useProbeOSRExit()) {
    284284            linkBuffer.link(info.m_patchableJump.m_jump, target);
    285             OSRExit& exit = m_jitCode->osrExit[i];
     285            OSRExit& exit = m_osrExit[i];
    286286            exit.m_patchableJumpLocation = linkBuffer.locationOf<JSInternalPtrTag>(info.m_patchableJump);
    287287        }
     
    294294   
    295295    if (UNLIKELY(m_graph.compilation())) {
    296         ASSERT(m_exitSiteLabels.size() == m_jitCode->osrExit.size());
     296        ASSERT(m_exitSiteLabels.size() == m_osrExit.size());
    297297        for (unsigned i = 0; i < m_exitSiteLabels.size(); ++i) {
    298298            Vector<Label>& labels = m_exitSiteLabels[i];
     
    306306
    307307    m_jitCode->common.compilation = m_graph.compilation();
     308    m_jitCode->m_osrExit = WTFMove(m_osrExit);
     309    m_jitCode->m_speculationRecovery = WTFMove(m_speculationRecovery);
    308310   
    309311    // Link new DFG exception handlers and remove baseline JIT handlers.
     
    548550        return;
    549551
    550     OSREntryData* entry = m_jitCode->appendOSREntryData(basicBlock.bytecodeBegin, linkBuffer.locationOf<OSREntryPtrTag>(blockHead));
    551 
    552     entry->m_expectedValues = basicBlock.intersectionOfPastValuesAtHead;
    553        
     552    OSREntryData entry;
     553    entry.m_bytecodeIndex = basicBlock.bytecodeBegin;
     554    entry.m_machineCode = linkBuffer.locationOf<OSREntryPtrTag>(blockHead);
     555
     556    FixedOperands<AbstractValue> expectedValues(basicBlock.intersectionOfPastValuesAtHead);
     557    Vector<OSREntryReshuffling> reshufflings;
     558
    554559    // Fix the expected values: in our protocol, a dead variable will have an expected
    555560    // value of (None, []). But the old JIT may stash some values there. So we really
     
    558563        Node* node = basicBlock.variablesAtHead.argument(argument);
    559564        if (!node || !node->shouldGenerate())
    560             entry->m_expectedValues.argument(argument).makeBytecodeTop();
     565            expectedValues.argument(argument).makeBytecodeTop();
    561566    }
    562567    for (size_t local = 0; local < basicBlock.variablesAtHead.numberOfLocals(); ++local) {
    563568        Node* node = basicBlock.variablesAtHead.local(local);
    564569        if (!node || !node->shouldGenerate())
    565             entry->m_expectedValues.local(local).makeBytecodeTop();
     570            expectedValues.local(local).makeBytecodeTop();
    566571        else {
    567572            VariableAccessData* variable = node->variableAccessData();
    568             entry->m_machineStackUsed.set(variable->machineLocal().toLocal());
     573            entry.m_machineStackUsed.set(variable->machineLocal().toLocal());
    569574               
    570575            switch (variable->flushFormat()) {
    571576            case FlushedDouble:
    572                 entry->m_localsForcedDouble.set(local);
     577                entry.m_localsForcedDouble.set(local);
    573578                break;
    574579            case FlushedInt52:
    575                 entry->m_localsForcedAnyInt.set(local);
     580                entry.m_localsForcedAnyInt.set(local);
    576581                break;
    577582            default:
     
    581586            ASSERT(!variable->operand().isTmp());
    582587            if (variable->operand().virtualRegister() != variable->machineLocal()) {
    583                 entry->m_reshufflings.append(
     588                reshufflings.append(
    584589                    OSREntryReshuffling(
    585590                        variable->operand().virtualRegister().offset(), variable->machineLocal().offset()));
     
    588593    }
    589594       
    590     entry->m_reshufflings.shrinkToFit();
     595    entry.m_expectedValues = WTFMove(expectedValues);
     596    entry.m_reshufflings = WTFMove(reshufflings);
     597    m_osrEntry.append(WTFMove(entry));
    591598}
    592599
     
    597604    exit.m_exceptionHandlerCallSiteIndex = callSite;
    598605    OSRExitCompilationInfo& exitInfo = appendExitInfo(jumpsToFail);
    599     jitCode()->appendOSRExit(exit);
     606    m_osrExit.append(WTFMove(exit));
    600607    m_exceptionHandlerOSRExitCallSites.append(ExceptionHandlingOSRExitInfo { exitInfo, *exceptionHandler, callSite });
    601608}
  • trunk/Source/JavaScriptCore/dfg/DFGJITCompiler.h

    r272580 r276224  
    8787class JITCompiler : public CCallHelpers {
    8888public:
     89    friend class SpeculativeJIT;
     90
    8991    JITCompiler(Graph& dfg);
    9092    ~JITCompiler();
     
    266268    void noticeOSREntry(BasicBlock&, JITCompiler::Label blockHead, LinkBuffer&);
    267269    void noticeCatchEntrypoint(BasicBlock&, JITCompiler::Label blockHead, LinkBuffer&, Vector<FlushFormat>&& argumentFormats);
    268    
     270
     271    unsigned appendOSRExit(OSRExit&& exit)
     272    {
     273        unsigned result = m_osrExit.size();
     274        m_osrExit.append(WTFMove(exit));
     275        return result;
     276    }
     277
     278    unsigned appendSpeculationRecovery(const SpeculationRecovery& recovery)
     279    {
     280        unsigned result = m_speculationRecovery.size();
     281        m_speculationRecovery.append(recovery);
     282        return result;
     283    }
     284
    269285    RefPtr<JITCode> jitCode() { return m_jitCode; }
    270286   
     
    374390    SegmentedVector<OSRExitCompilationInfo, 4> m_exitCompilationInfo;
    375391    Vector<Vector<Label>> m_exitSiteLabels;
     392    Vector<DFG::OSREntryData> m_osrEntry;
     393    Vector<DFG::OSRExit> m_osrExit;
     394    Vector<DFG::SpeculationRecovery> m_speculationRecovery;
    376395   
    377396    struct ExceptionHandlingOSRExitInfo {
  • trunk/Source/JavaScriptCore/dfg/DFGOSREntry.h

    r276005 r276224  
    5757    BytecodeIndex m_bytecodeIndex;
    5858    CodeLocationLabel<OSREntryPtrTag> m_machineCode;
    59     Operands<AbstractValue> m_expectedValues;
     59    FixedOperands<AbstractValue> m_expectedValues;
    6060    // Use bitvectors here because they tend to only require one word.
    6161    BitVector m_localsForcedDouble;
    6262    BitVector m_localsForcedAnyInt;
    63     Vector<OSREntryReshuffling> m_reshufflings;
     63    FixedVector<OSREntryReshuffling> m_reshufflings;
    6464    BitVector m_machineStackUsed;
    6565   
  • trunk/Source/JavaScriptCore/dfg/DFGOSRExit.cpp

    r274045 r276224  
    164164
    165165    uint32_t exitIndex = vm.osrExitIndex;
    166     OSRExit& exit = codeBlock->jitCode()->dfg()->osrExit[exitIndex];
     166    OSRExit& exit = codeBlock->jitCode()->dfg()->m_osrExit[exitIndex];
    167167
    168168    ASSERT(!vm.callFrameForCatch || exit.m_kind == GenericUnwind);
     
    175175    SpeculationRecovery* recovery = nullptr;
    176176    if (exit.m_recoveryIndex != UINT_MAX)
    177         recovery = &codeBlock->jitCode()->dfg()->speculationRecovery[exit.m_recoveryIndex];
     177        recovery = &codeBlock->jitCode()->dfg()->m_speculationRecovery[exit.m_recoveryIndex];
    178178
    179179    {
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r276005 r276224  
    269269    } else
    270270        m_jit.appendExitInfo(jumpToFail);
    271     m_jit.jitCode()->appendOSRExit(OSRExit(kind, jsValueSource, m_jit.graph().methodOfGettingAValueProfileFor(m_currentNode, node), this, m_stream->size()));
     271    m_jit.appendOSRExit(OSRExit(kind, jsValueSource, m_jit.graph().methodOfGettingAValueProfileFor(m_currentNode, node), this, m_stream->size()));
    272272}
    273273
     
    284284    } else
    285285        m_jit.appendExitInfo(jumpsToFail);
    286     m_jit.jitCode()->appendOSRExit(OSRExit(kind, jsValueSource, m_jit.graph().methodOfGettingAValueProfileFor(m_currentNode, node), this, m_stream->size()));
     286    m_jit.appendOSRExit(OSRExit(kind, jsValueSource, m_jit.graph().methodOfGettingAValueProfileFor(m_currentNode, node), this, m_stream->size()));
    287287}
    288288
     
    291291    if (!m_compileOkay)
    292292        return OSRExitJumpPlaceholder();
    293     unsigned index = m_jit.jitCode()->osrExit.size();
     293    unsigned index = m_jit.m_osrExit.size();
    294294    m_jit.appendExitInfo();
    295     m_jit.jitCode()->appendOSRExit(OSRExit(kind, jsValueSource, m_jit.graph().methodOfGettingAValueProfileFor(m_currentNode, node), this, m_stream->size()));
     295    m_jit.appendOSRExit(OSRExit(kind, jsValueSource, m_jit.graph().methodOfGettingAValueProfileFor(m_currentNode, node), this, m_stream->size()));
    296296    return OSRExitJumpPlaceholder(index);
    297297}
     
    316316    if (!m_compileOkay)
    317317        return;
    318     unsigned recoveryIndex = m_jit.jitCode()->appendSpeculationRecovery(recovery);
     318    unsigned recoveryIndex = m_jit.appendSpeculationRecovery(recovery);
    319319    m_jit.appendExitInfo(jumpToFail);
    320     m_jit.jitCode()->appendOSRExit(OSRExit(kind, jsValueSource, m_jit.graph().methodOfGettingAValueProfileFor(m_currentNode, node), this, m_stream->size(), recoveryIndex));
     320    m_jit.appendOSRExit(OSRExit(kind, jsValueSource, m_jit.graph().methodOfGettingAValueProfileFor(m_currentNode, node), this, m_stream->size(), recoveryIndex));
    321321}
    322322
     
    331331        return;
    332332    OSRExitCompilationInfo& info = m_jit.appendExitInfo(JITCompiler::JumpList());
    333     m_jit.jitCode()->appendOSRExit(OSRExit(
     333    m_jit.appendOSRExit(OSRExit(
    334334        UncountableInvalidation, JSValueSource(), MethodOfGettingAValueProfile(),
    335335        this, m_stream->size()));
     
    22022202    }
    22032203
    2204     m_jit.jitCode()->finalizeOSREntrypoints();
     2204    m_jit.jitCode()->finalizeOSREntrypoints(WTFMove(m_jit.m_osrEntry));
    22052205    m_jit.jitCode()->common.finalizeCatchEntrypoints(WTFMove(m_jit.graph().m_catchEntrypoints));
    22062206
     
    22102210        DumpContext dumpContext;
    22112211        dataLog("OSR Entries:\n");
    2212         for (OSREntryData& entryData : m_jit.jitCode()->osrEntry)
     2212        for (OSREntryData& entryData : m_jit.jitCode()->m_osrEntry)
    22132213            dataLog("    ", inContext(entryData, &dumpContext), "\n");
    22142214        if (!dumpContext.isEmpty())
  • trunk/Source/JavaScriptCore/ftl/FTLJITCode.cpp

    r261464 r276224  
    139139{
    140140    common.shrinkToFit();
    141     osrExit.shrinkToFit();
     141    m_osrExit.shrinkToFit();
    142142    osrExitDescriptors.shrinkToFit();
    143143    lazySlowPaths.shrinkToFit();
     
    148148    common.validateReferences(trackedReferences);
    149149   
    150     for (OSRExit& exit : osrExit)
     150    for (OSRExit& exit : m_osrExit)
    151151        exit.m_descriptor->validateReferences(trackedReferences);
    152152}
     
    154154RegisterSet JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite(CodeBlock*, CallSiteIndex callSiteIndex)
    155155{
    156     for (OSRExit& exit : osrExit) {
     156    for (OSRExit& exit : m_osrExit) {
    157157        if (exit.m_exceptionHandlerCallSiteIndex.bits() == callSiteIndex.bits()) {
    158158            RELEASE_ASSERT(exit.isExceptionHandler());
     
    166166Optional<CodeOrigin> JITCode::findPC(CodeBlock* codeBlock, void* pc)
    167167{
    168     for (OSRExit& exit : osrExit) {
     168    for (OSRExit& exit : m_osrExit) {
    169169        if (ExecutableMemoryHandle* handle = exit.m_code.executableMemory()) {
    170170            if (handle->start().untaggedPtr() <= pc && pc < handle->end().untaggedPtr())
  • trunk/Source/JavaScriptCore/ftl/FTLJITCode.h

    r271594 r276224  
    7171   
    7272    DFG::CommonData common;
    73     SegmentedVector<OSRExit, 8> osrExit;
     73    Vector<OSRExit> m_osrExit;
    7474    SegmentedVector<OSRExitDescriptor, 8> osrExitDescriptors;
    7575    Vector<std::unique_ptr<LazySlowPath>> lazySlowPaths;
  • trunk/Source/JavaScriptCore/ftl/FTLOSRExit.cpp

    r275588 r276224  
    8383    const StackmapGenerationParams& params, uint32_t dfgNodeIndex, unsigned offset)
    8484{
    85     unsigned index = state.jitCode->osrExit.size();
    86     OSRExit& exit = state.jitCode->osrExit.alloc(
    87         this, exitKind, nodeOrigin.forExit, nodeOrigin.semantic, nodeOrigin.wasHoisted, dfgNodeIndex);
    88     Ref<OSRExitHandle> handle = adoptRef(*new OSRExitHandle(index, exit));
    89     exit.m_valueReps = FixedVector<B3::ValueRep>(params.size() - offset);
     85    FixedVector<B3::ValueRep> valueReps(params.size() - offset);
    9086    for (unsigned i = offset, indexInValueReps = 0; i < params.size(); ++i, ++indexInValueReps)
    91         exit.m_valueReps[indexInValueReps] = params[i];
    92     return handle;
     87        valueReps[indexInValueReps] = params[i];
     88    unsigned index = state.jitCode->m_osrExit.size();
     89    state.jitCode->m_osrExit.append(OSRExit(this, exitKind, nodeOrigin.forExit, nodeOrigin.semantic, nodeOrigin.wasHoisted, dfgNodeIndex, WTFMove(valueReps)));
     90    return adoptRef(*new OSRExitHandle(index, state.jitCode.get()));
    9391}
    9492
    9593OSRExit::OSRExit(
    9694    OSRExitDescriptor* descriptor, ExitKind exitKind, CodeOrigin codeOrigin,
    97     CodeOrigin codeOriginForExitProfile, bool wasHoisted, uint32_t dfgNodeIndex)
     95    CodeOrigin codeOriginForExitProfile, bool wasHoisted, uint32_t dfgNodeIndex, FixedVector<B3::ValueRep>&& valueReps)
    9896    : OSRExitBase(exitKind, codeOrigin, codeOriginForExitProfile, wasHoisted, dfgNodeIndex)
    9997    , m_descriptor(descriptor)
     98    , m_valueReps(WTFMove(valueReps))
    10099{
    101100}
  • trunk/Source/JavaScriptCore/ftl/FTLOSRExit.h

    r275588 r276224  
    121121
    122122struct OSRExit : public DFG::OSRExitBase {
    123     OSRExit(OSRExitDescriptor*, ExitKind, CodeOrigin, CodeOrigin codeOriginForExitProfile, bool wasHoisted, uint32_t dfgNodeIndex);
     123    OSRExit(OSRExitDescriptor*, ExitKind, CodeOrigin, CodeOrigin codeOriginForExitProfile, bool wasHoisted, uint32_t dfgNodeIndex, FixedVector<B3::ValueRep>&&);
    124124
    125125    OSRExitDescriptor* m_descriptor;
  • trunk/Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp

    r275588 r276224  
    544544
    545545    JITCode* jitCode = codeBlock->jitCode()->ftl();
    546     OSRExit& exit = jitCode->osrExit[exitID];
     546    OSRExit& exit = jitCode->m_osrExit[exitID];
    547547   
    548548    if (shouldDumpDisassembly() || Options::verboseOSR() || Options::verboseFTLOSRExit()) {
  • trunk/Source/JavaScriptCore/ftl/FTLOSRExitHandle.cpp

    r230748 r276224  
    4242    CCallHelpers::Label myLabel = jit.label();
    4343    label = myLabel;
    44     jit.pushToSaveImmediateWithoutTouchingRegisters(CCallHelpers::TrustedImm32(index));
     44    jit.pushToSaveImmediateWithoutTouchingRegisters(CCallHelpers::TrustedImm32(m_index));
    4545    CCallHelpers::PatchableJump jump = jit.patchableJump();
    4646    RefPtr<OSRExitHandle> self = this;
     
    4848    jit.addLinkTask(
    4949        [self, jump, myLabel, compilation, &vm] (LinkBuffer& linkBuffer) {
    50             self->exit.m_patchableJump = CodeLocationJump<JSInternalPtrTag>(linkBuffer.locationOf<JSInternalPtrTag>(jump));
     50            self->m_jitCode->m_osrExit[self->m_index].m_patchableJump = CodeLocationJump<JSInternalPtrTag>(linkBuffer.locationOf<JSInternalPtrTag>(jump));
    5151
    5252            linkBuffer.link(
  • trunk/Source/JavaScriptCore/ftl/FTLOSRExitHandle.h

    r206525 r276224  
    4141// scrape this data from this object by the time compilation finishes.
    4242struct OSRExitHandle : public ThreadSafeRefCounted<OSRExitHandle> {
    43     OSRExitHandle(unsigned index, OSRExit& exit)
    44         : index(index)
    45         , exit(exit)
     43    OSRExitHandle(unsigned index, JITCode* jitCode)
     44        : m_index(index)
     45        , m_jitCode(jitCode)
    4646    {
    4747    }
    4848
    49     unsigned index;
    50     OSRExit& exit;
     49    unsigned m_index;
     50    JITCode* m_jitCode;
    5151
    5252    // This is the label at which the OSR exit jump lives. This will get populated once the OSR exit
  • trunk/Source/JavaScriptCore/ftl/FTLPatchpointExceptionHandle.cpp

    r260803 r276224  
    8181    RefPtr<OSRExitHandle> handle = createHandle(GenericUnwind, params);
    8282
    83     handle->exit.m_exceptionHandlerCallSiteIndex = callSiteIndex;
     83    handle->m_jitCode->m_osrExit[handle->m_index].m_exceptionHandlerCallSiteIndex = callSiteIndex;
    8484
    8585    HandlerInfo handler = m_handler;
Note: See TracChangeset for help on using the changeset viewer.