Changeset 154025 in webkit


Ignore:
Timestamp:
Aug 13, 2013 3:15:13 PM (11 years ago)
Author:
oliver@apple.com
Message:

[sh4] Prepare LLINT for DFG_JIT implementation.
https://bugs.webkit.org/show_bug.cgi?id=119755

Patch by Julien Brianceau <jbrianceau@nds.com> on 2013-08-13
Reviewed by Oliver Hunt.

  • LLIntOffsetsExtractor.pro: Add sh4.rb dependency.
  • offlineasm/sh4.rb:
    • Handle storeb opcode.
    • Make relative jumps when possible using braf opcode.
    • Update bmulio implementation to be consistent with baseline JIT.
    • Remove useless code from leap opcode.
    • Fix incorrect comment.
Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r154016 r154025  
     12013-08-13  Julien Brianceau  <jbrianceau@nds.com>
     2
     3        [sh4] Prepare LLINT for DFG_JIT implementation.
     4        https://bugs.webkit.org/show_bug.cgi?id=119755
     5
     6        Reviewed by Oliver Hunt.
     7
     8        * LLIntOffsetsExtractor.pro: Add sh4.rb dependency.
     9        * offlineasm/sh4.rb:
     10            - Handle storeb opcode.
     11            - Make relative jumps when possible using braf opcode.
     12            - Update bmulio implementation to be consistent with baseline JIT.
     13            - Remove useless code from leap opcode.
     14            - Fix incorrect comment.
     15
    1162013-08-13  Julien Brianceau  <jbrianceau@nds.com>
    217
  • trunk/Source/JavaScriptCore/LLIntOffsetsExtractor.pro

    r145504 r154025  
    4646    $$PWD/offlineasm/self_hash.rb \
    4747    $$PWD/offlineasm/settings.rb \
     48    $$PWD/offlineasm/sh4.rb \
    4849    $$PWD/offlineasm/transform.rb \
    4950    $$PWD/offlineasm/x86.rb
  • trunk/Source/JavaScriptCore/offlineasm/sh4.rb

    r153317 r154025  
    213213# will become:
    214214#
    215 # addi foo, bar, tmp
    216 # bs tmp, baz
     215# addi foo, bar
     216# bs bar, baz
    217217#
    218218
     
    406406            if address.is_a? Address
    407407                case node.opcode
    408                 when "btbz", "btbnz", "cbeq", "bbeq", "bbneq", "bbb", "loadb"
     408                when "btbz", "btbnz", "cbeq", "bbeq", "bbneq", "bbb", "loadb", "storeb"
    409409                    (0..15).include? address.offset.value and
    410410                        ((node.operands[0].is_a? RegisterID and node.operands[0].sh4Operand == "r0") or
     
    442442end
    443443
    444 def emitSH4Load32(constant, dest)
    445     outlabel = LocalLabel.unique("load32out")
    446     constlabel = LocalLabel.unique("load32const")
    447     $asm.puts "mov.l #{LocalLabelReference.new(codeOrigin, constlabel).asmLabel}, #{dest.sh4Operand}"
    448     $asm.puts "bra #{LocalLabelReference.new(codeOrigin, outlabel).asmLabel}"
     444def emitSH4Load32AndJump(constant, scratch)
     445    $asm.puts "mov.l 2f, #{scratch.sh4Operand}"
     446    $asm.puts "braf #{scratch.sh4Operand}"
    449447    $asm.puts "nop"
    450     $asm.puts ".balign 4"
    451     constlabel.lower("SH4")
    452     $asm.puts ".long #{constant}"
    453     outlabel.lower("SH4")
    454 end
    455 
    456 def emitSH4Load32AndJump(constant, scratch)
    457     constlabel = LocalLabel.unique("load32const")
    458     $asm.puts "mov.l #{LocalLabelReference.new(codeOrigin, constlabel).asmLabel}, #{scratch.sh4Operand}"
    459     $asm.puts "jmp @#{scratch.sh4Operand}"
    460     $asm.puts "nop"
    461     $asm.puts ".balign 4"
    462     constlabel.lower("SH4")
    463     $asm.puts ".long #{constant}"
     448    $asm.puts "1: .balign 4"
     449    $asm.puts "2: .long #{constant}-1b"
    464450end
    465451
     
    481467        constlabel.lower("SH4")
    482468    else
    483         emitSH4Load32(operands[0].value, operands[1])
     469        outlabel = LocalLabel.unique("load32out")
     470        constlabel = LocalLabel.unique("load32const")
     471        $asm.puts "mov.l #{LocalLabelReference.new(codeOrigin, constlabel).asmLabel}, #{operands[1].sh4Operand}"
     472        $asm.puts "bra #{LocalLabelReference.new(codeOrigin, outlabel).asmLabel}"
     473        $asm.puts "nop"
     474        $asm.puts ".balign 4"
     475        constlabel.lower("SH4")
     476        $asm.puts ".long #{operands[0].value}"
     477        outlabel.lower("SH4")
    484478    end
    485479end
     
    657651            $asm.puts "dmuls.l #{sh4Operands([operands[2], operands[3]])}"
    658652            $asm.puts "sts macl, #{operands[3].sh4Operand}"
    659             $asm.puts "sts mach, #{operands[0].sh4Operand}"
    660653            $asm.puts "cmp/pz #{operands[3].sh4Operand}"
    661654            $asm.puts "movt #{operands[1].sh4Operand}"
    662             $asm.puts "dt #{operands[1].sh4Operand}"
     655            $asm.puts "add #-1, #{operands[1].sh4Operand}"
     656            $asm.puts "sts mach, #{operands[0].sh4Operand}"
    663657            $asm.puts "cmp/eq #{sh4Operands([operands[0], operands[1]])}"
    664658            $asm.puts "bf #{operands[4].asmLabel}"
     
    716710            $asm.puts "lds r0, pr"
    717711            $asm.puts "mov.l @(6, PC), #{operands[1].sh4Operand}"
    718             $asm.puts "jmp @#{operands[1].sh4Operand}"
     712            $asm.puts "braf #{operands[1].sh4Operand}"
    719713            $asm.puts "mov #{operands[0].sh4Operand}, r0"
    720             $asm.puts ".long #{operands[2].asmLabel}"
     714            $asm.puts ".long #{operands[2].asmLabel}-."
    721715        when "jmp"
    722716            if operands[0].is_a? LocalLabelReference
     
    736730            $asm.puts "mov.b #{sh4Operands(operands)}"
    737731            $asm.puts "extu.b #{sh4Operands([operands[1], operands[1]])}"
     732        when "storeb"
     733            $asm.puts "mov.b #{sh4Operands(operands)}"
    738734        when "loadh"
    739735            $asm.puts "mov.w #{sh4Operands(operands)}"
     
    742738            $asm.puts "mov.l #{sh4Operands(operands)}"
    743739        when "move"
    744             if operands[0].is_a? LabelReference
    745                 emitSH4Load32(operands[0].asmLabel, operands[1])
    746             elsif operands[0].is_a? Immediate
     740            if operands[0].is_a? Immediate
    747741                emitSH4LoadImm(operands)
    748742            else
     
    752746            if operands[0].is_a? BaseIndex
    753747                biop = operands[0]
    754                 if biop.scale > 0
    755                     $asm.puts "mov #{sh4Operands([biop.index, operands[1]])}"
    756                     if biop.scaleShift > 0
    757                         emitSH4ShiftImm(biop.scaleShift, operands[1], "l")
    758                     end
    759                     $asm.puts "add #{sh4Operands([biop.base, operands[1]])}"
    760                 else
    761                     $asm.puts "mov #{sh4Operands([biop.base, operands[1]])}"
    762                 end
     748                $asm.puts "mov #{sh4Operands([biop.index, operands[1]])}"
     749                if biop.scaleShift > 0
     750                    emitSH4ShiftImm(biop.scaleShift, operands[1], "l")
     751                end
     752                $asm.puts "add #{sh4Operands([biop.base, operands[1]])}"
    763753                if biop.offset.value != 0
    764754                    $asm.puts "add #{sh4Operands([biop.offset, operands[1]])}"
Note: See TracChangeset for help on using the changeset viewer.