Ignore:
Timestamp:
Oct 27, 2021, 8:34:42 AM (4 years ago)
Author:
[email protected]
Message:

[JSC][32bit] Fix CSR restore on DFG tail calls, add extra register on ARMv7
https://bugs.webkit.org/show_bug.cgi?id=230622

Patch by Geza Lore <Geza Lore> on 2021-10-27
Reviewed by Keith Miller.

This re-introduces the patch reverted by
https://trac.webkit.org/changeset/284911/webkit
with the C_LOOP interpreter now fixed.

The only difference between the original patch and this version is in
LowLevelInterpreter32_64.asm and LowLevelInterpreter64.asm, which
need the PC base (PB) register restored on C_LOOP on return from a
call, as C_LOOP does not seem to handle this as a proper callee save
register (CSR). On non C_LOOP builds, the CSR restore mechanism takes
care of this, so removed the superfluous instructions.

--- Original ChangeLog ---

This patch does two things:

  1. Adds an extra callee save register (CSR) to be available to DFG on

ARMv7. To do this properly required the following:

  1. Implements the necessary shuffling in CallFrameShuffler on 32-bit

architectures that is required to restore CSRs properly after a tail
call on these architectures. This also fixes the remaining failures in
the 32-bit build of the unlinked baseline JIT.

  • bytecode/ValueRecovery.cpp:

(JSC::ValueRecovery::dumpInContext const):

  • bytecode/ValueRecovery.h:

(JSC::ValueRecovery::calleeSaveRegDisplacedInJSStack):
(JSC::ValueRecovery::isInJSStack const):
(JSC::ValueRecovery::dataFormat const):
(JSC::ValueRecovery::withLocalsOffset const):

  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::emitCall):

  • jit/CachedRecovery.cpp:

(JSC::CachedRecovery::loadsIntoGPR const):

  • jit/CallFrameShuffleData.cpp:

(JSC::CallFrameShuffleData::setupCalleeSaveRegisters):

  • jit/CallFrameShuffleData.h:
  • jit/CallFrameShuffler.cpp:

(JSC::CallFrameShuffler::CallFrameShuffler):

  • jit/CallFrameShuffler.h:

(JSC::CallFrameShuffler::snapshot const):
(JSC::CallFrameShuffler::addNew):

  • jit/CallFrameShuffler32_64.cpp:

(JSC::CallFrameShuffler::emitLoad):
(JSC::CallFrameShuffler::emitDisplace):

  • jit/GPRInfo.h:

(JSC::GPRInfo::toRegister):
(JSC::GPRInfo::toIndex):

  • jit/RegisterSet.cpp:

(JSC::RegisterSet::dfgCalleeSaveRegisters):

  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/CallFrameShuffler.cpp

    r284911 r284923  
    5353        m_lockedRegisters.clear(FPRInfo::toRegister(i));
    5454
    55 #if USE(JSVALUE64)
    56     // ... as well as the runtime registers on 64-bit architectures.
    57     // However do not use these registers on 32-bit architectures since
    58     // saving and restoring callee-saved registers in CallFrameShuffler isn't supported
    59     // on 32-bit architectures yet.
     55    // ... as well as the callee saved registers
    6056    m_lockedRegisters.exclude(RegisterSet::vmCalleeSaveRegisters());
    61 #endif
    6257
    6358    ASSERT(!data.callee.isInJSStack() || data.callee.virtualRegister().isLocal());
     
    6964    }
    7065
    71 #if USE(JSVALUE64)
    7266    for (Reg reg = Reg::first(); reg <= Reg::last(); reg = reg.next()) {
    7367        if (!data.registers[reg].isSet())
    7468            continue;
    7569
    76         if (reg.isGPR())
     70        if (reg.isGPR()) {
     71#if USE(JSVALUE64)
    7772            addNew(JSValueRegs(reg.gpr()), data.registers[reg]);
    78         else
     73#elif USE(JSVALUE32_64)
     74            addNew(reg.gpr(), data.registers[reg]);
     75#endif
     76        } else
    7977            addNew(reg.fpr(), data.registers[reg]);
    8078    }
    8179
     80#if USE(JSVALUE64)
    8281    m_numberTagRegister = data.numberTagRegister;
    8382    if (m_numberTagRegister != InvalidGPRReg)
Note: See TracChangeset for help on using the changeset viewer.