Changeset 195182 in webkit


Ignore:
Timestamp:
Jan 17, 2016 1:15:45 AM (8 years ago)
Author:
Julien Brianceau
Message:

[mips] Fix regT2 and regT3 trampling in MacroAssembler
https://bugs.webkit.org/show_bug.cgi?id=153131

Mips $t2 and $t3 registers were used as temporary registers
in MacroAssemblerMIPS.h, whereas they are mapped to regT2
and regT3 in LLInt and GPRInfo.

This patch rearranges register mapping for the mips architecture:

  • use $t0 and $t1 as temp registers in LLInt (as in MacroAssembler)
  • use $t7 and $t8 as temp registers in MacroAssembler (as in LLInt)
  • remove $t6 from temp registers list in LLInt
  • update GPRInfo.h accordingly
  • add mips macroScratchRegisters() list in RegisterSet.cpp

Reviewed by Michael Saboff.

  • assembler/MacroAssemblerMIPS.h:
  • jit/GPRInfo.h:

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

  • jit/RegisterSet.cpp:

(JSC::RegisterSet::macroScratchRegisters):
(JSC::RegisterSet::calleeSaveRegisters):

  • offlineasm/mips.rb:
Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r195178 r195182  
     12016-01-17  Julien Brianceau  <jbriance@cisco.com>
     2
     3        [mips] Fix regT2 and regT3 trampling in MacroAssembler
     4        https://bugs.webkit.org/show_bug.cgi?id=153131
     5
     6        Mips $t2 and $t3 registers were used as temporary registers
     7        in MacroAssemblerMIPS.h, whereas they are mapped to regT2
     8        and regT3 in LLInt and GPRInfo.
     9
     10        This patch rearranges register mapping for the mips architecture:
     11        - use $t0 and $t1 as temp registers in LLInt (as in MacroAssembler)
     12        - use $t7 and $t8 as temp registers in MacroAssembler (as in LLInt)
     13        - remove $t6 from temp registers list in LLInt
     14        - update GPRInfo.h accordingly
     15        - add mips macroScratchRegisters() list in RegisterSet.cpp
     16
     17        Reviewed by Michael Saboff.
     18
     19        * assembler/MacroAssemblerMIPS.h:
     20        * jit/GPRInfo.h:
     21        (JSC::GPRInfo::toRegister):
     22        (JSC::GPRInfo::toIndex):
     23        * jit/RegisterSet.cpp:
     24        (JSC::RegisterSet::macroScratchRegisters):
     25        (JSC::RegisterSet::calleeSaveRegisters):
     26        * offlineasm/mips.rb:
     27
    1282016-01-16  Skachkov Oleksandr  <gskachkov@gmail.com>
    229
  • trunk/Source/JavaScriptCore/assembler/MacroAssemblerMIPS.h

    r195134 r195182  
    5656    static const RegisterID dataTempRegister = MIPSRegisters::t1;
    5757    // For storing address base
    58     static const RegisterID addrTempRegister = MIPSRegisters::t2;
     58    static const RegisterID addrTempRegister = MIPSRegisters::t7;
    5959    // For storing compare result
    60     static const RegisterID cmpTempRegister = MIPSRegisters::t3;
     60    static const RegisterID cmpTempRegister = MIPSRegisters::t8;
    6161
    6262    // FP temp register
  • trunk/Source/JavaScriptCore/jit/GPRInfo.h

    r194894 r195182  
    737737public:
    738738    typedef GPRReg RegisterType;
    739     static const unsigned numberOfRegisters = 8;
     739    static const unsigned numberOfRegisters = 7;
    740740    static const unsigned numberOfArgumentRegisters = NUMBER_OF_ARGUMENT_REGISTERS;
    741741
     
    750750    static const GPRReg regT4 = MIPSRegisters::t4;
    751751    static const GPRReg regT5 = MIPSRegisters::t5;
    752     static const GPRReg regT6 = MIPSRegisters::t0;
    753     static const GPRReg regT7 = MIPSRegisters::t1;
     752    static const GPRReg regT6 = MIPSRegisters::t6;
    754753    // These registers match the baseline JIT.
    755754    static const GPRReg callFrameRegister = MIPSRegisters::fp;
     
    767766    {
    768767        ASSERT(index < numberOfRegisters);
    769         static const GPRReg registerForIndex[numberOfRegisters] = { regT0, regT1, regT2, regT3, regT4, regT5, regT6, regT7 };
     768        static const GPRReg registerForIndex[numberOfRegisters] = { regT0, regT1, regT2, regT3, regT4, regT5, regT6 };
    770769        return registerForIndex[index];
    771770    }
     
    781780    {
    782781        ASSERT(reg != InvalidGPRReg);
    783         ASSERT(reg < 24);
    784         static const unsigned indexForRegister[24] = {
     782        ASSERT(reg < 32);
     783        static const unsigned indexForRegister[32] = {
    785784            InvalidIndex, InvalidIndex, 0, 1, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex,
    786             6, 7, 2, 3, 4, 5, InvalidIndex, InvalidIndex,
     785            InvalidIndex, InvalidIndex, 2, 3, 4, 5, 6, InvalidIndex,
     786            InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex,
    787787            InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex, InvalidIndex
    788788        };
  • trunk/Source/JavaScriptCore/jit/RegisterSet.cpp

    r194530 r195182  
    8787#elif CPU(ARM64)
    8888    return RegisterSet(MacroAssembler::dataTempRegister, MacroAssembler::memoryTempRegister);
     89#elif CPU(MIPS)
     90    RegisterSet result;
     91    result.set(MacroAssembler::immTempRegister);
     92    result.set(MacroAssembler::dataTempRegister);
     93    result.set(MacroAssembler::addrTempRegister);
     94    result.set(MacroAssembler::cmpTempRegister);
     95    return result;
    8996#else
    9097    return RegisterSet();
     
    142149        reg = static_cast<ARM64Registers::FPRegisterID>(reg + 1))
    143150        result.set(reg);
     151#elif CPU(MIPS)
    144152#else
    145153    UNREACHABLE_FOR_PLATFORM();
  • trunk/Source/JavaScriptCore/offlineasm/mips.rb

    r194725 r195182  
    3333# $v0 => t0, r0
    3434# $v1 => t1, r1
     35# $t0 =>            (scratch)
     36# $t1 =>            (scratch)
    3537# $t2 =>         t2
    3638# $t3 =>         t3
    3739# $t4 =>         t4
    3840# $t5 =>         t5
    39 # $t6 =>            (scratch)
     41# $t6 =>         t6
    4042# $t7 =>            (scratch)
    4143# $t8 =>            (scratch)
     
    9395end
    9496
    95 MIPS_TEMP_GPRS = [SpecialRegister.new("$t6"), SpecialRegister.new("$t7"), SpecialRegister.new("$t8")]
     97MIPS_TEMP_GPRS = [SpecialRegister.new("$t0"), SpecialRegister.new("$t1"), SpecialRegister.new("$t7"), SpecialRegister.new("$t8")]
    9698MIPS_ZERO_REG = SpecialRegister.new("$zero")
    9799MIPS_GP_REG = SpecialRegister.new("$gp")
Note: See TracChangeset for help on using the changeset viewer.