diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-11-07 09:36:50 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:31:10 +0000 |
commit | 5ae3854f795ac5c1a0f104bd8b66ed6f988181cd (patch) | |
tree | 197aac0ea37c400dfa582379b2bac84029e794a0 /Source/JavaScriptCore/offlineasm/x86.rb | |
parent | 747609969d3a8bd95ed2293bb5d943660188ede4 (diff) | |
download | qtwebkit-5ae3854f795ac5c1a0f104bd8b66ed6f988181cd.tar.gz |
Imported WebKit commit 490f716dd2dd07fb0d6652795c62586e2e28ae27
Change-Id: I9f66467721cf923468af87915c260c1bb44e013e
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/JavaScriptCore/offlineasm/x86.rb')
-rw-r--r-- | Source/JavaScriptCore/offlineasm/x86.rb | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/Source/JavaScriptCore/offlineasm/x86.rb b/Source/JavaScriptCore/offlineasm/x86.rb index 2e0693726..0da7a0240 100644 --- a/Source/JavaScriptCore/offlineasm/x86.rb +++ b/Source/JavaScriptCore/offlineasm/x86.rb @@ -125,20 +125,12 @@ def useX87 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 @@ class Sequence end class Instruction - @@floatingPointCompareImplicitOperand = isIntelSyntax ? "st(0), " : "" def x86Operands(*kinds) raise unless kinds.size == operands.size @@ -574,6 +565,10 @@ class Instruction raise end end + + def getImplicitOperandString + isIntelSyntax ? "st(0), " : "" + end def handleX86OpWithNumOperands(opcode, kind, numOperands) if numOperands == 3 @@ -808,20 +803,21 @@ class Instruction 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 @@ -1108,6 +1104,7 @@ class Instruction $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)})" @@ -1119,7 +1116,7 @@ class Instruction $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 |