Changeset 206759 in webkit


Ignore:
Timestamp:
Oct 3, 2016 4:24:56 PM (7 years ago)
Author:
commit-queue@webkit.org
Message:

Offline asm should not output masm assembly when using a x86_64 asm backend
https://bugs.webkit.org/show_bug.cgi?id=162705

When cross compiling on windows to Clang, masm was being generated simply because
the os was windows. This change adds a command line parameter --assembler=MASM
to set the output assembly to masm.
The functions isGCC and isCompilingToWindows were removed as they are no longer called.

Patch by Christopher Reid <Christopher.Reid@am.sony.com> on 2016-10-03
Reviewed by Mark Lam.

  • CMakeLists.txt:
  • offlineasm/asm.rb:
  • offlineasm/x86.rb:
Location:
trunk/Source/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r206653 r206759  
    10331033if (MSVC)
    10341034    set(LLIntOutput LowLevelInterpreterWin.asm)
     1035    set(OFFLINE_ASM_ARGS --assembler=MASM)
    10351036else ()
    10361037    set(LLIntOutput LLIntAssembly.h)
     
    10411042    MAIN_DEPENDENCY ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb
    10421043    DEPENDS LLIntOffsetsExtractor ${LLINT_ASM} ${OFFLINE_ASM} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InitBytecodes.asm
    1043     COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb -I${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/ ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm $<TARGET_FILE:LLIntOffsetsExtractor> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${LLIntOutput}
     1044    COMMAND ${RUBY_EXECUTABLE} ${JAVASCRIPTCORE_DIR}/offlineasm/asm.rb -I${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/ ${JAVASCRIPTCORE_DIR}/llint/LowLevelInterpreter.asm $<TARGET_FILE:LLIntOffsetsExtractor> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${LLIntOutput} ${OFFLINE_ASM_ARGS}
    10441045    COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${LLIntOutput}
    10451046    WORKING_DIRECTORY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
  • trunk/Source/JavaScriptCore/ChangeLog

    r206756 r206759  
     12016-10-03  Christopher Reid  <Christopher.Reid@am.sony.com>
     2
     3        Offline asm should not output masm assembly when using a x86_64 asm backend
     4        https://bugs.webkit.org/show_bug.cgi?id=162705
     5
     6        When cross compiling on windows to Clang, masm was being generated simply because
     7        the os was windows. This change adds a command line parameter --assembler=MASM
     8        to set the output assembly to masm.
     9        The functions isGCC and isCompilingToWindows were removed as they are no longer called.
     10
     11        Reviewed by Mark Lam.
     12
     13        * CMakeLists.txt:
     14        * offlineasm/asm.rb:
     15        * offlineasm/x86.rb:
     16
    1172016-10-03  JF Bastien  <jfbastien@apple.com>
    218
  • trunk/Source/JavaScriptCore/offlineasm/asm.rb

    r200666 r206759  
    3030require "digest/sha1"
    3131require "offsets"
     32require 'optparse'
    3233require "parser"
    3334require "self_hash"
     
    302303outputFlnm = ARGV.shift
    303304
     305$options = {}
     306OptionParser.new do |opts|
     307    opts.banner = "Usage: asm.rb asmFile offsetsFile outputFileName [--assembler=<ASM>]"
     308    # This option is currently only used to specify the masm assembler
     309    opts.on("--assembler=[ASM]", "Specify an assembler to use.") do |assembler|
     310        $options[:assembler] = assembler
     311    end
     312end.parse!
     313
    304314begin
    305315    configurationList = offsetsAndConfigurationIndex(offsetsFile)
     
    320330    $commentPrefix + " offlineasm input hash: " + parseHash(asmFile) +
    321331    " " + Digest::SHA1.hexdigest(configurationList.map{|v| (v[0] + [v[1]]).join(' ')}.join(' ')) +
    322     " " + selfHash
     332    " " + selfHash +
     333    " " + Digest::SHA1.hexdigest($options.has_key?(:assembler) ? $options[:assembler] : "")
    323334
    324335if FileTest.exist? outputFlnm
  • trunk/Source/JavaScriptCore/offlineasm/x86.rb

    r206555 r206759  
    126126end
    127127
    128 def isCompilingOnWindows
    129     ENV['OS'] == 'Windows_NT'
    130 end
    131 
    132 def isGCC
    133     !isCompilingOnWindows
    134 end
    135 
    136128def isMSVC
    137     isCompilingOnWindows
     129    $options.has_key?(:assembler) && $options[:assembler] == "MASM"
    138130end
    139131
    140132def isIntelSyntax
    141     isCompilingOnWindows
     133    $options.has_key?(:assembler) && $options[:assembler] == "MASM"
    142134end
    143135
     
    521513
    522514class Instruction
    523     @@floatingPointCompareImplicitOperand = isIntelSyntax ? "st(0), " : ""
    524515   
    525516    def x86Operands(*kinds)
     
    575566        end
    576567    end
     568
     569    def getImplicitOperandString
     570        isIntelSyntax ? "st(0), " : ""
     571    end
    577572   
    578573    def handleX86OpWithNumOperands(opcode, kind, numOperands)
     
    809804
    810805    def handleX87Compare(mode)
     806        floatingPointCompareImplicitOperand = getImplicitOperandString
    811807        case mode
    812808        when :normal
    813809            if (operands[0].x87DefaultStackPosition == 0)
    814                 $asm.puts "fucomi #{@@floatingPointCompareImplicitOperand}#{operands[1].x87Operand(0)}"
     810                $asm.puts "fucomi #{floatingPointCompareImplicitOperand}#{operands[1].x87Operand(0)}"
    815811            else
    816812                $asm.puts "fld #{operands[0].x87Operand(0)}"
    817                 $asm.puts "fucomip #{@@floatingPointCompareImplicitOperand}#{operands[1].x87Operand(1)}"
     813                $asm.puts "fucomip #{floatingPointCompareImplicitOperand}#{operands[1].x87Operand(1)}"
    818814            end
    819815        when :reverse
    820816            if (operands[1].x87DefaultStackPosition == 0)
    821                 $asm.puts "fucomi #{@@floatingPointCompareImplicitOperand}#{operands[0].x87Operand(0)}"
     817                $asm.puts "fucomi #{floatingPointCompareImplicitOperand}#{operands[0].x87Operand(0)}"
    822818            else
    823819                $asm.puts "fld #{operands[1].x87Operand(0)}"
    824                 $asm.puts "fucomip #{@@floatingPointCompareImplicitOperand}#{operands[0].x87Operand(1)}"
     820                $asm.puts "fucomip #{floatingPointCompareImplicitOperand}#{operands[0].x87Operand(1)}"
    825821            end
    826822        else
     
    11171113        when "bcd2i"
    11181114            if useX87
     1115                floatingPointCompareImplicitOperand = getImplicitOperandString
    11191116                sp = RegisterID.new(nil, "sp")
    11201117                if (operands[0].x87DefaultStackPosition == 0)
     
    11281125                $asm.puts "je #{operands[2].asmLabel}"
    11291126                $asm.puts "fild#{x86Suffix(:int)} #{getSizeString(:int)}#{offsetRegister(-4, sp.x86Operand(:ptr))}"
    1130                 $asm.puts "fucomip #{@@floatingPointCompareImplicitOperand}#{operands[0].x87Operand(1)}"
     1127                $asm.puts "fucomip #{floatingPointCompareImplicitOperand}#{operands[0].x87Operand(1)}"
    11311128                $asm.puts "jp #{operands[2].asmLabel}"
    11321129                $asm.puts "jne #{operands[2].asmLabel}"
Note: See TracChangeset for help on using the changeset viewer.