Changeset 251903 in webkit


Ignore:
Timestamp:
Oct 31, 2019 8:22:18 PM (4 years ago)
Author:
ysuzuki@apple.com
Message:

[JSC] Remove metadata(CallFrame*) accessor
https://bugs.webkit.org/show_bug.cgi?id=203712

Reviewed by Tadeu Zagallo.

We should pass CodeBlock* explicitly to remove unnecessary use of CallFrame*, which is very error-prone.

  • dfg/DFGOSREntry.cpp:

(JSC::DFG::prepareCatchOSREntry):

  • dfg/DFGOSREntry.h:
  • generator/Metadata.rb:
  • jit/JITOperations.cpp:
Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r251894 r251903  
     12019-10-31  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        [JSC] Remove metadata(CallFrame*) accessor
     4        https://bugs.webkit.org/show_bug.cgi?id=203712
     5
     6        Reviewed by Tadeu Zagallo.
     7
     8        We should pass CodeBlock* explicitly to remove unnecessary use of CallFrame*, which is very error-prone.
     9
     10        * dfg/DFGOSREntry.cpp:
     11        (JSC::DFG::prepareCatchOSREntry):
     12        * dfg/DFGOSREntry.h:
     13        * generator/Metadata.rb:
     14        * jit/JITOperations.cpp:
     15
    1162019-10-31  Tadeu Zagallo  <tzagallo@apple.com>
    217
  • trunk/Source/JavaScriptCore/dfg/DFGOSREntry.cpp

    r251468 r251903  
    330330}
    331331
    332 MacroAssemblerCodePtr<ExceptionHandlerPtrTag> prepareCatchOSREntry(VM& vm, CallFrame* callFrame, CodeBlock* codeBlock, BytecodeIndex bytecodeIndex)
     332MacroAssemblerCodePtr<ExceptionHandlerPtrTag> prepareCatchOSREntry(VM& vm, CallFrame* callFrame, CodeBlock* baselineCodeBlock, CodeBlock* optimizedCodeBlock, BytecodeIndex bytecodeIndex)
    333333{
    334     ASSERT(codeBlock->jitType() == JITType::DFGJIT || codeBlock->jitType() == JITType::FTLJIT);
    335     ASSERT(codeBlock->jitCode()->dfgCommon()->isStillValid);
    336 
    337     if (!Options::useOSREntryToDFG() && codeBlock->jitCode()->jitType() == JITType::DFGJIT)
    338         return nullptr;
    339     if (!Options::useOSREntryToFTL() && codeBlock->jitCode()->jitType() == JITType::FTLJIT)
    340         return nullptr;
    341 
    342     CommonData* dfgCommon = codeBlock->jitCode()->dfgCommon();
     334    ASSERT(optimizedCodeBlock->jitType() == JITType::DFGJIT || optimizedCodeBlock->jitType() == JITType::FTLJIT);
     335    ASSERT(optimizedCodeBlock->jitCode()->dfgCommon()->isStillValid);
     336
     337    if (!Options::useOSREntryToDFG() && optimizedCodeBlock->jitCode()->jitType() == JITType::DFGJIT)
     338        return nullptr;
     339    if (!Options::useOSREntryToFTL() && optimizedCodeBlock->jitCode()->jitType() == JITType::FTLJIT)
     340        return nullptr;
     341
     342    CommonData* dfgCommon = optimizedCodeBlock->jitCode()->dfgCommon();
    343343    RELEASE_ASSERT(dfgCommon);
    344344    DFG::CatchEntrypointData* catchEntrypoint = dfgCommon->catchOSREntryDataForBytecodeIndex(bytecodeIndex);
     
    381381        return nullptr;
    382382
    383     auto instruction = callFrame->codeBlock()->instructions().at(callFrame->bytecodeIndex());
     383    auto instruction = baselineCodeBlock->instructions().at(callFrame->bytecodeIndex());
    384384    ASSERT(instruction->is<OpCatch>());
    385     ValueProfileAndOperandBuffer* buffer = instruction->as<OpCatch>().metadata(callFrame).m_buffer;
     385    ValueProfileAndOperandBuffer* buffer = instruction->as<OpCatch>().metadata(baselineCodeBlock).m_buffer;
    386386    JSValue* dataBuffer = reinterpret_cast<JSValue*>(dfgCommon->catchOSREntryBuffer->dataBuffer());
    387387    unsigned index = 0;
  • trunk/Source/JavaScriptCore/dfg/DFGOSREntry.h

    r251468 r251903  
    8585
    8686// If null is returned, we can't OSR enter. If it's not null, it's the PC to jump to.
    87 MacroAssemblerCodePtr<ExceptionHandlerPtrTag> prepareCatchOSREntry(VM&, CallFrame*, CodeBlock*, BytecodeIndex);
     87MacroAssemblerCodePtr<ExceptionHandlerPtrTag> prepareCatchOSREntry(VM&, CallFrame*, CodeBlock* baselineCodeBlock, CodeBlock* optimizedCodeBlock, BytecodeIndex);
    8888#else
    8989inline MacroAssemblerCodePtr<ExceptionHandlerPtrTag> prepareOSREntry(VM&, CallFrame*, CodeBlock*, BytecodeIndex) { return nullptr; }
  • trunk/Source/JavaScriptCore/generator/Metadata.rb

    r251425 r251903  
    8484        return codeBlock->metadata<Metadata>(opcodeID, #{Metadata.field_name});
    8585    }
    86 
    87     Metadata& metadata(CallFrame* callFrame) const
    88     {
    89         return metadata(callFrame->codeBlock());
    90     }
    9186EOF
    9287    end
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r251518 r251903  
    17331733    BytecodeIndex bytecodeIndex = BytecodeIndex::fromBits(bytecodeIndexBits);
    17341734
    1735     CodeBlock* optimizedReplacement = callFrame->codeBlock()->replacement();
    1736     if (UNLIKELY(!optimizedReplacement))
    1737         return nullptr;
    1738 
    1739     switch (optimizedReplacement->jitType()) {
    1740     case JITType::DFGJIT:
    1741     case JITType::FTLJIT: {
    1742         MacroAssemblerCodePtr<ExceptionHandlerPtrTag> entry = DFG::prepareCatchOSREntry(vm, callFrame, optimizedReplacement, bytecodeIndex);
    1743         return entry.executableAddress<char*>();
    1744     }
    1745     default:
    1746         break;
    1747     }
    1748     return nullptr;
    1749 }
    1750 
    1751 char* JIT_OPERATION operationTryOSREnterAtCatchAndValueProfile(VM* vmPointer, uint32_t bytecodeIndexBits)
    1752 {
    1753     VM& vm = *vmPointer;
    1754     CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
    1755     JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
    1756     BytecodeIndex bytecodeIndex = BytecodeIndex::fromBits(bytecodeIndexBits);
    1757 
    17581735    CodeBlock* codeBlock = callFrame->codeBlock();
    17591736    CodeBlock* optimizedReplacement = codeBlock->replacement();
     
    17641741    case JITType::DFGJIT:
    17651742    case JITType::FTLJIT: {
    1766         MacroAssemblerCodePtr<ExceptionHandlerPtrTag> entry = DFG::prepareCatchOSREntry(vm, callFrame, optimizedReplacement, bytecodeIndex);
     1743        MacroAssemblerCodePtr<ExceptionHandlerPtrTag> entry = DFG::prepareCatchOSREntry(vm, callFrame, codeBlock, optimizedReplacement, bytecodeIndex);
     1744        return entry.executableAddress<char*>();
     1745    }
     1746    default:
     1747        break;
     1748    }
     1749    return nullptr;
     1750}
     1751
     1752char* JIT_OPERATION operationTryOSREnterAtCatchAndValueProfile(VM* vmPointer, uint32_t bytecodeIndexBits)
     1753{
     1754    VM& vm = *vmPointer;
     1755    CallFrame* callFrame = DECLARE_CALL_FRAME(vm);
     1756    JITOperationPrologueCallFrameTracer tracer(vm, callFrame);
     1757    BytecodeIndex bytecodeIndex = BytecodeIndex::fromBits(bytecodeIndexBits);
     1758
     1759    CodeBlock* codeBlock = callFrame->codeBlock();
     1760    CodeBlock* optimizedReplacement = codeBlock->replacement();
     1761    if (UNLIKELY(!optimizedReplacement))
     1762        return nullptr;
     1763
     1764    switch (optimizedReplacement->jitType()) {
     1765    case JITType::DFGJIT:
     1766    case JITType::FTLJIT: {
     1767        MacroAssemblerCodePtr<ExceptionHandlerPtrTag> entry = DFG::prepareCatchOSREntry(vm, callFrame, codeBlock, optimizedReplacement, bytecodeIndex);
    17671768        return entry.executableAddress<char*>();
    17681769    }
Note: See TracChangeset for help on using the changeset viewer.