<!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>[189130] 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/189130">189130</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2015-08-28 15:58:48 -0700 (Fri, 28 Aug 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Refactor the JIT printer out of the AbstractMacroAssembler into MacroAssemblerPrinter.
https://bugs.webkit.org/show_bug.cgi?id=148595

Reviewed by Geoffrey Garen.

Why do this?
1. MacroAssembler::print() code (except for the prototype) need no longer be parsed
   when compiling C++ files that don't need it.
2. Adding support for more printable types to MacroAssemblerPrinter::PrintArg
   triggers recompilation of less files.
3. The printing code is for most the part common between all target platforms and
   was previously duplicated by cut-and-paste to all the varieties of MacroAssemblers
   that support the MASM_PROBE mechanism.  Now, there is only one copy in
   MacroAssemblerPrinter.

* CMakeLists.txt:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
* JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
* JavaScriptCore.xcodeproj/project.pbxproj:

* assembler/AbstractMacroAssembler.h:
(JSC::AbstractMacroAssembler::ProbeContext::print): Deleted.
- Removed this function because it is no longer useful since we have this more
  flexible print() functionality.

(JSC::AbstractMacroAssembler::printIndent): Deleted.
(JSC::AbstractMacroAssembler::printCPU): Deleted.
(JSC::AbstractMacroAssembler::print): Deleted.
(JSC::AbstractMacroAssembler::PrintArg::PrintArg): Deleted.
(JSC::AbstractMacroAssembler::appendPrintArg): Deleted.
(JSC::AbstractMacroAssembler::printInternal): Deleted.
(JSC::AbstractMacroAssembler::printCallback): Deleted.
- These got moved into MacroAssemblerPrinter.cpp.

* assembler/MacroAssembler.h:
* assembler/MacroAssemblerARM.cpp:
(JSC::MacroAssemblerARM::printCPURegisters): Deleted.
(JSC::MacroAssemblerARM::printRegister): Deleted.
* assembler/MacroAssemblerARM.h:
* assembler/MacroAssemblerARMv7.cpp:
(JSC::MacroAssemblerARMv7::printCPURegisters): Deleted.
(JSC::MacroAssemblerARMv7::printRegister): Deleted.
* assembler/MacroAssemblerARMv7.h:
* assembler/MacroAssemblerX86Common.cpp:
(JSC::MacroAssemblerX86Common::printCPURegisters): Deleted.
(JSC::MacroAssemblerX86Common::printRegister): Deleted.
* assembler/MacroAssemblerX86Common.h:
- Deleted a whole bunch of mostly duplicated code.

* assembler/MacroAssemblerPrinter.cpp: Added.
(JSC::printIndent):
(JSC::printCPU):
(JSC::printCPURegisters):
(JSC::printRegister):
(JSC::MacroAssemblerPrinter::printCallback):
* assembler/MacroAssemblerPrinter.h: Added.
(JSC::MacroAssemblerPrinter::print):
(JSC::MacroAssemblerPrinter::PrintArg::PrintArg):
(JSC::MacroAssemblerPrinter::appendPrintArg):
(JSC::MacroAssembler::print):</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="#trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxproj">trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxprojfilters">trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerAbstractMacroAssemblerh">trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerh">trunk/Source/JavaScriptCore/assembler/MacroAssembler.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerARMcpp">trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerARMh">trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerARMv7cpp">trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerARMv7h">trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerX86Commoncpp">trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerX86Commonh">trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerPrintercpp">trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreassemblerMacroAssemblerPrinterh">trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -63,6 +63,7 @@
</span><span class="cx">     assembler/MacroAssembler.cpp
</span><span class="cx">     assembler/MacroAssemblerARM.cpp
</span><span class="cx">     assembler/MacroAssemblerARMv7.cpp
</span><ins>+    assembler/MacroAssemblerPrinter.cpp
</ins><span class="cx">     assembler/MacroAssemblerX86Common.cpp
</span><span class="cx"> 
</span><span class="cx">     bindings/ScriptFunctionCall.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -1,3 +1,66 @@
</span><ins>+2015-08-28  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Refactor the JIT printer out of the AbstractMacroAssembler into MacroAssemblerPrinter.
+        https://bugs.webkit.org/show_bug.cgi?id=148595
+
+        Reviewed by Geoffrey Garen.
+
+        Why do this?
+        1. MacroAssembler::print() code (except for the prototype) need no longer be parsed
+           when compiling C++ files that don't need it.
+        2. Adding support for more printable types to MacroAssemblerPrinter::PrintArg
+           triggers recompilation of less files.
+        3. The printing code is for most the part common between all target platforms and
+           was previously duplicated by cut-and-paste to all the varieties of MacroAssemblers
+           that support the MASM_PROBE mechanism.  Now, there is only one copy in
+           MacroAssemblerPrinter.
+
+        * CMakeLists.txt:
+        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
+        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+
+        * assembler/AbstractMacroAssembler.h:
+        (JSC::AbstractMacroAssembler::ProbeContext::print): Deleted.
+        - Removed this function because it is no longer useful since we have this more
+          flexible print() functionality.
+
+        (JSC::AbstractMacroAssembler::printIndent): Deleted.
+        (JSC::AbstractMacroAssembler::printCPU): Deleted.
+        (JSC::AbstractMacroAssembler::print): Deleted.
+        (JSC::AbstractMacroAssembler::PrintArg::PrintArg): Deleted.
+        (JSC::AbstractMacroAssembler::appendPrintArg): Deleted.
+        (JSC::AbstractMacroAssembler::printInternal): Deleted.
+        (JSC::AbstractMacroAssembler::printCallback): Deleted.
+        - These got moved into MacroAssemblerPrinter.cpp.
+
+        * assembler/MacroAssembler.h:
+        * assembler/MacroAssemblerARM.cpp:
+        (JSC::MacroAssemblerARM::printCPURegisters): Deleted.
+        (JSC::MacroAssemblerARM::printRegister): Deleted.
+        * assembler/MacroAssemblerARM.h:
+        * assembler/MacroAssemblerARMv7.cpp:
+        (JSC::MacroAssemblerARMv7::printCPURegisters): Deleted.
+        (JSC::MacroAssemblerARMv7::printRegister): Deleted.
+        * assembler/MacroAssemblerARMv7.h:
+        * assembler/MacroAssemblerX86Common.cpp:
+        (JSC::MacroAssemblerX86Common::printCPURegisters): Deleted.
+        (JSC::MacroAssemblerX86Common::printRegister): Deleted.
+        * assembler/MacroAssemblerX86Common.h:
+        - Deleted a whole bunch of mostly duplicated code.
+
+        * assembler/MacroAssemblerPrinter.cpp: Added.
+        (JSC::printIndent):
+        (JSC::printCPU):
+        (JSC::printCPURegisters):
+        (JSC::printRegister):
+        (JSC::MacroAssemblerPrinter::printCallback):
+        * assembler/MacroAssemblerPrinter.h: Added.
+        (JSC::MacroAssemblerPrinter::print):
+        (JSC::MacroAssemblerPrinter::PrintArg::PrintArg):
+        (JSC::MacroAssemblerPrinter::appendPrintArg):
+        (JSC::MacroAssembler::print):
+
</ins><span class="cx"> 2015-08-28  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         LICM should be sound even if the CFG has changed
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -305,6 +305,7 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\API\OpaqueJSString.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\assembler\LinkBuffer.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\assembler\MacroAssembler.cpp&quot; /&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\assembler\MacroAssemblerPrinter.cpp&quot; /&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\assembler\MacroAssemblerX86Common.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\bindings\ScriptFunctionCall.cpp&quot; /&gt;
</span><span class="cx">     &lt;ClCompile Include=&quot;..\bindings\ScriptObject.cpp&quot; /&gt;
</span><span class="lines">@@ -986,6 +987,7 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\assembler\CodeLocation.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\assembler\LinkBuffer.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\assembler\MacroAssembler.h&quot; /&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\assembler\MacroAssemblerPrinter.h&quot; /&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\assembler\MacroAssemblerX86.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\assembler\MacroAssemblerX86Common.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\assembler\MacroAssemblerX86_64.h&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -132,6 +132,9 @@
</span><span class="cx">     &lt;ClCompile Include=&quot;..\assembler\MacroAssembler.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;assembler&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><ins>+    &lt;ClCompile Include=&quot;..\assembler\MacroAssemblerPrinter.cpp&quot;&gt;
+      &lt;Filter&gt;assembler&lt;/Filter&gt;
+    &lt;/ClCompile&gt;
</ins><span class="cx">     &lt;ClCompile Include=&quot;..\assembler\MacroAssemblerX86Common.cpp&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;assembler&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClCompile&gt;
</span><span class="lines">@@ -1980,6 +1983,9 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\assembler\MacroAssembler.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;assembler&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span><ins>+    &lt;ClInclude Include=&quot;..\assembler\MacroAssemblerPrinter.h&quot;&gt;
+      &lt;Filter&gt;assembler&lt;/Filter&gt;
+    &lt;/ClInclude&gt;
</ins><span class="cx">     &lt;ClInclude Include=&quot;..\assembler\MacroAssemblerX86.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;assembler&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -1751,6 +1751,8 @@
</span><span class="cx">                 FE5068671AE25E280009DAB7 /* DeferredSourceDump.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE5068661AE25E280009DAB7 /* DeferredSourceDump.cpp */; };
</span><span class="cx">                 FE5932A7183C5A2600A1ECCC /* VMEntryScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE5932A5183C5A2600A1ECCC /* VMEntryScope.cpp */; };
</span><span class="cx">                 FE5932A8183C5A2600A1ECCC /* VMEntryScope.h in Headers */ = {isa = PBXBuildFile; fileRef = FE5932A6183C5A2600A1ECCC /* VMEntryScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                FE68C6371B90DE040042BCB3 /* MacroAssemblerPrinter.h in Headers */ = {isa = PBXBuildFile; fileRef = FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                FE68C6381B90DE0B0042BCB3 /* MacroAssemblerPrinter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE68C6351B90DDD90042BCB3 /* MacroAssemblerPrinter.cpp */; };
</ins><span class="cx">                 FE7BA60F1A1A7CEC00F1F7B4 /* HeapVerifier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE7BA60D1A1A7CEC00F1F7B4 /* HeapVerifier.cpp */; };
</span><span class="cx">                 FE7BA6101A1A7CEC00F1F7B4 /* HeapVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 FEA08620182B7A0400F6D851 /* Breakpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = FEA0861E182B7A0400F6D851 /* Breakpoint.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -3643,6 +3645,8 @@
</span><span class="cx">                 FE5068661AE25E280009DAB7 /* DeferredSourceDump.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeferredSourceDump.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FE5932A5183C5A2600A1ECCC /* VMEntryScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMEntryScope.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FE5932A6183C5A2600A1ECCC /* VMEntryScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMEntryScope.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                FE68C6351B90DDD90042BCB3 /* MacroAssemblerPrinter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MacroAssemblerPrinter.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerPrinter.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 FE7BA60D1A1A7CEC00F1F7B4 /* HeapVerifier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HeapVerifier.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FE7BA60E1A1A7CEC00F1F7B4 /* HeapVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HeapVerifier.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 FE90BB3A1B7CF64E006B3F03 /* VMInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMInlines.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5469,6 +5473,8 @@
</span><span class="cx">                                 86ADD1440FDDEA980006EEC2 /* MacroAssemblerARMv7.h */,
</span><span class="cx">                                 863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */,
</span><span class="cx">                                 86C568DE11A213EE0007F7F0 /* MacroAssemblerMIPS.h */,
</span><ins>+                                FE68C6351B90DDD90042BCB3 /* MacroAssemblerPrinter.cpp */,
+                                FE68C6361B90DDD90042BCB3 /* MacroAssemblerPrinter.h */,
</ins><span class="cx">                                 86AE64A6135E5E1C00963012 /* MacroAssemblerSH4.h */,
</span><span class="cx">                                 860161E00F3A83C100F84710 /* MacroAssemblerX86.h */,
</span><span class="cx">                                 860161E10F3A83C100F84710 /* MacroAssemblerX86_64.h */,
</span><span class="lines">@@ -6139,6 +6145,7 @@
</span><span class="cx">                                 0F2B9CED19D0BA7D00B1D1B5 /* DFGPromotedHeapLocation.h in Headers */,
</span><span class="cx">                                 A704D90717A0BAA8006BA554 /* DFGMergeMode.h in Headers */,
</span><span class="cx">                                 0FB17663196B8F9E0091052A /* DFGPureValue.h in Headers */,
</span><ins>+                                FE68C6371B90DE040042BCB3 /* MacroAssemblerPrinter.h in Headers */,
</ins><span class="cx">                                 0F2BDC451522801B00CD8910 /* DFGMinifiedGraph.h in Headers */,
</span><span class="cx">                                 0F2E892D16D02BAF009E4FD2 /* DFGMinifiedID.h in Headers */,
</span><span class="cx">                                 0F2BDC461522802000CD8910 /* DFGMinifiedNode.h in Headers */,
</span><span class="lines">@@ -7967,6 +7974,7 @@
</span><span class="cx">                                 E18E3A590DF9278C00D90B34 /* VM.cpp in Sources */,
</span><span class="cx">                                 FE5932A7183C5A2600A1ECCC /* VMEntryScope.cpp in Sources */,
</span><span class="cx">                                 FED94F2E171E3E2300BE77A4 /* Watchdog.cpp in Sources */,
</span><ins>+                                FE68C6381B90DE0B0042BCB3 /* MacroAssemblerPrinter.cpp in Sources */,
</ins><span class="cx">                                 7B98D1361B60CD5F0023B1A4 /* JSWASMModule.cpp in Sources */,
</span><span class="cx">                                 0F919D2515853CE0004A4E7D /* Watchpoint.cpp in Sources */,
</span><span class="cx">                                 1ACF7377171CA6FB00C9BB1E /* Weak.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerAbstractMacroAssemblerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/assembler/AbstractMacroAssembler.h        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -908,99 +908,8 @@
</span><span class="cx">         void* arg1;
</span><span class="cx">         void* arg2;
</span><span class="cx">         CPUState cpu;
</span><del>-
-        void print(int indentation = 0)
-        {
-            #define INDENT MacroAssemblerType::printIndent(indentation)
-
-            INDENT, dataLogF(&quot;ProbeContext %p {\n&quot;, this);
-            indentation++;
-            {
-                INDENT, dataLogF(&quot;probeFunction: %p\n&quot;, probeFunction);
-                INDENT, dataLogF(&quot;arg1: %p %llu\n&quot;, arg1, reinterpret_cast&lt;int64_t&gt;(arg1));
-                INDENT, dataLogF(&quot;arg2: %p %llu\n&quot;, arg2, reinterpret_cast&lt;int64_t&gt;(arg2));
-                MacroAssemblerType::printCPU(cpu, indentation);
-            }
-            indentation--;
-            INDENT, dataLog(&quot;}\n&quot;);
-
-            #undef INDENT
-        }
</del><span class="cx">     };
</span><span class="cx"> 
</span><del>-    static void printIndent(int indentation)
-    {
-        for (; indentation &gt; 0; indentation--)
-            dataLog(&quot;    &quot;);
-    }
-
-    static void printCPU(CPUState&amp; cpu, int indentation = 0)
-    {
-        #define INDENT printIndent(indentation)
-
-        INDENT, dataLog(&quot;cpu: {\n&quot;);
-        MacroAssemblerType::printCPURegisters(cpu, indentation + 1);
-        INDENT, dataLog(&quot;}\n&quot;);
-
-        #undef INDENT
-    }
-
-    // This is a marker type only used with print(). See print() below for details.
-    struct AllRegisters { };
-
-    // Emits code which will print debugging info at runtime. The type of values that
-    // can be printed is encapsulated in the PrintArg struct below. Here are some
-    // examples:
-    //
-    //      print(&quot;Hello world\n&quot;); // Emits code to print the string.
-    //
-    //      CodeBlock* cb = ...;
-    //      print(cb);              // Emits code to print the pointer value.
-    //
-    //      RegisterID regID = ...;
-    //      print(regID);           // Emits code to print the register value (not the id).
-    //
-    //      // Emits code to print all registers.  Unlike other items, this prints
-    //      // multiple lines as follows:
-    //      //      cpu {
-    //      //          eax: 0x123456789
-    //      //          ebx: 0x000000abc
-    //      //          ...
-    //      //      }
-    //      print(AllRegisters());
-    //
-    //      // Print multiple things at once. This incurs the probe overhead only once
-    //      // to print all the items.
-    //      print(&quot;cb:&quot;, cb, &quot; regID:&quot;, regID, &quot; cpu:\n&quot;, AllRegisters());
-
-    template&lt;typename... Arguments&gt;
-    void print(Arguments... args)
-    {
-        printInternal(static_cast&lt;MacroAssemblerType*&gt;(this), args...);
-    }
-
-    // This function will be called by printCPU() to print the contents of the
-    // target specific registers which are saved away in the CPUState struct.
-    // printCPURegisters() should make use of printIndentation() to print the
-    // registers with the appropriate amount of indentation.
-    //
-    // Note: printCPURegisters() should be implemented by the target specific
-    // MacroAssembler. This prototype is only provided here to document the
-    // interface.
-
-    static void printCPURegisters(CPUState&amp;, int indentation = 0);
-
-    // This function will be called by print() to print the contents of a
-    // specific register (from the CPUState) in line with other items in the
-    // print stream. Hence, no indentation is needed.
-    //
-    // Note: printRegister() should be implemented by the target specific
-    // MacroAssembler. These prototypes are only provided here to document their
-    // interface.
-
-    static void printRegister(CPUState&amp;, RegisterID);
-    static void printRegister(CPUState&amp;, FPRegisterID);
-
</del><span class="cx">     // This function emits code to preserve the CPUState (e.g. registers),
</span><span class="cx">     // call a user supplied probe function, and restore the CPUState before
</span><span class="cx">     // continuing with other JIT generated code.
</span><span class="lines">@@ -1186,139 +1095,6 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx"> 
</span><del>-#if ENABLE(MASM_PROBE)
-
-    struct PrintArg {
-    
-        enum class Type {
-            AllRegisters,
-            RegisterID,
-            FPRegisterID,
-            ConstCharPtr,
-            ConstVoidPtr,
-            IntptrValue,
-            UintptrValue,
-        };
-
-        PrintArg(AllRegisters&amp;)
-            : type(Type::AllRegisters)
-        {
-        }
-
-        PrintArg(RegisterID regID)
-            : type(Type::RegisterID)
-        {
-            u.gpRegisterID = regID;
-        }
-
-        PrintArg(FPRegisterID regID)
-            : type(Type::FPRegisterID)
-        {
-            u.fpRegisterID = regID;
-        }
-
-        PrintArg(const char* ptr)
-            : type(Type::ConstCharPtr)
-        {
-            u.constCharPtr = ptr;
-        }
-
-        PrintArg(const void* ptr)
-            : type(Type::ConstVoidPtr)
-        {
-            u.constVoidPtr = ptr;
-        }
-
-        PrintArg(int value)
-            : type(Type::IntptrValue)
-        {
-            u.intptrValue = value;
-        }
-
-        PrintArg(unsigned value)
-            : type(Type::UintptrValue)
-        {
-            u.intptrValue = value;
-        }
-
-        PrintArg(intptr_t value)
-            : type(Type::IntptrValue)
-        {
-            u.intptrValue = value;
-        }
-
-        PrintArg(uintptr_t value)
-            : type(Type::UintptrValue)
-        {
-            u.uintptrValue = value;
-        }
-
-        Type type;
-        union {
-            RegisterID gpRegisterID;
-            FPRegisterID fpRegisterID;
-            const char* constCharPtr;
-            const void* constVoidPtr;
-            intptr_t intptrValue;
-            uintptr_t uintptrValue;
-        } u;
-    };
-
-    typedef Vector&lt;PrintArg&gt; PrintArgsList;
-
-    template&lt;typename FirstArg, typename... Arguments&gt;
-    static void appendPrintArg(PrintArgsList* argsList, FirstArg&amp; firstArg, Arguments... otherArgs)
-    {
-        argsList-&gt;append(PrintArg(firstArg));
-        appendPrintArg(argsList, otherArgs...);
-    }
-
-    static void appendPrintArg(PrintArgsList*) { }
-
-    
-    template&lt;typename... Arguments&gt;
-    static void printInternal(MacroAssemblerType* masm, Arguments... args)
-    {
-        auto argsList = std::make_unique&lt;PrintArgsList&gt;();
-        appendPrintArg(argsList.get(), args...);
-        masm-&gt;probe(printCallback, argsList.release());
-    }
-
-    static void printCallback(ProbeContext* context)
-    {
-        typedef PrintArg Arg;
-        PrintArgsList&amp; argsList =
-            *reinterpret_cast&lt;PrintArgsList*&gt;(context-&gt;arg1);
-        for (size_t i = 0; i &lt; argsList.size(); i++) {
-            auto&amp; arg = argsList[i];
-            switch (arg.type) {
-            case Arg::Type::AllRegisters:
-                MacroAssemblerType::printCPU(context-&gt;cpu);
-                break;
-            case Arg::Type::RegisterID:
-                MacroAssemblerType::printRegister(context-&gt;cpu, arg.u.gpRegisterID);
-                break;
-            case Arg::Type::FPRegisterID:
-                MacroAssemblerType::printRegister(context-&gt;cpu, arg.u.fpRegisterID);
-                break;
-            case Arg::Type::ConstCharPtr:
-                dataLog(arg.u.constCharPtr);
-                break;
-            case Arg::Type::ConstVoidPtr:
-                dataLogF(&quot;%p&quot;, arg.u.constVoidPtr);
-                break;
-            case Arg::Type::IntptrValue:
-                dataLog(arg.u.intptrValue);
-                break;
-            case Arg::Type::UintptrValue:
-                dataLog(arg.u.uintptrValue);
-                break;
-            }
-        }
-    }
-
-#endif // ENABLE(MASM_PROBE)
-
</del><span class="cx"> }; // class AbstractMacroAssembler
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssembler.h (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssembler.h        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssembler.h        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -1583,6 +1583,13 @@
</span><span class="cx">     {
</span><span class="cx">         urshift32(src, trustedImm32ForShift(amount), dest);
</span><span class="cx">     }
</span><ins>+
+#if ENABLE(MASM_PROBE)
+    // Let's you print from your JIT generated code.
+    // See comments in MacroAssemblerPrinter.h for examples of how to use this.
+    template&lt;typename... Arguments&gt;
+    void print(Arguments... args);
+#endif
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerARMcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.cpp        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013, 2014 Apple Inc.
</del><ins>+ * Copyright (C) 2013-2015 Apple Inc.
</ins><span class="cx">  * Copyright (C) 2009 University of Szeged
</span><span class="cx">  * All rights reserved.
</span><span class="cx">  *
</span><span class="lines">@@ -97,51 +97,6 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MASM_PROBE)
</span><span class="cx"> 
</span><del>-#define INDENT printIndent(indentation)
-
-void MacroAssemblerARM::printCPURegisters(CPUState&amp; cpu, int indentation)
-{
-    #define PRINT_GPREGISTER(_type, _regName) { \
-        int32_t value = reinterpret_cast&lt;int32_t&gt;(cpu._regName); \
-        INDENT, dataLogF(&quot;%5s: 0x%08x  %d\n&quot;, #_regName, value, value) ; \
-    }
-    FOR_EACH_CPU_GPREGISTER(PRINT_GPREGISTER)
-    FOR_EACH_CPU_SPECIAL_REGISTER(PRINT_GPREGISTER)
-    #undef PRINT_GPREGISTER
-
-    #define PRINT_FPREGISTER(_type, _regName) { \
-        uint64_t* u = reinterpret_cast&lt;uint64_t*&gt;(&amp;cpu._regName); \
-        double* d = reinterpret_cast&lt;double*&gt;(&amp;cpu._regName); \
-        INDENT, dataLogF(&quot;%5s: 0x%016llx  %.13g\n&quot;, #_regName, *u, *d); \
-    }
-    FOR_EACH_CPU_FPREGISTER(PRINT_FPREGISTER)
-    #undef PRINT_FPREGISTER
-}
-
-#undef INDENT
-
-void MacroAssemblerARM::printRegister(MacroAssemblerARM::CPUState&amp; cpu, RegisterID regID)
-{
-    const char* name = CPUState::registerName(regID);
-    union {
-        void* voidPtr;
-        intptr_t intptrValue;
-    } u;
-    u.voidPtr = cpu.registerValue(regID);
-    dataLogF(&quot;%s:&lt;%p %ld&gt;&quot;, name, u.voidPtr, u.intptrValue);
-}
-
-void MacroAssemblerARM::printRegister(MacroAssemblerARM::CPUState&amp; cpu, FPRegisterID regID)
-{
-    const char* name = CPUState::registerName(regID);
-    union {
-        double doubleValue;
-        uint64_t uint64Value;
-    } u;
-    u.doubleValue = cpu.registerValue(regID);
-    dataLogF(&quot;%s:&lt;0x%016llx %.13g&gt;&quot;, name, u.uint64Value, u.doubleValue);
-}
-
</del><span class="cx"> extern &quot;C&quot; void ctiMasmProbeTrampoline();
</span><span class="cx"> 
</span><span class="cx"> // For details on &quot;What code is emitted for the probe?&quot; and &quot;What values are in
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerARMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerARM.h        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2008, 2013, 2014 Apple Inc.
</del><ins>+ * Copyright (C) 2008, 2013-2015 Apple Inc.
</ins><span class="cx">  * Copyright (C) 2009, 2010 University of Szeged
</span><span class="cx">  * All rights reserved.
</span><span class="cx">  *
</span><span class="lines">@@ -1433,11 +1433,6 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MASM_PROBE)
</span><del>-    // Methods required by the MASM_PROBE mechanism as defined in
-    // AbstractMacroAssembler.h. 
-    static void printCPURegisters(CPUState&amp;, int indentation = 0);
-    static void printRegister(CPUState&amp;, RegisterID);
-    static void printRegister(CPUState&amp;, FPRegisterID);
</del><span class="cx">     void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0);
</span><span class="cx"> #endif // ENABLE(MASM_PROBE)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerARMv7cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.cpp        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -32,51 +32,6 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MASM_PROBE)
</span><span class="cx"> 
</span><del>-#define INDENT printIndent(indentation)
-
-void MacroAssemblerARMv7::printCPURegisters(CPUState&amp; cpu, int indentation)
-{
-    #define PRINT_GPREGISTER(_type, _regName) { \
-        int32_t value = reinterpret_cast&lt;int32_t&gt;(cpu._regName); \
-        INDENT, dataLogF(&quot;%5s: 0x%08x  %d\n&quot;, #_regName, value, value) ; \
-    }
-    FOR_EACH_CPU_GPREGISTER(PRINT_GPREGISTER)
-    FOR_EACH_CPU_SPECIAL_REGISTER(PRINT_GPREGISTER)
-    #undef PRINT_GPREGISTER
-
-    #define PRINT_FPREGISTER(_type, _regName) { \
-        uint64_t* u = reinterpret_cast&lt;uint64_t*&gt;(&amp;cpu._regName); \
-        double* d = reinterpret_cast&lt;double*&gt;(&amp;cpu._regName); \
-        INDENT, dataLogF(&quot;%5s: 0x%016llx  %.13g\n&quot;, #_regName, *u, *d); \
-    }
-    FOR_EACH_CPU_FPREGISTER(PRINT_FPREGISTER)
-    #undef PRINT_FPREGISTER
-}
-
-#undef INDENT
-
-void MacroAssemblerARMv7::printRegister(MacroAssemblerARMv7::CPUState&amp; cpu, RegisterID regID)
-{
-    const char* name = CPUState::registerName(regID);
-    union {
-        void* voidPtr;
-        intptr_t intptrValue;
-    } u;
-    u.voidPtr = cpu.registerValue(regID);
-    dataLogF(&quot;%s:&lt;%p %ld&gt;&quot;, name, u.voidPtr, u.intptrValue);
-}
-
-void MacroAssemblerARMv7::printRegister(MacroAssemblerARMv7::CPUState&amp; cpu, FPRegisterID regID)
-{
-    const char* name = CPUState::registerName(regID);
-    union {
-        double doubleValue;
-        uint64_t uint64Value;
-    } u;
-    u.doubleValue = cpu.registerValue(regID);
-    dataLogF(&quot;%s:&lt;0x%016llx %.13g&gt;&quot;, name, u.uint64Value, u.doubleValue);
-}
-
</del><span class="cx"> extern &quot;C&quot; void ctiMasmProbeTrampoline();
</span><span class="cx"> 
</span><span class="cx"> // For details on &quot;What code is emitted for the probe?&quot; and &quot;What values are in
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerARMv7h"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerARMv7.h        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2009, 2010, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2009-2010, 2014-2015 Apple Inc. All rights reserved.
</ins><span class="cx">  * Copyright (C) 2010 University of Szeged
</span><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="lines">@@ -1902,11 +1902,6 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MASM_PROBE)
</span><del>-    // Methods required by the MASM_PROBE mechanism as defined in
-    // AbstractMacroAssembler.h. 
-    static void printCPURegisters(CPUState&amp;, int indentation = 0);
-    static void printRegister(CPUState&amp;, RegisterID);
-    static void printRegister(CPUState&amp;, FPRegisterID);
</del><span class="cx">     void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0);
</span><span class="cx"> #endif // ENABLE(MASM_PROBE)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerPrintercpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.cpp (0 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.cpp        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -0,0 +1,148 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;MacroAssemblerPrinter.h&quot;
+
+#if ENABLE(MASM_PROBE)
+
+#include &quot;MacroAssembler.h&quot;
+
+namespace JSC {
+
+using CPUState = MacroAssembler::CPUState;
+using ProbeContext = MacroAssembler::ProbeContext;
+using RegisterID = MacroAssembler::RegisterID;
+using FPRegisterID = MacroAssembler::FPRegisterID;
+
+// These printers will print a block of information. That block may be
+// indented with the specified indentation.
+void printCPU(CPUState&amp;, int indentation = 0);
+void printCPURegisters(CPUState&amp;, int indentation = 0);
+
+// These printers will print the specified information in line in the
+// print stream. Hence, no indentation will be applied.
+void printRegister(CPUState&amp;, RegisterID);
+void printRegister(CPUState&amp;, FPRegisterID);
+    
+static void printIndent(int indentation)
+{
+    for (; indentation &gt; 0; indentation--)
+        dataLog(&quot;    &quot;);
+}
+
+#define INDENT printIndent(indentation)
+    
+void printCPU(CPUState&amp; cpu, int indentation)
+{
+    INDENT, dataLog(&quot;cpu: {\n&quot;);
+    printCPURegisters(cpu, indentation + 1);
+    INDENT, dataLog(&quot;}\n&quot;);
+}
+
+void printCPURegisters(CPUState&amp; cpu, int indentation)
+{
+#if USE(JSVALUE32_64)
+    #define INTPTR_HEX_VALUE_FORMAT &quot;0x%08lx&quot;
+#else
+    #define INTPTR_HEX_VALUE_FORMAT &quot;0x%016lx&quot;
+#endif
+
+    #define PRINT_GPREGISTER(_type, _regName) { \
+        intptr_t value = reinterpret_cast&lt;intptr_t&gt;(cpu._regName); \
+        INDENT, dataLogF(&quot;%6s: &quot; INTPTR_HEX_VALUE_FORMAT &quot;  %ld\n&quot;, #_regName, value, value) ; \
+    }
+    FOR_EACH_CPU_GPREGISTER(PRINT_GPREGISTER)
+    FOR_EACH_CPU_SPECIAL_REGISTER(PRINT_GPREGISTER)
+    #undef PRINT_GPREGISTER
+    #undef INTPTR_HEX_VALUE_FORMAT
+    
+    #define PRINT_FPREGISTER(_type, _regName) { \
+        uint64_t* u = reinterpret_cast&lt;uint64_t*&gt;(&amp;cpu._regName); \
+        double* d = reinterpret_cast&lt;double*&gt;(&amp;cpu._regName); \
+        INDENT, dataLogF(&quot;%6s: 0x%016llx  %.13g\n&quot;, #_regName, *u, *d); \
+    }
+    FOR_EACH_CPU_FPREGISTER(PRINT_FPREGISTER)
+    #undef PRINT_FPREGISTER
+}
+
+void printRegister(CPUState&amp; cpu, RegisterID regID)
+{
+    const char* name = CPUState::registerName(regID);
+    union {
+        void* voidPtr;
+        intptr_t intptrValue;
+    } u;
+    u.voidPtr = cpu.registerValue(regID);
+    dataLogF(&quot;%s:&lt;%p %ld&gt;&quot;, name, u.voidPtr, u.intptrValue);
+}
+
+void printRegister(CPUState&amp; cpu, FPRegisterID regID)
+{
+    const char* name = CPUState::registerName(regID);
+    union {
+        double doubleValue;
+        uint64_t uint64Value;
+    } u;
+    u.doubleValue = cpu.registerValue(regID);
+    dataLogF(&quot;%s:&lt;0x%016llx %.13g&gt;&quot;, name, u.uint64Value, u.doubleValue);
+}
+
+void MacroAssemblerPrinter::printCallback(ProbeContext* context)
+{
+    typedef PrintArg Arg;
+    PrintArgsList&amp; argsList =
+    *reinterpret_cast&lt;PrintArgsList*&gt;(context-&gt;arg1);
+    for (size_t i = 0; i &lt; argsList.size(); i++) {
+        auto&amp; arg = argsList[i];
+        switch (arg.type) {
+        case Arg::Type::AllRegisters:
+            printCPU(context-&gt;cpu, 1);
+            break;
+        case Arg::Type::RegisterID:
+            printRegister(context-&gt;cpu, arg.u.gpRegisterID);
+            break;
+        case Arg::Type::FPRegisterID:
+            printRegister(context-&gt;cpu, arg.u.fpRegisterID);
+            break;
+        case Arg::Type::ConstCharPtr:
+            dataLog(arg.u.constCharPtr);
+            break;
+        case Arg::Type::ConstVoidPtr:
+            dataLogF(&quot;%p&quot;, arg.u.constVoidPtr);
+            break;
+        case Arg::Type::IntptrValue:
+            dataLog(arg.u.intptrValue);
+            break;
+        case Arg::Type::UintptrValue:
+            dataLog(arg.u.uintptrValue);
+            break;
+        }
+    }
+}
+
+} // namespace JSC
+
+#endif // ENABLE(MASM_PROBE)
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerPrinterh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.h (0 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerPrinter.h        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -0,0 +1,201 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MacroAssemblerPrinter_h
+#define MacroAssemblerPrinter_h
+
+#if ENABLE(MASM_PROBE)
+
+#include &quot;MacroAssembler.h&quot;
+
+namespace JSC {
+
+// What is MacroAssembler::print()?
+// ===============================
+// The MacroAsssembler::print() makes it easy to add print logging
+// from JIT compiled code, and can be used to print all types of values
+// at runtime e.g. CPU register values being operated on by the compiled
+// code.
+//
+// print() is built on top of MacroAsssembler::probe(), and hence
+// inserting logging in JIT compiled code will not perturb register values.
+// The only register value that is perturbed is the PC (program counter)
+// since there is now more compiled code to do the printing.
+//
+// How to use the MacroAssembler print()?
+// =====================================
+// 1. #include &quot;MacroAssemblerPrinter.h&quot; in the JIT file where you want to use print().
+//
+// 2. Add print() calls like these in your JIT code:
+//
+//      jit.print(&quot;Hello world\n&quot;); // Emits code to print the string.
+//
+//      CodeBlock* cb = ...;
+//      jit.print(cb, &quot;\n&quot;);        // Emits code to print the pointer value.
+//
+//      RegisterID regID = ...;
+//      jit.print(regID, &quot;\n&quot;);     // Emits code to print the register value (not the id).
+//
+//      // Emits code to print all registers. Unlike other items, this prints
+//      // multiple lines as follows:
+//      //      cpu {
+//      //          eax: 0x123456789
+//      //          ebx: 0x000000abc
+//      //          ...
+//      //      }
+//      jit.print(AllRegisters());
+//
+//      // Print multiple things at once. This incurs the probe overhead only once
+//      // to print all the items.
+//      jit.print(&quot;cb:&quot;, cb, &quot; regID:&quot;, regID, &quot; cpu:\n&quot;, AllRegisters());
+//
+//   The type of values that can be printed is encapsulated in the PrintArg struct below.
+//
+//   Note: print() does not automatically insert a '\n' at the end of the line.
+//   If you want a '\n', you'll have to add it explicitly (as in the examples above).
+
+
+// This is a marker type only used with MacroAssemblerPrinter::print().
+// See MacroAssemblerPrinter::print() below for details.
+struct AllRegisters { };
+
+class MacroAssemblerPrinter {
+    using CPUState = MacroAssembler::CPUState;
+    using ProbeContext = MacroAssembler::ProbeContext;
+    using RegisterID = MacroAssembler::RegisterID;
+    using FPRegisterID = MacroAssembler::FPRegisterID;
+    
+public:
+    template&lt;typename... Arguments&gt;
+    static void print(MacroAssembler* masm, Arguments... args)
+    {
+        auto argsList = std::make_unique&lt;PrintArgsList&gt;();
+        appendPrintArg(argsList.get(), args...);
+        masm-&gt;probe(printCallback, argsList.release());
+    }
+    
+private:
+    struct PrintArg {
+
+        enum class Type {
+            AllRegisters,
+            RegisterID,
+            FPRegisterID,
+            ConstCharPtr,
+            ConstVoidPtr,
+            IntptrValue,
+            UintptrValue,
+        };
+        
+        PrintArg(AllRegisters&amp;)
+            : type(Type::AllRegisters)
+        {
+        }
+        
+        PrintArg(RegisterID regID)
+            : type(Type::RegisterID)
+        {
+            u.gpRegisterID = regID;
+        }
+        
+        PrintArg(FPRegisterID regID)
+            : type(Type::FPRegisterID)
+        {
+            u.fpRegisterID = regID;
+        }
+        
+        PrintArg(const char* ptr)
+            : type(Type::ConstCharPtr)
+        {
+            u.constCharPtr = ptr;
+        }
+        
+        PrintArg(const void* ptr)
+            : type(Type::ConstVoidPtr)
+        {
+            u.constVoidPtr = ptr;
+        }
+        
+        PrintArg(int value)
+            : type(Type::IntptrValue)
+        {
+            u.intptrValue = value;
+        }
+        
+        PrintArg(unsigned value)
+            : type(Type::UintptrValue)
+        {
+            u.intptrValue = value;
+        }
+        
+        PrintArg(intptr_t value)
+            : type(Type::IntptrValue)
+        {
+            u.intptrValue = value;
+        }
+        
+        PrintArg(uintptr_t value)
+            : type(Type::UintptrValue)
+        {
+            u.uintptrValue = value;
+        }
+        
+        Type type;
+        union {
+            RegisterID gpRegisterID;
+            FPRegisterID fpRegisterID;
+            const char* constCharPtr;
+            const void* constVoidPtr;
+            intptr_t intptrValue;
+            uintptr_t uintptrValue;
+        } u;
+    };
+
+    typedef Vector&lt;PrintArg&gt; PrintArgsList;
+    
+    template&lt;typename FirstArg, typename... Arguments&gt;
+    static void appendPrintArg(PrintArgsList* argsList, FirstArg&amp; firstArg, Arguments... otherArgs)
+    {
+        argsList-&gt;append(PrintArg(firstArg));
+        appendPrintArg(argsList, otherArgs...);
+    }
+    
+    static void appendPrintArg(PrintArgsList*) { }
+
+private:
+    static void printCallback(ProbeContext*);
+};
+
+template&lt;typename... Arguments&gt;
+void MacroAssembler::print(Arguments... args)
+{
+    MacroAssemblerPrinter::print(this, args...);
+}
+
+} // namespace JSC
+
+#endif // ENABLE(MASM_PROBE)
+
+#endif // MacroAssemblerPrinter_h
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerX86Commoncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.cpp        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -32,58 +32,6 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MASM_PROBE)
</span><span class="cx"> 
</span><del>-#define INDENT printIndent(indentation)
-
-void MacroAssemblerX86Common::printCPURegisters(MacroAssemblerX86Common::CPUState&amp; cpu, int indentation)
-{
-#if CPU(X86)
-    #define PRINT_GPREGISTER(_type, _regName) { \
-        int32_t value = reinterpret_cast&lt;int32_t&gt;(cpu._regName); \
-        INDENT, dataLogF(&quot;%6s: 0x%08x  %d\n&quot;, #_regName, value, value) ; \
-    }
-#elif CPU(X86_64)
-    #define PRINT_GPREGISTER(_type, _regName) { \
-        int64_t value = reinterpret_cast&lt;int64_t&gt;(cpu._regName); \
-        INDENT, dataLogF(&quot;%6s: 0x%016llx  %lld\n&quot;, #_regName, value, value) ; \
-    }
-#endif
-    FOR_EACH_CPU_GPREGISTER(PRINT_GPREGISTER)
-    FOR_EACH_CPU_SPECIAL_REGISTER(PRINT_GPREGISTER)
-    #undef PRINT_GPREGISTER
-
-    #define PRINT_FPREGISTER(_type, _regName) { \
-        uint64_t* u = reinterpret_cast&lt;uint64_t*&gt;(&amp;cpu._regName); \
-        double* d = reinterpret_cast&lt;double*&gt;(&amp;cpu._regName); \
-        INDENT, dataLogF(&quot;%6s: 0x%016llx  %.13g\n&quot;, #_regName, *u, *d); \
-    }
-    FOR_EACH_CPU_FPREGISTER(PRINT_FPREGISTER)
-    #undef PRINT_FPREGISTER
-}
-
-#undef INDENT
-
-void MacroAssemblerX86Common::printRegister(MacroAssemblerX86Common::CPUState&amp; cpu, RegisterID regID)
-{
-    const char* name = CPUState::registerName(regID);
-    union {
-        void* voidPtr;
-        intptr_t intptrValue;
-    } u;
-    u.voidPtr = cpu.registerValue(regID);
-    dataLogF(&quot;%s:&lt;%p %ld&gt;&quot;, name, u.voidPtr, u.intptrValue);
-}
-
-void MacroAssemblerX86Common::printRegister(MacroAssemblerX86Common::CPUState&amp; cpu, FPRegisterID regID)
-{
-    const char* name = CPUState::registerName(regID);
-    union {
-        double doubleValue;
-        uint64_t uint64Value;
-    } u;
-    u.doubleValue = cpu.registerValue(regID);
-    dataLogF(&quot;%s:&lt;0x%016llx %.13g&gt;&quot;, name, u.uint64Value, u.doubleValue);
-}
-
</del><span class="cx"> extern &quot;C&quot; void ctiMasmProbeTrampoline();
</span><span class="cx"> 
</span><span class="cx"> // What code is emitted for the probe?
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreassemblerMacroAssemblerX86Commonh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h (189129 => 189130)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h        2015-08-28 22:57:01 UTC (rev 189129)
+++ trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h        2015-08-28 22:58:48 UTC (rev 189130)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2008, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2008, 2014-2015 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -1491,11 +1491,6 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(MASM_PROBE)
</span><del>-    // Methods required by the MASM_PROBE mechanism as defined in
-    // AbstractMacroAssembler.h. 
-    static void printCPURegisters(CPUState&amp;, int indentation = 0);
-    static void printRegister(CPUState&amp;, RegisterID);
-    static void printRegister(CPUState&amp;, FPRegisterID);
</del><span class="cx">     void probe(ProbeFunction, void* arg1 = 0, void* arg2 = 0);
</span><span class="cx"> #endif // ENABLE(MASM_PROBE)
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>