Ignore:
Timestamp:
Mar 29, 2022, 4:21:12 PM (3 years ago)
Author:
[email protected]
Message:

[JSC][ARMv7] Cleanup GPR numbering
https://bugs.webkit.org/show_bug.cgi?id=235027

Patch by Geza Lore <Geza Lore> on 2022-03-29
Reviewed by Yusuke Suzuki.

  • Make the the lower order callee save register be regCS0/llint csr0.

Some of the CSR store/restore code relies on this and using a
numbering scheme consistent with other targets (that is: regCS<N> maps
to a lower number machine register than regCS<N+1>) eliminates some
ifdefs in LLInt, and hopefully will prevent hard to find issues due to
the mismatch from other targets that all follow this rule.

  • In the Thumb-2 instruction set, use of r0-r7 can often be encoded

using a shorter, 16-bit instruction. Swap regT4/regT5 with
regT7/regT6, so lower order temporaries (which are usually used first)
map to the lower order registers that can yield denser code. This
then simplifies BaselineJITRegisters.h, and also saves about ~1% DFG
code size.

  • In offlineasm, prefer low order registers for temporaries.
  • Also clean up baseline instanceof op implementation.
  • bytecode/StructureStubInfo.cpp:

(JSC::StructureStubInfo::initializeFromUnlinkedStructureStubInfo):

  • jit/BaselineJITRegisters.h:
  • jit/GPRInfo.h:

(JSC::GPRInfo::toIndex):
(JSC::PreferredArgumentImpl::preferredArgumentJSR):

  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_instanceof):
(JSC::JIT::emitSlow_op_instanceof):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::emit_op_put_by_val):
(JSC::JIT::emitSlow_op_put_by_val):
(JSC::JIT::slow_op_put_by_val_callSlowOperationThenCheckExceptionGenerator):
(JSC::JIT::emit_op_put_private_name):
(JSC::JIT::emitSlow_op_put_private_name):
(JSC::JIT::slow_op_put_private_name_callSlowOperationThenCheckExceptionGenerator):

  • llint/LowLevelInterpreter.asm:
  • offlineasm/arm.rb:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/offlineasm/arm.rb

    r279343 r292080  
    3232#  x0 => t0, a0, r0
    3333#  x1 => t1, a1, r1
    34 #  x2 => t2, a2, r2
    35 #  x3 => t3, a3, r3
    36 #  x6 =>            (callee-save scratch)
     34#  x2 => t2, a2
     35#  x3 => t3, a3
     36#  x4 => t4                 (callee-save, PC)
     37#  x5 => t5                 (callee-save)
     38#  x6 => scratch            (callee-save)
    3739#  x7 => cfr
    38 #  x8 => t4         (callee-save)
    39 #  x9 => t5         (callee-save)
    40 # x10 => csr1       (callee-save, PB)
    41 # x11 => cfr, csr0  (callee-save, metadataTable)
    42 # x12 =>            (callee-save scratch)
     40#  x8 => t6                 (callee-save)
     41#  x9 => t7, also scratch!  (callee-save)
     42# x10 => csr0               (callee-save, metadataTable)
     43# x11 => csr1               (callee-save, PB)
     44# x12 => scratch            (callee-save)
    4345#  lr => lr
    4446#  sp => sp
     
    7072end
    7173
    72 ARM_EXTRA_GPRS = [SpecialRegister.new("r6"), SpecialRegister.new("r4"), SpecialRegister.new("r12")]
     74# These are allocated from the end. Use the low order r6 first, ast it's often
     75# cheaper to encode. r12 and r9 are equivalent, but r9 conflicts with t7, so r9
     76# only as last resort.
     77ARM_EXTRA_GPRS = [SpecialRegister.new("r9"), SpecialRegister.new("r12"), SpecialRegister.new("r6")]
    7378ARM_EXTRA_FPRS = [SpecialRegister.new("d7")]
    7479ARM_SCRATCH_FPR = SpecialRegister.new("d6")
     
    100105        when "t2", "a2"
    101106            "r2"
    102         when "a3"
     107        when "t3", "a3"
    103108            "r3"
    104         when "t3"
    105             "r3"
    106         when "t4"
    107             "r8"
     109        when "t4" # LLInt PC
     110            "r4"
    108111        when "t5"
    109             "r9"
     112            "r5"
    110113        when "cfr"
    111114            "r7"
     115        when "t6"
     116            "r8"
     117        when "t7"
     118            "r9" # r9 is also a scratch register, so use carefully!
    112119        when "csr0"
     120            "r10"
     121        when "csr1"
    113122            "r11"
    114         when "csr1"
    115             "r10"
    116123        when "lr"
    117124            "lr"
Note: See TracChangeset for help on using the changeset viewer.