<!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>[151824] branches/dfgFourthTier/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/151824">151824</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2013-06-20 21:21:54 -0700 (Thu, 20 Jun 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>fourthTier: Structure should have a dump()
https://bugs.webkit.org/show_bug.cgi?id=117859

Reviewed by Geoffrey Garen.
        
This is pretty cool. Anywhere we previously printed Structure pointers in dumps,
we now print a bunch of other info as well. For example, for an object literal
like &quot;{f:42, g:64, h:24}&quot;, when we print the structure we'll now get:

    0x107a0af80:[Object, {f:0, g:1, h:2}, NonArray, Proto:0x107a8fff0]
        
This also changes a bunch of places to use the dump method.

* bytecode/StructureSet.h:
(JSC::StructureSet::dump):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dump):
* dfg/DFGStructureAbstractValue.h:
(JSC::DFG::StructureAbstractValue::dump):
* runtime/JSCJSValue.cpp:
(JSC::JSValue::dump):
* runtime/Structure.cpp:
(JSC::Structure::dump):
(JSC):
* runtime/Structure.h:
(Structure):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesdfgFourthTierSourceJavaScriptCoreChangeLog">branches/dfgFourthTier/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchesdfgFourthTierSourceJavaScriptCorebytecodeStructureSeth">branches/dfgFourthTier/Source/JavaScriptCore/bytecode/StructureSet.h</a></li>
<li><a href="#branchesdfgFourthTierSourceJavaScriptCoredfgDFGGraphcpp">branches/dfgFourthTier/Source/JavaScriptCore/dfg/DFGGraph.cpp</a></li>
<li><a href="#branchesdfgFourthTierSourceJavaScriptCoredfgDFGStructureAbstractValueh">branches/dfgFourthTier/Source/JavaScriptCore/dfg/DFGStructureAbstractValue.h</a></li>
<li><a href="#branchesdfgFourthTierSourceJavaScriptCoreruntimeJSCJSValuecpp">branches/dfgFourthTier/Source/JavaScriptCore/runtime/JSCJSValue.cpp</a></li>
<li><a href="#branchesdfgFourthTierSourceJavaScriptCoreruntimeStructurecpp">branches/dfgFourthTier/Source/JavaScriptCore/runtime/Structure.cpp</a></li>
<li><a href="#branchesdfgFourthTierSourceJavaScriptCoreruntimeStructureh">branches/dfgFourthTier/Source/JavaScriptCore/runtime/Structure.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesdfgFourthTierSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/dfgFourthTier/Source/JavaScriptCore/ChangeLog (151823 => 151824)</h4>
<pre class="diff"><span>
<span class="info">--- branches/dfgFourthTier/Source/JavaScriptCore/ChangeLog        2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/JavaScriptCore/ChangeLog        2013-06-21 04:21:54 UTC (rev 151824)
</span><span class="lines">@@ -1,5 +1,34 @@
</span><span class="cx"> 2013-06-20  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        fourthTier: Structure should have a dump()
+        https://bugs.webkit.org/show_bug.cgi?id=117859
+
+        Reviewed by Geoffrey Garen.
+        
+        This is pretty cool. Anywhere we previously printed Structure pointers in dumps,
+        we now print a bunch of other info as well. For example, for an object literal
+        like &quot;{f:42, g:64, h:24}&quot;, when we print the structure we'll now get:
+
+            0x107a0af80:[Object, {f:0, g:1, h:2}, NonArray, Proto:0x107a8fff0]
+        
+        This also changes a bunch of places to use the dump method.
+
+        * bytecode/StructureSet.h:
+        (JSC::StructureSet::dump):
+        * dfg/DFGGraph.cpp:
+        (JSC::DFG::Graph::dump):
+        * dfg/DFGStructureAbstractValue.h:
+        (JSC::DFG::StructureAbstractValue::dump):
+        * runtime/JSCJSValue.cpp:
+        (JSC::JSValue::dump):
+        * runtime/Structure.cpp:
+        (JSC::Structure::dump):
+        (JSC):
+        * runtime/Structure.h:
+        (Structure):
+
+2013-06-20  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
</ins><span class="cx">         fourthTier: There should only be one table of SimpleJumpTables
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=117856
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesdfgFourthTierSourceJavaScriptCorebytecodeStructureSeth"></a>
<div class="modfile"><h4>Modified: branches/dfgFourthTier/Source/JavaScriptCore/bytecode/StructureSet.h (151823 => 151824)</h4>
<pre class="diff"><span>
<span class="info">--- branches/dfgFourthTier/Source/JavaScriptCore/bytecode/StructureSet.h        2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/JavaScriptCore/bytecode/StructureSet.h        2013-06-21 04:21:54 UTC (rev 151824)
</span><span class="lines">@@ -167,7 +167,7 @@
</span><span class="cx">         CommaPrinter comma;
</span><span class="cx">         out.print(&quot;[&quot;);
</span><span class="cx">         for (size_t i = 0; i &lt; m_structures.size(); ++i)
</span><del>-            out.print(comma, RawPointer(m_structures[i]));
</del><ins>+            out.print(comma, *m_structures[i]);
</ins><span class="cx">         out.print(&quot;]&quot;);
</span><span class="cx">     }
</span><span class="cx">     
</span></span></pre></div>
<a id="branchesdfgFourthTierSourceJavaScriptCoredfgDFGGraphcpp"></a>
<div class="modfile"><h4>Modified: branches/dfgFourthTier/Source/JavaScriptCore/dfg/DFGGraph.cpp (151823 => 151824)</h4>
<pre class="diff"><span>
<span class="info">--- branches/dfgFourthTier/Source/JavaScriptCore/dfg/DFGGraph.cpp        2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/JavaScriptCore/dfg/DFGGraph.cpp        2013-06-21 04:21:54 UTC (rev 151824)
</span><span class="lines">@@ -187,14 +187,12 @@
</span><span class="cx">         out.print(comma, &quot;global&quot;, globalObjectFor(node-&gt;codeOrigin)-&gt;findRegisterIndex(node-&gt;registerPointer()), &quot;(&quot;, RawPointer(node-&gt;registerPointer()), &quot;)&quot;);
</span><span class="cx">     if (node-&gt;hasIdentifier())
</span><span class="cx">         out.print(comma, &quot;id&quot;, node-&gt;identifierNumber(), &quot;{&quot;, identifiers()[node-&gt;identifierNumber()], &quot;}&quot;);
</span><del>-    if (node-&gt;hasStructureSet()) {
-        for (size_t i = 0; i &lt; node-&gt;structureSet().size(); ++i)
-            out.print(comma, &quot;struct(&quot;, RawPointer(node-&gt;structureSet()[i]), &quot;: &quot;, IndexingTypeDump(node-&gt;structureSet()[i]-&gt;indexingType()), &quot;)&quot;);
-    }
</del><ins>+    if (node-&gt;hasStructureSet())
+        out.print(comma, node-&gt;structureSet());
</ins><span class="cx">     if (node-&gt;hasStructure())
</span><del>-        out.print(comma, &quot;struct(&quot;, RawPointer(node-&gt;structure()), &quot;: &quot;, IndexingTypeDump(node-&gt;structure()-&gt;indexingType()), &quot;)&quot;);
</del><ins>+        out.print(comma, *node-&gt;structure());
</ins><span class="cx">     if (node-&gt;hasStructureTransitionData())
</span><del>-        out.print(comma, &quot;struct(&quot;, RawPointer(node-&gt;structureTransitionData().previousStructure), &quot; -&gt; &quot;, RawPointer(node-&gt;structureTransitionData().newStructure), &quot;)&quot;);
</del><ins>+        out.print(comma, *node-&gt;structureTransitionData().previousStructure, &quot; -&gt; &quot;, *node-&gt;structureTransitionData().newStructure);
</ins><span class="cx">     if (node-&gt;hasFunction()) {
</span><span class="cx">         out.print(comma, &quot;function(&quot;, RawPointer(node-&gt;function()), &quot;, &quot;);
</span><span class="cx">         if (node-&gt;function()-&gt;inherits(&amp;JSFunction::s_info)) {
</span><span class="lines">@@ -245,7 +243,7 @@
</span><span class="cx">         out.print(&quot; = &quot;, value);
</span><span class="cx">     }
</span><span class="cx">     if (op == WeakJSConstant)
</span><del>-        out.print(comma, RawPointer(node-&gt;weakConstant()), &quot; (structure: &quot;, RawPointer(node-&gt;weakConstant()-&gt;structure()), &quot;)&quot;);
</del><ins>+        out.print(comma, RawPointer(node-&gt;weakConstant()), &quot; (structure: &quot;, *node-&gt;weakConstant()-&gt;structure(), &quot;)&quot;);
</ins><span class="cx">     if (node-&gt;isBranch() || node-&gt;isJump())
</span><span class="cx">         out.print(comma, &quot;T:#&quot;, node-&gt;takenBlockIndex());
</span><span class="cx">     if (node-&gt;isBranch())
</span></span></pre></div>
<a id="branchesdfgFourthTierSourceJavaScriptCoredfgDFGStructureAbstractValueh"></a>
<div class="modfile"><h4>Modified: branches/dfgFourthTier/Source/JavaScriptCore/dfg/DFGStructureAbstractValue.h (151823 => 151824)</h4>
<pre class="diff"><span>
<span class="info">--- branches/dfgFourthTier/Source/JavaScriptCore/dfg/DFGStructureAbstractValue.h        2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/JavaScriptCore/dfg/DFGStructureAbstractValue.h        2013-06-21 04:21:54 UTC (rev 151824)
</span><span class="lines">@@ -307,7 +307,7 @@
</span><span class="cx">         
</span><span class="cx">         out.print(&quot;[&quot;);
</span><span class="cx">         if (m_structure)
</span><del>-            out.print(RawPointer(m_structure), &quot;(&quot;, m_structure-&gt;classInfo()-&gt;className, &quot;)&quot;);
</del><ins>+            out.print(*m_structure);
</ins><span class="cx">         out.print(&quot;]&quot;);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesdfgFourthTierSourceJavaScriptCoreruntimeJSCJSValuecpp"></a>
<div class="modfile"><h4>Modified: branches/dfgFourthTier/Source/JavaScriptCore/runtime/JSCJSValue.cpp (151823 => 151824)</h4>
<pre class="diff"><span>
<span class="info">--- branches/dfgFourthTier/Source/JavaScriptCore/runtime/JSCJSValue.cpp        2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/JavaScriptCore/runtime/JSCJSValue.cpp        2013-06-21 04:21:54 UTC (rev 151824)
</span><span class="lines">@@ -217,18 +217,13 @@
</span><span class="cx">             } else
</span><span class="cx">                 out.print(&quot; (unresolved)&quot;);
</span><span class="cx">             out.print(&quot;: &quot;, impl);
</span><del>-        } else if (asCell()-&gt;inherits(&amp;Structure::s_info)) {
-            Structure* structure = jsCast&lt;Structure*&gt;(asCell());
-            out.print(
-                &quot;Structure: &quot;, RawPointer(structure), &quot;: &quot;, structure-&gt;classInfo()-&gt;className,
-                &quot;, &quot;, IndexingTypeDump(structure-&gt;indexingTypeIncludingHistory()));
-        } else {
</del><ins>+        } else if (asCell()-&gt;inherits(&amp;Structure::s_info))
+            out.print(&quot;Structure: &quot;, *jsCast&lt;Structure*&gt;(asCell()));
+        else {
</ins><span class="cx">             out.print(&quot;Cell: &quot;, RawPointer(asCell()));
</span><span class="cx">             if (isObject() &amp;&amp; asObject(*this)-&gt;butterfly())
</span><span class="cx">                 out.print(&quot;-&gt;&quot;, RawPointer(asObject(*this)-&gt;butterfly()));
</span><del>-            out.print(
-                &quot; (&quot;, RawPointer(asCell()-&gt;structure()), &quot;: &quot;, asCell()-&gt;structure()-&gt;classInfo()-&gt;className,
-                &quot;, &quot;, IndexingTypeDump(asCell()-&gt;structure()-&gt;indexingTypeIncludingHistory()), &quot;)&quot;);
</del><ins>+            out.print(&quot; (&quot;, *asCell()-&gt;structure(), &quot;)&quot;);
</ins><span class="cx">         }
</span><span class="cx">     } else if (isTrue())
</span><span class="cx">         out.print(&quot;True&quot;);
</span></span></pre></div>
<a id="branchesdfgFourthTierSourceJavaScriptCoreruntimeStructurecpp"></a>
<div class="modfile"><h4>Modified: branches/dfgFourthTier/Source/JavaScriptCore/runtime/Structure.cpp (151823 => 151824)</h4>
<pre class="diff"><span>
<span class="info">--- branches/dfgFourthTier/Source/JavaScriptCore/runtime/Structure.cpp        2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/JavaScriptCore/runtime/Structure.cpp        2013-06-21 04:21:54 UTC (rev 151824)
</span><span class="lines">@@ -996,6 +996,43 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Structure::dump(PrintStream&amp; out) const
+{
+    out.print(RawPointer(this), &quot;:[&quot;, classInfo()-&gt;className, &quot;, {&quot;);
+    
+    Vector&lt;Structure*, 8&gt; structures;
+    Structure* structure;
+    PropertyTable* table;
+    
+    const_cast&lt;Structure*&gt;(this)-&gt;findStructuresAndMapForMaterialization(
+        structures, structure, table);
+    
+    CommaPrinter comma;
+    
+    if (table) {
+        PropertyTable::iterator iter = table-&gt;begin();
+        PropertyTable::iterator end = table-&gt;end();
+        for (; iter != end; ++iter)
+            out.print(comma, iter-&gt;key, &quot;:&quot;, static_cast&lt;int&gt;(iter-&gt;offset));
+        
+        structure-&gt;m_lock.unlock();
+    }
+    
+    for (unsigned i = structures.size(); i--;) {
+        Structure* structure = structures[i];
+        if (!structure-&gt;m_nameInPrevious)
+            continue;
+        out.print(comma, structure-&gt;m_nameInPrevious.get(), &quot;:&quot;, static_cast&lt;int&gt;(structure-&gt;m_offset));
+    }
+    
+    out.print(&quot;}, &quot;, IndexingTypeDump(indexingType()));
+    
+    if (m_prototype.get().isCell())
+        out.print(&quot;, Proto:&quot;, RawPointer(m_prototype.get().asCell()));
+    
+    out.print(&quot;]&quot;);
+}
+
</ins><span class="cx"> #if DO_PROPERTYMAP_CONSTENCY_CHECK
</span><span class="cx"> 
</span><span class="cx"> void PropertyTable::checkConsistency()
</span></span></pre></div>
<a id="branchesdfgFourthTierSourceJavaScriptCoreruntimeStructureh"></a>
<div class="modfile"><h4>Modified: branches/dfgFourthTier/Source/JavaScriptCore/runtime/Structure.h (151823 => 151824)</h4>
<pre class="diff"><span>
<span class="info">--- branches/dfgFourthTier/Source/JavaScriptCore/runtime/Structure.h        2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/JavaScriptCore/runtime/Structure.h        2013-06-21 04:21:54 UTC (rev 151824)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> #include &quot;Weak.h&quot;
</span><span class="cx"> #include &lt;wtf/CompilationThread.h&gt;
</span><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><ins>+#include &lt;wtf/PrintStream.h&gt;
</ins><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringImpl.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -355,7 +356,9 @@
</span><span class="cx">     {
</span><span class="cx">         return m_transitionWatchpointSet;
</span><span class="cx">     }
</span><del>-        
</del><ins>+    
+    void dump(PrintStream&amp;) const;
+    
</ins><span class="cx">     static JS_EXPORTDATA const ClassInfo s_info;
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre>
</div>
</div>

</body>
</html>