Changeset 237803 in webkit


Ignore:
Timestamp:
Nov 5, 2018 8:07:40 AM (5 years ago)
Author:
dinfuehr@igalia.com
Message:

Enable LLInt on ARMv7/Linux
https://bugs.webkit.org/show_bug.cgi?id=191190

Reviewed by Yusuke Suzuki.

After enabling the new bytecode format in r237547, C_LOOP was
forced on all 32-bit platforms. Now enable LLInt again on
.:

ARMv7-Thumb2/Linux by default.

  • Source/cmake/WebKitFeatures.cmake:

Source/JavaScriptCore:

ARMv7-Thumb2/Linux.

This adds a callee-saved register in ARMv7/Linux for the metadataTable and
stores/restores it on LLInt function calls. It also introduces the globaladdr-
instruction for the ARM-offlineasm to access the opcode-table.

  • jit/GPRInfo.h:
  • jit/RegisterSet.cpp:

(JSC::RegisterSet::llintBaselineCalleeSaveRegisters):

  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter32_64.asm:
  • offlineasm/arm.rb:
  • offlineasm/asm.rb:
  • offlineasm/instructions.rb:

Source/WTF:

ARMv7-Thumb2/Linux by default.

  • wtf/Platform.h:
Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r237791 r237803  
     12018-11-05  Dominik Infuehr  <dinfuehr@igalia.com>
     2
     3        Enable LLInt on ARMv7/Linux
     4        https://bugs.webkit.org/show_bug.cgi?id=191190
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        After enabling the new bytecode format in r237547, C_LOOP was
     9        forced on all 32-bit platforms. Now enable LLInt again on
     10        ARMv7-Thumb2/Linux by default.
     11
     12        * Source/cmake/WebKitFeatures.cmake:
     13
    1142018-11-05  Michael Catanzaro  <mcatanzaro@igalia.com>
    215
  • trunk/Source/JavaScriptCore/ChangeLog

    r237793 r237803  
     12018-11-05  Dominik Infuehr  <dinfuehr@igalia.com>
     2
     3        Enable LLInt on ARMv7/Linux
     4        https://bugs.webkit.org/show_bug.cgi?id=191190
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        After enabling the new bytecode format in r237547, C_LOOP was
     9        forced on all 32-bit platforms. Now enable LLInt again on
     10        ARMv7-Thumb2/Linux.
     11
     12        This adds a callee-saved register in ARMv7/Linux for the metadataTable and
     13        stores/restores it on LLInt function calls. It also introduces the globaladdr-
     14        instruction for the ARM-offlineasm to access the opcode-table.
     15
     16        * jit/GPRInfo.h:
     17        * jit/RegisterSet.cpp:
     18        (JSC::RegisterSet::llintBaselineCalleeSaveRegisters):
     19        * llint/LowLevelInterpreter.asm:
     20        * llint/LowLevelInterpreter32_64.asm:
     21        * offlineasm/arm.rb:
     22        * offlineasm/asm.rb:
     23        * offlineasm/instructions.rb:
     24
    1252018-11-05  Fujii Hironori  <Hironori.Fujii@sony.com>
    226
  • trunk/Source/JavaScriptCore/jit/GPRInfo.h

    r236381 r237803  
    551551#endif
    552552    static const GPRReg regT8 = ARMRegisters::r4;
     553    static const GPRReg regCS0 = ARMRegisters::r11;
    553554    // These registers match the baseline JIT.
    554555    static const GPRReg callFrameRegister = ARMRegisters::fp;
  • trunk/Source/JavaScriptCore/jit/RegisterSet.cpp

    r237547 r237803  
    237237#endif
    238238#elif CPU(ARM_THUMB2)
     239    result.set(GPRInfo::regCS0);
    239240#elif CPU(ARM_TRADITIONAL)
    240241#elif CPU(ARM64)
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r237547 r237803  
    230230    const CalleeSaveSpaceAsVirtualRegisters = 4
    231231elsif C_LOOP
     232    const CalleeSaveSpaceAsVirtualRegisters = 1
     233elsif ARMv7
    232234    const CalleeSaveSpaceAsVirtualRegisters = 1
    233235else
     
    295297    if C_LOOP
    296298        const metadataTable = csr3
     299    elsif ARMv7
     300        const metadataTable = csr0
     301    else
     302        error
    297303    end
    298304end
     
    713719    elsif ARM or ARMv7_TRADITIONAL
    714720    elsif ARMv7
     721        storep metadataTable, -4[cfr]
    715722    elsif ARM64 or ARM64E
    716723        emit "stp x27, x28, [x29, #-16]"
     
    737744    elsif ARM or ARMv7_TRADITIONAL
    738745    elsif ARMv7
     746        loadp -4[cfr], metadataTable
    739747    elsif ARM64 or ARM64E
    740748        emit "ldp x25, x26, [x29, #-32]"
     
    11871195    end
    11881196
    1189     if JSVALUE64 or C_LOOP
    1190         # FIXME: cleanup double load
    1191         # https://bugs.webkit.org/show_bug.cgi?id=190933
    1192         loadp CodeBlock::m_metadata[t1], metadataTable
    1193         loadp MetadataTable::m_buffer[metadataTable], metadataTable
    1194     end
     1197    # FIXME: cleanup double load
     1198    # https://bugs.webkit.org/show_bug.cgi?id=190933
     1199    loadp CodeBlock::m_metadata[t1], metadataTable
     1200    loadp MetadataTable::m_buffer[metadataTable], metadataTable
     1201
    11951202    if JSVALUE64
    11961203        move TagTypeNumber, tagTypeNumber
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm

    r237627 r237803  
    344344end
    345345
    346 _handleUncaughtException:
     346op(handleUncaughtException, macro()
    347347    loadp Callee + PayloadOffset[cfr], t3
    348348    andp MarkedBlockMask, t3
     
    375375    functionEpilogue()
    376376    ret
     377end)
    377378
    378379macro doReturnFromHostFunction(extraStackSpace)
     
    19391940
    19401941
    1941 commonOp(op_catch, macro() end, macro (size)
     1942commonOp(llint_op_catch, macro() end, macro (size)
    19421943    # This is where we end up from the JIT's throw trampoline (because the
    19431944    # machine code return address will be set to _llint_op_catch), and from
     
    19531954    restoreStackPointerAfterCall()
    19541955
    1955     if C_LOOP
    1956         # restore metadataTable since we don't restore callee saves for CLoop during unwinding
    1957         loadp CodeBlock[cfr], t1
    1958         # FIXME: cleanup double load
    1959         # https://bugs.webkit.org/show_bug.cgi?id=190933
    1960         loadp CodeBlock::m_metadata[t1], metadataTable
    1961         loadp MetadataTable::m_buffer[metadataTable], metadataTable
    1962     end
     1956    # restore metadataTable since we don't restore callee saves for CLoop during unwinding
     1957    loadp CodeBlock[cfr], t1
     1958    # FIXME: cleanup double load
     1959    # https://bugs.webkit.org/show_bug.cgi?id=190933
     1960    loadp CodeBlock::m_metadata[t1], metadataTable
     1961    loadp MetadataTable::m_buffer[metadataTable], metadataTable
    19631962
    19641963    loadi VM::targetInterpreterPCForThrow[t3], PC
  • trunk/Source/JavaScriptCore/offlineasm/arm.rb

    r229356 r237803  
    3939#  x9 => t5         (callee-save)
    4040# x10 =>            (callee-save scratch)
    41 # x11 => cfr        (ARM and ARMv7 traditional)
     41# x11 => cfr, csr0  (callee-save, metadataTable)
    4242# x12 =>            (callee-save scratch)
    4343#  lr => lr
     
    134134        when "cfr"
    135135            isARMv7 ?  "r7" : "r11"
     136        when "csr0"
     137            "r11"
    136138        when "lr"
    137139            "lr"
     
    274276end
    275277
     278def armLowerLabelReferences(list)
     279    newList = []
     280    list.each {
     281        | node |
     282        if node.is_a? Instruction
     283            case node.opcode
     284            when "leai", "leap", "leaq"
     285                labelRef = node.operands[0]
     286                if labelRef.is_a? LabelReference
     287                    raise unless labelRef.offset == 0
     288                    tmp = Tmp.new(node.codeOrigin, :gpr)
     289                    newList << Instruction.new(codeOrigin, "globaladdr", [LabelReference.new(node.codeOrigin, labelRef.label), node.operands[1], tmp])
     290                else
     291                    newList << node
     292                end
     293            else
     294                newList << node
     295            end
     296        else
     297            newList << node
     298        end
     299    }
     300    newList
     301end
     302
    276303class Sequence
    277304    def getModifiedListARM
     
    295322        result = riscLowerHardBranchOps(result)
    296323        result = riscLowerShiftOps(result)
     324        result = armLowerLabelReferences(result)
    297325        result = riscLowerMalformedAddresses(result) {
    298326            | node, address |
     
    461489        when "loadb"
    462490            $asm.puts "ldrb #{armFlippedOperands(operands)}"
    463         when "loadbs"
     491        when "loadbs", "loadbsp"
    464492            $asm.puts "ldrsb.w #{armFlippedOperands(operands)}"
    465493        when "storeb"
     
    683711        when "clrbp"
    684712            $asm.puts "bic #{operands[2].armOperand}, #{operands[0].armOperand}, #{operands[1].armOperand}"
     713        when "globaladdr"
     714            labelRef = operands[0]
     715            dest = operands[1]
     716            temp = operands[2]
     717
     718            uid = $asm.newUID
     719            gotLabel = "L_offlineasm_arm_got_#{uid}"
     720            offsetLabel = "L_offlineasm_arm_got_offset_#{uid}"
     721
     722            $asm.puts "ldr #{dest.armOperand}, #{gotLabel}"
     723            $asm.puts "ldr #{temp.armOperand}, #{gotLabel}+4"
     724            $asm.puts "#{offsetLabel}:"
     725            $asm.puts "add #{dest.armOperand}, pc, #{dest.armOperand}"
     726            $asm.puts "ldr #{dest.armOperand}, [#{dest.armOperand}, #{temp.armOperand}]"
     727
     728            offset = $activeBackend == "ARMv7" ? 4 : 8
     729
     730            $asm.deferNextLabelAction {
     731                $asm.puts "#{gotLabel}:"
     732                $asm.puts ".word _GLOBAL_OFFSET_TABLE_-(#{offsetLabel}+#{offset})"
     733                $asm.puts ".word #{labelRef.asmLabel}(GOT)"
     734            }
    685735        else
    686736            lowerDefault
  • trunk/Source/JavaScriptCore/offlineasm/asm.rb

    r237547 r237803  
    5252        @numGlobalLabels = 0
    5353        @deferredActions = []
     54        @deferredNextLabelActions = []
    5455        @count = 0
    5556
     
    8081        end
    8182        putsLastComment
    82         @deferredActions.each {
     83        (@deferredNextLabelActions + @deferredActions).each {
    8384            | action |
    8485            action.call()
     
    9091    def deferAction(&proc)
    9192        @deferredActions << proc
     93    end
     94
     95    def deferNextLabelAction(&proc)
     96        @deferredNextLabelActions << proc
    9297    end
    9398   
     
    210215    def putsLabel(labelName, isGlobal)
    211216        raise unless @state == :asm
     217        @deferredNextLabelActions.each {
     218            | action |
     219            action.call()
     220        }
     221        @deferredNextLabelActions = []
    212222        @numGlobalLabels += 1
    213223        putsProcEndIfNeeded if $emitWinAsm and isGlobal
  • trunk/Source/JavaScriptCore/offlineasm/instructions.rb

    r237627 r237803  
    266266    [
    267267     "clrbp",
    268      "mvlbl"
     268     "mvlbl",
     269     "globaladdr"
    269270    ]
    270271
  • trunk/Source/WTF/ChangeLog

    r237789 r237803  
     12018-11-05  Dominik Infuehr  <dinfuehr@igalia.com>
     2
     3        Enable LLInt on ARMv7/Linux
     4        https://bugs.webkit.org/show_bug.cgi?id=191190
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        After enabling the new bytecode format in r237547, C_LOOP was
     9        forced on all 32-bit platforms. Now enable LLInt again on
     10        ARMv7-Thumb2/Linux by default.
     11
     12        * wtf/Platform.h:
     13
    1142018-11-04  Fujii Hironori  <Hironori.Fujii@sony.com>
    215
  • trunk/Source/WTF/wtf/Platform.h

    r237723 r237803  
    760760#endif
    761761
    762 /* Force C_LOOP for 32-bit builds. */
     762/* Disable JIT for 32-bit builds. */
    763763#if USE(JSVALUE32_64)
    764764#undef ENABLE_JIT
    765765#define ENABLE_JIT 0
     766/* Force C_LOOP on all architectures but ARMv7-Thumb2/Linux. */
     767#if !(CPU(ARM_THUMB2) && OS(LINUX))
    766768#undef ENABLE_C_LOOP
    767769#define ENABLE_C_LOOP 1
     770#endif
    768771#endif
    769772
  • trunk/Source/cmake/WebKitFeatures.cmake

    r237547 r237803  
    6969        set(ENABLE_C_LOOP_DEFAULT OFF)
    7070        set(ENABLE_SAMPLING_PROFILER_DEFAULT ON)
     71    elseif (WTF_CPU_ARM AND WTF_OS_UNIX)
     72        set(ENABLE_JIT_DEFAULT OFF)
     73        set(ENABLE_FTL_DEFAULT OFF)
     74        set(USE_SYSTEM_MALLOC_DEFAULT OFF)
     75        set(ENABLE_C_LOOP_DEFAULT OFF)
     76        set(ENABLE_SAMPLING_PROFILER_DEFAULT OFF)
    7177    else ()
    7278        set(ENABLE_JIT_DEFAULT OFF)
Note: See TracChangeset for help on using the changeset viewer.