Title: [206759] trunk/Source/_javascript_Core
- Revision
- 206759
- Author
- [email protected]
- Date
- 2016-10-03 16:24:56 -0700 (Mon, 03 Oct 2016)
Log 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 <[email protected]> on 2016-10-03
Reviewed by Mark Lam.
* CMakeLists.txt:
* offlineasm/asm.rb:
* offlineasm/x86.rb:
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/CMakeLists.txt (206758 => 206759)
--- trunk/Source/_javascript_Core/CMakeLists.txt 2016-10-03 22:55:46 UTC (rev 206758)
+++ trunk/Source/_javascript_Core/CMakeLists.txt 2016-10-03 23:24:56 UTC (rev 206759)
@@ -1032,6 +1032,7 @@
# after every asm.rb run.
if (MSVC)
set(LLIntOutput LowLevelInterpreterWin.asm)
+ set(OFFLINE_ASM_ARGS --assembler=MASM)
else ()
set(LLIntOutput LLIntAssembly.h)
endif ()
@@ -1040,7 +1041,7 @@
OUTPUT ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${LLIntOutput}
MAIN_DEPENDENCY ${_javascript_CORE_DIR}/offlineasm/asm.rb
DEPENDS LLIntOffsetsExtractor ${LLINT_ASM} ${OFFLINE_ASM} ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/InitBytecodes.asm
- COMMAND ${RUBY_EXECUTABLE} ${_javascript_CORE_DIR}/offlineasm/asm.rb -I${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/ ${_javascript_CORE_DIR}/llint/LowLevelInterpreter.asm $<TARGET_FILE:LLIntOffsetsExtractor> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${LLIntOutput}
+ COMMAND ${RUBY_EXECUTABLE} ${_javascript_CORE_DIR}/offlineasm/asm.rb -I${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/ ${_javascript_CORE_DIR}/llint/LowLevelInterpreter.asm $<TARGET_FILE:LLIntOffsetsExtractor> ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${LLIntOutput} ${OFFLINE_ASM_ARGS}
COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}/${LLIntOutput}
WORKING_DIRECTORY ${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}
VERBATIM)
Modified: trunk/Source/_javascript_Core/ChangeLog (206758 => 206759)
--- trunk/Source/_javascript_Core/ChangeLog 2016-10-03 22:55:46 UTC (rev 206758)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-10-03 23:24:56 UTC (rev 206759)
@@ -1,3 +1,19 @@
+2016-10-03 Christopher Reid <[email protected]>
+
+ 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.
+
+ Reviewed by Mark Lam.
+
+ * CMakeLists.txt:
+ * offlineasm/asm.rb:
+ * offlineasm/x86.rb:
+
2016-10-03 JF Bastien <[email protected]>
Auto-generate WASMOps.h, share with testing JSON file
Modified: trunk/Source/_javascript_Core/offlineasm/asm.rb (206758 => 206759)
--- trunk/Source/_javascript_Core/offlineasm/asm.rb 2016-10-03 22:55:46 UTC (rev 206758)
+++ trunk/Source/_javascript_Core/offlineasm/asm.rb 2016-10-03 23:24:56 UTC (rev 206759)
@@ -29,6 +29,7 @@
require "backends"
require "digest/sha1"
require "offsets"
+require 'optparse'
require "parser"
require "self_hash"
require "settings"
@@ -301,6 +302,15 @@
offsetsFile = ARGV.shift
outputFlnm = ARGV.shift
+$options = {}
+OptionParser.new do |opts|
+ opts.banner = "Usage: asm.rb asmFile offsetsFile outputFileName [--assembler=<ASM>]"
+ # This option is currently only used to specify the masm assembler
+ opts.on("--assembler=[ASM]", "Specify an assembler to use.") do |assembler|
+ $options[:assembler] = assembler
+ end
+end.parse!
+
begin
configurationList = offsetsAndConfigurationIndex(offsetsFile)
rescue MissingMagicValuesException
@@ -319,7 +329,8 @@
inputHash =
$commentPrefix + " offlineasm input hash: " + parseHash(asmFile) +
" " + Digest::SHA1.hexdigest(configurationList.map{|v| (v[0] + [v[1]]).join(' ')}.join(' ')) +
- " " + selfHash
+ " " + selfHash +
+ " " + Digest::SHA1.hexdigest($options.has_key?(:assembler) ? $options[:assembler] : "")
if FileTest.exist? outputFlnm
File.open(outputFlnm, "r") {
Modified: trunk/Source/_javascript_Core/offlineasm/x86.rb (206758 => 206759)
--- trunk/Source/_javascript_Core/offlineasm/x86.rb 2016-10-03 22:55:46 UTC (rev 206758)
+++ trunk/Source/_javascript_Core/offlineasm/x86.rb 2016-10-03 23:24:56 UTC (rev 206759)
@@ -125,20 +125,12 @@
end
end
-def isCompilingOnWindows
- ENV['OS'] == 'Windows_NT'
-end
-
-def isGCC
- !isCompilingOnWindows
-end
-
def isMSVC
- isCompilingOnWindows
+ $options.has_key?(:assembler) && $options[:assembler] == "MASM"
end
def isIntelSyntax
- isCompilingOnWindows
+ $options.has_key?(:assembler) && $options[:assembler] == "MASM"
end
def register(name)
@@ -520,7 +512,6 @@
end
class Instruction
- @@floatingPointCompareImplicitOperand = isIntelSyntax ? "st(0), " : ""
def x86Operands(*kinds)
raise unless kinds.size == operands.size
@@ -574,6 +565,10 @@
raise
end
end
+
+ def getImplicitOperandString
+ isIntelSyntax ? "st(0), " : ""
+ end
def handleX86OpWithNumOperands(opcode, kind, numOperands)
if numOperands == 3
@@ -808,20 +803,21 @@
end
def handleX87Compare(mode)
+ floatingPointCompareImplicitOperand = getImplicitOperandString
case mode
when :normal
if (operands[0].x87DefaultStackPosition == 0)
- $asm.puts "fucomi #{@@floatingPointCompareImplicitOperand}#{operands[1].x87Operand(0)}"
+ $asm.puts "fucomi #{floatingPointCompareImplicitOperand}#{operands[1].x87Operand(0)}"
else
$asm.puts "fld #{operands[0].x87Operand(0)}"
- $asm.puts "fucomip #{@@floatingPointCompareImplicitOperand}#{operands[1].x87Operand(1)}"
+ $asm.puts "fucomip #{floatingPointCompareImplicitOperand}#{operands[1].x87Operand(1)}"
end
when :reverse
if (operands[1].x87DefaultStackPosition == 0)
- $asm.puts "fucomi #{@@floatingPointCompareImplicitOperand}#{operands[0].x87Operand(0)}"
+ $asm.puts "fucomi #{floatingPointCompareImplicitOperand}#{operands[0].x87Operand(0)}"
else
$asm.puts "fld #{operands[1].x87Operand(0)}"
- $asm.puts "fucomip #{@@floatingPointCompareImplicitOperand}#{operands[0].x87Operand(1)}"
+ $asm.puts "fucomip #{floatingPointCompareImplicitOperand}#{operands[0].x87Operand(1)}"
end
else
raise mode.inspect
@@ -1116,6 +1112,7 @@
$asm.puts "cvttsd2si #{operands[0].x86Operand(:double)}, #{operands[1].x86Operand(:int)}"
when "bcd2i"
if useX87
+ floatingPointCompareImplicitOperand = getImplicitOperandString
sp = RegisterID.new(nil, "sp")
if (operands[0].x87DefaultStackPosition == 0)
$asm.puts "fistl -4(#{sp.x86Operand(:ptr)})"
@@ -1127,7 +1124,7 @@
$asm.puts "test#{x86Suffix(:int)} #{operands[1].x86Operand(:int)}, #{operands[1].x86Operand(:int)}"
$asm.puts "je #{operands[2].asmLabel}"
$asm.puts "fild#{x86Suffix(:int)} #{getSizeString(:int)}#{offsetRegister(-4, sp.x86Operand(:ptr))}"
- $asm.puts "fucomip #{@@floatingPointCompareImplicitOperand}#{operands[0].x87Operand(1)}"
+ $asm.puts "fucomip #{floatingPointCompareImplicitOperand}#{operands[0].x87Operand(1)}"
$asm.puts "jp #{operands[2].asmLabel}"
$asm.puts "jne #{operands[2].asmLabel}"
else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes