Changeset 167127 in webkit


Ignore:
Timestamp:
Apr 11, 2014 8:55:29 AM (10 years ago)
Author:
Julien Brianceau
Message:

Fix LLInt for sh4 architecture (broken since C stack merge).
https://bugs.webkit.org/show_bug.cgi?id=131532

Reviewed by Mark Lam.

This patch fixes build and also implements sh4 parts for initPCRelative and
setEntryAddress macros introduced in http://trac.webkit.org/changeset/167094.

  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter32_64.asm:
  • offlineasm/instructions.rb:
  • offlineasm/sh4.rb:
Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r167112 r167127  
     12014-04-11  Julien Brianceau  <jbriance@cisco.com>
     2
     3        Fix LLInt for sh4 architecture (broken since C stack merge).
     4        https://bugs.webkit.org/show_bug.cgi?id=131532
     5
     6        Reviewed by Mark Lam.
     7
     8        This patch fixes build and also implements sh4 parts for initPCRelative and
     9        setEntryAddress macros introduced in http://trac.webkit.org/changeset/167094.
     10
     11        * llint/LowLevelInterpreter.asm:
     12        * llint/LowLevelInterpreter32_64.asm:
     13        * offlineasm/instructions.rb:
     14        * offlineasm/sh4.rb:
     15
    1162014-04-10  Michael Saboff  <msaboff@apple.com>
    217
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r167094 r167127  
    229229
    230230macro checkStackPointerAlignment(tempReg, location)
    231     if ARM64 or C_LOOP
     231    if ARM64 or C_LOOP or SH4
    232232        # ARM64 will check for us!
    233233        # C_LOOP does not need the alignment, and can use a little perf
    234234        # improvement from avoiding useless work.
     235        # SH4 does not need specific alignment (4 bytes).
    235236    else
    236237        if ARM or ARMv7 or ARMv7_TRADITIONAL
     
    301302    elsif ARM64
    302303        pushLRAndFP
    303     elsif C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS
     304    elsif C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS or SH4
    304305        push lr
    305306        push cfr
     
    313314    elsif ARM64
    314315        popLRAndFP
    315     elsif C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS
     316    elsif C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS or SH4
    316317        pop cfr
    317318        pop lr
     
    327328    elsif ARM64
    328329        pushLRAndFP
    329     elsif C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS
     330    elsif C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS or SH4
    330331        push lr
    331332        push cfr
     
    382383    elsif ARM64
    383384        popLRAndFP
    384     elsif C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS
     385    elsif C_LOOP or ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS or SH4
    385386        pop cfr
    386387        pop lr
     
    717718        crash()  # Need to replace with any initialization steps needed to step up PC relative address calculation
    718719    elsif SH4
    719         crash()  # Need to replace with any initialization steps needed to step up PC relative address calculation
     720        mova _relativePCBase, t0
     721        move t0, pcBase
     722        alignformova
     723    _relativePCBase:
    720724    end
    721725end
     
    742746        crash()  # Need to replace with code to turn label into and absolute address and save at index
    743747    elsif SH4
    744         crash()  # Need to replace with code to turn label into and absolute address and save at index
     748        move label, t2
     749        subp _relativePCBase, t2
     750        addp t1, t2
     751        move index, t3
     752        storep t2, [a0, t3, 4]
     753        flushcp # Force constant pool flush to avoid "pcrel too far" link error.
    745754    end
    746755end
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm

    r167031 r167127  
    193193    elsif SH4
    194194        const entry = a0
    195         const vmTopCallFrame = a1
     195        const vm = a1
    196196        const protoCallFrame = a2
    197         const topOfStack = a3
    198197
    199198        const previousCFR = t3
    200199        const previousPC = lr
    201200        const temp1 = t3 # Same as previousCFR
    202         const temp2 = a3 # Same as topOfStack
     201        const temp2 = a3
    203202        const temp3 = t8
    204203        const temp4 = t9
  • trunk/Source/JavaScriptCore/offlineasm/instructions.rb

    r167094 r167127  
    293293SH4_INSTRUCTIONS =
    294294    [
     295    "flushcp",
     296    "alignformova",
     297    "mova",
    295298    "shllx",
    296299    "shlrx",
  • trunk/Source/JavaScriptCore/offlineasm/sh4.rb

    r160315 r167127  
    151151end
    152152
     153class LabelReference
     154    def sh4Operand
     155        value
     156    end
     157end
     158
    153159class ConstPool < Node
    154160    attr_reader :size
     
    457463            operands.each {
    458464                | operand |
    459                 if operand.is_a? LabelReference
     465                if operand.is_a? LabelReference and node.opcode != "mova"
    460466                    tmp = Tmp.new(operand.codeOrigin, :gpr)
    461467                    newList << Instruction.new(operand.codeOrigin, "move", [operand, tmp])
     
    550556        if node.is_a? Instruction
    551557            case node.opcode
    552             when "jmp", "ret"
    553                 newList << node
     558            when "jmp", "ret", "flushcp"
     559                if node.opcode == "flushcp"
     560                    outlabel = LocalLabel.unique("flushcp")
     561                    newList << Instruction.new(codeOrigin, "jmp", [LocalLabelReference.new(codeOrigin, outlabel)])
     562                else
     563                    newList << node
     564                end
    554565                if not currentPool16.empty?
    555566                    newList << ConstPool.new(codeOrigin, currentPool16, 16)
     
    559570                    newList << ConstPool.new(codeOrigin, currentPool32, 32)
    560571                    currentPool32 = []
     572                end
     573                if node.opcode == "flushcp"
     574                    newList << outlabel
    561575                end
    562576            when "move"
     
    844858        when "subi", "subp"
    845859            if operands.size == 3
    846                 if operands[1].sh4Operand == operands[2].sh4Operand
     860                if operands[1].is_a? Immediate
     861                    $asm.puts "mov #{sh4Operands([Immediate.new(codeOrigin, -1 * operands[1].value), operands[2]])}"
     862                    $asm.puts "add #{sh4Operands([operands[0], operands[2]])}"
     863                elsif operands[1].sh4Operand == operands[2].sh4Operand
    847864                    $asm.puts "neg #{sh4Operands([operands[2], operands[2]])}"
    848865                    $asm.puts "add #{sh4Operands([operands[0], operands[2]])}"
     
    878895                $asm.puts "shl#{opcode[3, 1]}#{operands[0].value} #{operands[1].sh4Operand}"
    879896            end
     897        when "shalx", "sharx"
     898            raise "Unhandled parameters for opcode #{opcode}" unless operands[0].is_a? Immediate and operands[0].value == 1
     899            $asm.puts "sha#{opcode[3, 1]} #{operands[1].sh4Operand}"
    880900        when "shld", "shad"
    881901            $asm.puts "#{opcode} #{sh4Operands(operands)}"
     
    10091029        when "loadi", "loadis", "loadp", "storei", "storep"
    10101030            $asm.puts "mov.l #{sh4Operands(operands)}"
     1031        when "alignformova"
     1032            $asm.puts ".balign 4"
     1033        when "mova"
     1034            $asm.puts "mova #{sh4Operands(operands)}"
    10111035        when "move"
    10121036            if operands[0].is_a? ConstPoolEntry
     
    10461070        when "memfence"
    10471071            $asm.puts "synco"
     1072        when "pop"
     1073            if operands[0].sh4Operand == "pr"
     1074                $asm.puts "lds.l @r15+, #{sh4Operands(operands)}"
     1075            else
     1076                $asm.puts "mov.l @r15+, #{sh4Operands(operands)}"
     1077            end
     1078        when "push"
     1079            if operands[0].sh4Operand == "pr"
     1080                $asm.puts "sts.l #{sh4Operands(operands)}, @-r15"
     1081            else
     1082                $asm.puts "mov.l #{sh4Operands(operands)}, @-r15"
     1083            end
    10481084        when "popCalleeSaves"
    10491085            $asm.puts "mov.l @r15+, r8"
     
    10521088            $asm.puts "mov.l @r15+, r11"
    10531089            $asm.puts "mov.l @r15+, r13"
    1054             $asm.puts "lds.l @r15+, pr"
    1055             $asm.puts "mov.l @r15+, r14"
    10561090        when "pushCalleeSaves"
    1057             $asm.puts "mov.l r14, @-r15"
    1058             $asm.puts "sts.l pr, @-r15"
    10591091            $asm.puts "mov.l r13, @-r15"
    10601092            $asm.puts "mov.l r11, @-r15"
Note: See TracChangeset for help on using the changeset viewer.