Title: [151824] branches/dfgFourthTier/Source/_javascript_Core
Revision
151824
Author
[email protected]
Date
2013-06-20 21:21:54 -0700 (Thu, 20 Jun 2013)

Log Message

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 "{f:42, g:64, h:24}", 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):

Modified Paths

Diff

Modified: branches/dfgFourthTier/Source/_javascript_Core/ChangeLog (151823 => 151824)


--- branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-06-21 04:21:54 UTC (rev 151824)
@@ -1,5 +1,34 @@
 2013-06-20  Filip Pizlo  <[email protected]>
 
+        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 "{f:42, g:64, h:24}", 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  <[email protected]>
+
         fourthTier: There should only be one table of SimpleJumpTables
         https://bugs.webkit.org/show_bug.cgi?id=117856
 

Modified: branches/dfgFourthTier/Source/_javascript_Core/bytecode/StructureSet.h (151823 => 151824)


--- branches/dfgFourthTier/Source/_javascript_Core/bytecode/StructureSet.h	2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/_javascript_Core/bytecode/StructureSet.h	2013-06-21 04:21:54 UTC (rev 151824)
@@ -167,7 +167,7 @@
         CommaPrinter comma;
         out.print("[");
         for (size_t i = 0; i < m_structures.size(); ++i)
-            out.print(comma, RawPointer(m_structures[i]));
+            out.print(comma, *m_structures[i]);
         out.print("]");
     }
     

Modified: branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGGraph.cpp (151823 => 151824)


--- branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGGraph.cpp	2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGGraph.cpp	2013-06-21 04:21:54 UTC (rev 151824)
@@ -187,14 +187,12 @@
         out.print(comma, "global", globalObjectFor(node->codeOrigin)->findRegisterIndex(node->registerPointer()), "(", RawPointer(node->registerPointer()), ")");
     if (node->hasIdentifier())
         out.print(comma, "id", node->identifierNumber(), "{", identifiers()[node->identifierNumber()], "}");
-    if (node->hasStructureSet()) {
-        for (size_t i = 0; i < node->structureSet().size(); ++i)
-            out.print(comma, "struct(", RawPointer(node->structureSet()[i]), ": ", IndexingTypeDump(node->structureSet()[i]->indexingType()), ")");
-    }
+    if (node->hasStructureSet())
+        out.print(comma, node->structureSet());
     if (node->hasStructure())
-        out.print(comma, "struct(", RawPointer(node->structure()), ": ", IndexingTypeDump(node->structure()->indexingType()), ")");
+        out.print(comma, *node->structure());
     if (node->hasStructureTransitionData())
-        out.print(comma, "struct(", RawPointer(node->structureTransitionData().previousStructure), " -> ", RawPointer(node->structureTransitionData().newStructure), ")");
+        out.print(comma, *node->structureTransitionData().previousStructure, " -> ", *node->structureTransitionData().newStructure);
     if (node->hasFunction()) {
         out.print(comma, "function(", RawPointer(node->function()), ", ");
         if (node->function()->inherits(&JSFunction::s_info)) {
@@ -245,7 +243,7 @@
         out.print(" = ", value);
     }
     if (op == WeakJSConstant)
-        out.print(comma, RawPointer(node->weakConstant()), " (structure: ", RawPointer(node->weakConstant()->structure()), ")");
+        out.print(comma, RawPointer(node->weakConstant()), " (structure: ", *node->weakConstant()->structure(), ")");
     if (node->isBranch() || node->isJump())
         out.print(comma, "T:#", node->takenBlockIndex());
     if (node->isBranch())

Modified: branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGStructureAbstractValue.h (151823 => 151824)


--- branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGStructureAbstractValue.h	2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/_javascript_Core/dfg/DFGStructureAbstractValue.h	2013-06-21 04:21:54 UTC (rev 151824)
@@ -307,7 +307,7 @@
         
         out.print("[");
         if (m_structure)
-            out.print(RawPointer(m_structure), "(", m_structure->classInfo()->className, ")");
+            out.print(*m_structure);
         out.print("]");
     }
 

Modified: branches/dfgFourthTier/Source/_javascript_Core/runtime/JSCJSValue.cpp (151823 => 151824)


--- branches/dfgFourthTier/Source/_javascript_Core/runtime/JSCJSValue.cpp	2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/_javascript_Core/runtime/JSCJSValue.cpp	2013-06-21 04:21:54 UTC (rev 151824)
@@ -217,18 +217,13 @@
             } else
                 out.print(" (unresolved)");
             out.print(": ", impl);
-        } else if (asCell()->inherits(&Structure::s_info)) {
-            Structure* structure = jsCast<Structure*>(asCell());
-            out.print(
-                "Structure: ", RawPointer(structure), ": ", structure->classInfo()->className,
-                ", ", IndexingTypeDump(structure->indexingTypeIncludingHistory()));
-        } else {
+        } else if (asCell()->inherits(&Structure::s_info))
+            out.print("Structure: ", *jsCast<Structure*>(asCell()));
+        else {
             out.print("Cell: ", RawPointer(asCell()));
             if (isObject() && asObject(*this)->butterfly())
                 out.print("->", RawPointer(asObject(*this)->butterfly()));
-            out.print(
-                " (", RawPointer(asCell()->structure()), ": ", asCell()->structure()->classInfo()->className,
-                ", ", IndexingTypeDump(asCell()->structure()->indexingTypeIncludingHistory()), ")");
+            out.print(" (", *asCell()->structure(), ")");
         }
     } else if (isTrue())
         out.print("True");

Modified: branches/dfgFourthTier/Source/_javascript_Core/runtime/Structure.cpp (151823 => 151824)


--- branches/dfgFourthTier/Source/_javascript_Core/runtime/Structure.cpp	2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/_javascript_Core/runtime/Structure.cpp	2013-06-21 04:21:54 UTC (rev 151824)
@@ -996,6 +996,43 @@
     }
 }
 
+void Structure::dump(PrintStream& out) const
+{
+    out.print(RawPointer(this), ":[", classInfo()->className, ", {");
+    
+    Vector<Structure*, 8> structures;
+    Structure* structure;
+    PropertyTable* table;
+    
+    const_cast<Structure*>(this)->findStructuresAndMapForMaterialization(
+        structures, structure, table);
+    
+    CommaPrinter comma;
+    
+    if (table) {
+        PropertyTable::iterator iter = table->begin();
+        PropertyTable::iterator end = table->end();
+        for (; iter != end; ++iter)
+            out.print(comma, iter->key, ":", static_cast<int>(iter->offset));
+        
+        structure->m_lock.unlock();
+    }
+    
+    for (unsigned i = structures.size(); i--;) {
+        Structure* structure = structures[i];
+        if (!structure->m_nameInPrevious)
+            continue;
+        out.print(comma, structure->m_nameInPrevious.get(), ":", static_cast<int>(structure->m_offset));
+    }
+    
+    out.print("}, ", IndexingTypeDump(indexingType()));
+    
+    if (m_prototype.get().isCell())
+        out.print(", Proto:", RawPointer(m_prototype.get().asCell()));
+    
+    out.print("]");
+}
+
 #if DO_PROPERTYMAP_CONSTENCY_CHECK
 
 void PropertyTable::checkConsistency()

Modified: branches/dfgFourthTier/Source/_javascript_Core/runtime/Structure.h (151823 => 151824)


--- branches/dfgFourthTier/Source/_javascript_Core/runtime/Structure.h	2013-06-21 04:00:50 UTC (rev 151823)
+++ branches/dfgFourthTier/Source/_javascript_Core/runtime/Structure.h	2013-06-21 04:21:54 UTC (rev 151824)
@@ -43,6 +43,7 @@
 #include "Weak.h"
 #include <wtf/CompilationThread.h>
 #include <wtf/PassRefPtr.h>
+#include <wtf/PrintStream.h>
 #include <wtf/RefCounted.h>
 #include <wtf/text/StringImpl.h>
 
@@ -355,7 +356,9 @@
     {
         return m_transitionWatchpointSet;
     }
-        
+    
+    void dump(PrintStream&) const;
+    
     static JS_EXPORTDATA const ClassInfo s_info;
 
 private:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to