<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[206759] trunk/Source/JavaScriptCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/206759">206759</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-10-03 16:24:56 -0700 (Mon, 03 Oct 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>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 &lt;Christopher.Reid@am.sony.com&gt; on 2016-10-03
Reviewed by Mark Lam.

* CMakeLists.txt:
* offlineasm/asm.rb:
* offlineasm/x86.rb:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreofflineasmasmrb">trunk/Source/JavaScriptCore/offlineasm/asm.rb</a></li>
<li><a href="#trunkSourceJavaScriptCoreofflineasmx86rb">trunk/Source/JavaScriptCore/offlineasm/x86.rb</a></li>
</ul>

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

</body>
</html>