Ignore:
Timestamp:
Feb 7, 2020, 2:06:18 AM (6 years ago)
Author:
[email protected]
Message:

[JSC] CodeBlock::shrinkToFit should shrink m_constantRegisters and m_constantsSourceCodeRepresentation in 64bit architectures
https://bugs.webkit.org/show_bug.cgi?id=207356

Reviewed by Mark Lam.

Only 32bit architectures are using m_constantRegisters's address. 64bit architectures are not relying on m_constantRegisters's address.
This patches fixes the thing so that CodeBlock::shrinkToFit will shrink m_constantRegisters and m_constantsSourceCodeRepresentation
regardless of whether this is EarlyShrink or not. We also move DFG/FTL's LateShrink call to the place after calling DFGCommon reallyAdd
since they can add more constant registers.

Relanding it by fixing dead-lock.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::shrinkToFit):

  • bytecode/CodeBlock.h:
  • dfg/DFGJITCompiler.cpp:

(JSC::DFG::JITCompiler::compile):
(JSC::DFG::JITCompiler::compileFunction):

  • dfg/DFGJITFinalizer.cpp:

(JSC::DFG::JITFinalizer::finalizeCommon):

  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThreadImpl):
(JSC::DFG::Plan::finalizeWithoutNotifyingCallback):

  • jit/JIT.cpp:

(JSC::JIT::link):

  • jit/JIT.h:
  • jit/JITInlines.h:

(JSC::JIT::emitLoadDouble):
(JSC::JIT::emitLoadInt32ToDouble): Deleted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r255994 r256015  
    19541954}
    19551955
    1956 void CodeBlock::shrinkToFit(ShrinkMode shrinkMode)
    1957 {
    1958     ConcurrentJSLocker locker(m_lock);
    1959 
    1960     if (shrinkMode == EarlyShrink) {
     1956void CodeBlock::shrinkToFit(const ConcurrentJSLocker&, ShrinkMode shrinkMode)
     1957{
     1958#if USE(JSVALUE32_64)
     1959    // Only 32bit Baseline JIT is touching m_constantRegisters address directly.
     1960    if (shrinkMode == ShrinkMode::EarlyShrink)
    19611961        m_constantRegisters.shrinkToFit();
    1962         m_constantsSourceCodeRepresentation.shrinkToFit();
    1963        
     1962#else
     1963    m_constantRegisters.shrinkToFit();
     1964#endif
     1965    m_constantsSourceCodeRepresentation.shrinkToFit();
     1966
     1967    if (shrinkMode == ShrinkMode::EarlyShrink) {
    19641968        if (m_rareData) {
    19651969            m_rareData->m_switchJumpTables.shrinkToFit();
Note: See TracChangeset for help on using the changeset viewer.