Title: [136357] trunk/Source
Revision
136357
Author
[email protected]
Date
2012-12-02 17:59:42 -0800 (Sun, 02 Dec 2012)

Log Message

It should be possible to build and run with DFG_ENABLE(PROPAGATION_VERBOSE)
https://bugs.webkit.org/show_bug.cgi?id=103848

Reviewed by Sam Weinig.

Source/_javascript_Core: 

Fix random dataLog() and print() statements.

* dfg/DFGArgumentsSimplificationPhase.cpp:
(JSC::DFG::ArgumentsSimplificationPhase::run):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::parseCodeBlock):
* dfg/DFGGraph.cpp:
(JSC::DFG::Graph::dumpBlockHeader):
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::propagate):
* dfg/DFGStructureCheckHoistingPhase.cpp:
(JSC::DFG::StructureCheckHoistingPhase::run):

Source/WTF: 

Increase the variadicity of dataLog() and print(), and add a pointerDump()
which allows passing a pointer to something that has a printInternal(). If
the pointer is null, it'll print "(null)"; otherwise it'll invoke the
printInternal() function.

* wtf/DataLog.h:
(WTF):
(WTF::dataLog):
* wtf/PrintStream.h:
(PrintStream):
(WTF::PrintStream::print):
(WTF):
(PointerDump):
(WTF::PointerDump::PointerDump):
(WTF::PointerDump::dump):
(WTF::pointerDump):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (136356 => 136357)


--- trunk/Source/_javascript_Core/ChangeLog	2012-12-03 01:46:27 UTC (rev 136356)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-12-03 01:59:42 UTC (rev 136357)
@@ -1,3 +1,23 @@
+2012-12-02  Filip Pizlo  <[email protected]>
+
+        It should be possible to build and run with DFG_ENABLE(PROPAGATION_VERBOSE)
+        https://bugs.webkit.org/show_bug.cgi?id=103848
+
+        Reviewed by Sam Weinig.
+
+        Fix random dataLog() and print() statements.
+
+        * dfg/DFGArgumentsSimplificationPhase.cpp:
+        (JSC::DFG::ArgumentsSimplificationPhase::run):
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::parseCodeBlock):
+        * dfg/DFGGraph.cpp:
+        (JSC::DFG::Graph::dumpBlockHeader):
+        * dfg/DFGPredictionPropagationPhase.cpp:
+        (JSC::DFG::PredictionPropagationPhase::propagate):
+        * dfg/DFGStructureCheckHoistingPhase.cpp:
+        (JSC::DFG::StructureCheckHoistingPhase::run):
+
 2012-12-01  Filip Pizlo  <[email protected]>
 
         CodeBlock should be able to dump bytecode to something other than WTF::dataFile()

Modified: trunk/Source/_javascript_Core/dfg/DFGArgumentsSimplificationPhase.cpp (136356 => 136357)


--- trunk/Source/_javascript_Core/dfg/DFGArgumentsSimplificationPhase.cpp	2012-12-03 01:46:27 UTC (rev 136356)
+++ trunk/Source/_javascript_Core/dfg/DFGArgumentsSimplificationPhase.cpp	2012-12-03 01:59:42 UTC (rev 136357)
@@ -34,6 +34,7 @@
 #include "DFGInsertionSet.h"
 #include "DFGPhase.h"
 #include "DFGValidate.h"
+#include "DFGVariableAccessDataDump.h"
 #include <wtf/HashSet.h>
 #include <wtf/HashMap.h>
 
@@ -364,7 +365,7 @@
             VariableAccessData* variableAccessData = &m_graph.m_variableAccessData[i];
             if (!variableAccessData->isRoot())
                 continue;
-            dataLogF("   r%d(%s): ", variableAccessData->local(), m_graph.nameOfVariableAccessData(variableAccessData));
+            dataLog("   r", variableAccessData->local(), "(", VariableAccessDataDump(m_graph, variableAccessData), "): ");
             if (variableAccessData->isCaptured())
                 dataLogF("Captured");
             else {

Modified: trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp (136356 => 136357)


--- trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2012-12-03 01:46:27 UTC (rev 136356)
+++ trunk/Source/_javascript_Core/dfg/DFGByteCodeParser.cpp	2012-12-03 01:59:42 UTC (rev 136357)
@@ -3669,7 +3669,7 @@
         unsigned limit = jumpTargetIndex < codeBlock->numberOfJumpTargets() ? codeBlock->jumpTarget(jumpTargetIndex) : codeBlock->instructions().size();
 #if DFG_ENABLE(DEBUG_VERBOSE)
         dataLog(
-            "Parsing bytecode with limit ", m_inlineStackTop->m_inlineCallFrame->hash(),
+            "Parsing bytecode with limit ", pointerDump(m_inlineStackTop->m_inlineCallFrame),
             " bc#", limit, " at inline depth ",
             CodeOrigin::inlineDepthForCallFrame(m_inlineStackTop->m_inlineCallFrame), ".\n");
 #endif

Modified: trunk/Source/_javascript_Core/dfg/DFGGraph.cpp (136356 => 136357)


--- trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2012-12-03 01:46:27 UTC (rev 136356)
+++ trunk/Source/_javascript_Core/dfg/DFGGraph.cpp	2012-12-03 01:59:42 UTC (rev 136357)
@@ -321,7 +321,7 @@
         Node& phiNode = at(phiNodeIndex);
         if (!phiNode.shouldGenerate() && phiNodeDumpMode == DumpLivePhisOnly)
             continue;
-        out.print(" @", phiNodeIndex, "->(");
+        out.print(" @", phiNodeIndex, "<", phiNode.refCount(), ">->(");
         if (phiNode.child1()) {
             out.print("@", phiNode.child1().index());
             if (phiNode.child2()) {

Modified: trunk/Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp (136356 => 136357)


--- trunk/Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp	2012-12-03 01:46:27 UTC (rev 136356)
+++ trunk/Source/_javascript_Core/dfg/DFGPredictionPropagationPhase.cpp	2012-12-03 01:59:42 UTC (rev 136357)
@@ -784,7 +784,7 @@
         }
 
 #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE)
-        dataLogF("%s\n", speculationToString(m_graph[m_compileIndex].prediction()));
+        dataLog(SpeculationDump(m_graph[m_compileIndex].prediction()), "\n");
 #endif
         
         m_changed |= changed;

Modified: trunk/Source/_javascript_Core/dfg/DFGStructureCheckHoistingPhase.cpp (136356 => 136357)


--- trunk/Source/_javascript_Core/dfg/DFGStructureCheckHoistingPhase.cpp	2012-12-03 01:46:27 UTC (rev 136356)
+++ trunk/Source/_javascript_Core/dfg/DFGStructureCheckHoistingPhase.cpp	2012-12-03 01:59:42 UTC (rev 136357)
@@ -32,6 +32,7 @@
 #include "DFGGraph.h"
 #include "DFGInsertionSet.h"
 #include "DFGPhase.h"
+#include "DFGVariableAccessDataDump.h"
 #include <wtf/HashMap.h>
 
 namespace JSC { namespace DFG {
@@ -167,8 +168,9 @@
             if (iter == m_map.end())
                 continue;
 #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE)
-            dataLogF("Zeroing the structure to hoist for %s because the ratio is %lf.\n",
-                    m_graph.nameOfVariableAccessData(variable), variable->voteRatio());
+            dataLog(
+                "Zeroing the structure to hoist for ", VariableAccessDataDump(m_graph, variable),
+                " because the ratio is ", variable->voteRatio(), ".\n");
 #endif
             iter->value.m_structure = 0;
         }
@@ -200,16 +202,20 @@
                 JSValue value = m_graph.m_mustHandleValues[i];
                 if (!value || !value.isCell()) {
 #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE)
-                    dataLogF("Zeroing the structure to hoist for %s because the OSR entry value is not a cell: %s.\n",
-                            m_graph.nameOfVariableAccessData(variable), value.description());
+                    dataLog(
+                        "Zeroing the structure to hoist for ", VariableAccessDataDump(m_graph, variable),
+                        " because the OSR entry value is not a cell: ", value.description(), ".\n");
 #endif
                     iter->value.m_structure = 0;
                     continue;
                 }
                 if (value.asCell()->structure() != iter->value.m_structure) {
 #if DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE)
-                    dataLogF("Zeroing the structure to hoist for %s because the OSR entry value has structure %p and we wanted %p.\n",
-                            m_graph.nameOfVariableAccessData(variable), value.asCell()->structure(), iter->value.m_structure);
+                    dataLog(
+                        "Zeroing the structure to hoist for ", VariableAccessDataDump(m_graph, variable),
+                        " because the OSR entry value has structure ",
+                        RawPointer(value.asCell()->structure()), " and we wanted ",
+                        RawPointer(iter->value.m_structure), ".\n");
 #endif
                     iter->value.m_structure = 0;
                     continue;
@@ -223,10 +229,12 @@
         for (HashMap<VariableAccessData*, CheckData>::iterator it = m_map.begin();
              it != m_map.end(); ++it) {
             if (!it->value.m_structure) {
-                dataLogF("Not hoisting checks for %s because of heuristics.\n", m_graph.nameOfVariableAccessData(it->key));
+                dataLog(
+                    "Not hoisting checks for ", VariableAccessDataDump(m_graph, it->key),
+                    " because of heuristics.\n");
                 continue;
             }
-            dataLogF("Hoisting checks for %s\n", m_graph.nameOfVariableAccessData(it->key));
+            dataLog("Hoisting checks for ", VariableAccessDataDump(m_graph, it->key), "\n");
         }
 #endif // DFG_ENABLE(DEBUG_PROPAGATION_VERBOSE)
         

Modified: trunk/Source/WTF/ChangeLog (136356 => 136357)


--- trunk/Source/WTF/ChangeLog	2012-12-03 01:46:27 UTC (rev 136356)
+++ trunk/Source/WTF/ChangeLog	2012-12-03 01:59:42 UTC (rev 136357)
@@ -1,3 +1,27 @@
+2012-12-02  Filip Pizlo  <[email protected]>
+
+        It should be possible to build and run with DFG_ENABLE(PROPAGATION_VERBOSE)
+        https://bugs.webkit.org/show_bug.cgi?id=103848
+
+        Reviewed by Sam Weinig.
+
+        Increase the variadicity of dataLog() and print(), and add a pointerDump()
+        which allows passing a pointer to something that has a printInternal(). If
+        the pointer is null, it'll print "(null)"; otherwise it'll invoke the
+        printInternal() function.
+
+        * wtf/DataLog.h:
+        (WTF):
+        (WTF::dataLog):
+        * wtf/PrintStream.h:
+        (PrintStream):
+        (WTF::PrintStream::print):
+        (WTF):
+        (PointerDump):
+        (WTF::PointerDump::PointerDump):
+        (WTF::PointerDump::dump):
+        (WTF::pointerDump):
+
 2012-11-30  Simon Hausmann  <[email protected]>, Pierre Rossi  <[email protected]>
 
         [Qt] Separate Qt WebKit into Qt WebKit and Qt WebKit Widgets

Modified: trunk/Source/WTF/wtf/DataLog.h (136356 => 136357)


--- trunk/Source/WTF/wtf/DataLog.h	2012-12-03 01:46:27 UTC (rev 136356)
+++ trunk/Source/WTF/wtf/DataLog.h	2012-12-03 01:59:42 UTC (rev 136357)
@@ -100,6 +100,24 @@
     dataFile().print(value1, value2, value3, value4, value5, value6, value7, value8, value9, value10);
 }
 
+template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
+void dataLog(const T1& value1, const T2& value2, const T3& value3, const T4& value4, const T5& value5, const T6& value6, const T7& value7, const T8& value8, const T9& value9, const T10& value10, const T11& value11)
+{
+    dataFile().print(value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11);
+}
+
+template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
+void dataLog(const T1& value1, const T2& value2, const T3& value3, const T4& value4, const T5& value5, const T6& value6, const T7& value7, const T8& value8, const T9& value9, const T10& value10, const T11& value11, const T12& value12)
+{
+    dataFile().print(value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12);
+}
+
+template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
+void dataLog(const T1& value1, const T2& value2, const T3& value3, const T4& value4, const T5& value5, const T6& value6, const T7& value7, const T8& value8, const T9& value9, const T10& value10, const T11& value11, const T12& value12, const T13& value13)
+{
+    dataFile().print(value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13);
+}
+
 } // namespace WTF
 
 using WTF::dataLog;

Modified: trunk/Source/WTF/wtf/PrintStream.h (136356 => 136357)


--- trunk/Source/WTF/wtf/PrintStream.h	2012-12-03 01:46:27 UTC (rev 136356)
+++ trunk/Source/WTF/wtf/PrintStream.h	2012-12-03 01:59:42 UTC (rev 136357)
@@ -155,6 +155,57 @@
         print(value9);
         print(value10);
     }
+    
+    template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
+    void print(const T1& value1, const T2& value2, const T3& value3, const T4& value4, const T5& value5, const T6& value6, const T7& value7, const T8& value8, const T9& value9, const T10& value10, const T11& value11)
+    {
+        print(value1);
+        print(value2);
+        print(value3);
+        print(value4);
+        print(value5);
+        print(value6);
+        print(value7);
+        print(value8);
+        print(value9);
+        print(value10);
+        print(value11);
+    }
+    
+    template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12>
+    void print(const T1& value1, const T2& value2, const T3& value3, const T4& value4, const T5& value5, const T6& value6, const T7& value7, const T8& value8, const T9& value9, const T10& value10, const T11& value11, const T12& value12)
+    {
+        print(value1);
+        print(value2);
+        print(value3);
+        print(value4);
+        print(value5);
+        print(value6);
+        print(value7);
+        print(value8);
+        print(value9);
+        print(value10);
+        print(value11);
+        print(value12);
+    }
+    
+    template<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11, typename T12, typename T13>
+    void print(const T1& value1, const T2& value2, const T3& value3, const T4& value4, const T5& value5, const T6& value6, const T7& value7, const T8& value8, const T9& value9, const T10& value10, const T11& value11, const T12& value12, const T13& value13)
+    {
+        print(value1);
+        print(value2);
+        print(value3);
+        print(value4);
+        print(value5);
+        print(value6);
+        print(value7);
+        print(value8);
+        print(value9);
+        print(value10);
+        print(value11);
+        print(value12);
+        print(value13);
+    }
 };
 
 void printInternal(PrintStream&, const char*);
@@ -216,10 +267,34 @@
 void dumpCharacter(PrintStream&, char);
 MAKE_PRINT_ADAPTOR(CharacterDump, char, dumpCharacter);
 
+template<typename T>
+class PointerDump {
+public:
+    PointerDump(const T* ptr)
+        : m_ptr(ptr)
+    {
+    }
+    
+    void dump(PrintStream& out) const
+    {
+        if (m_ptr)
+            printInternal(out, *m_ptr);
+        else
+            out.print("(null)");
+    }
+private:
+    const T* m_ptr;
+};
+
+template<typename T>
+PointerDump<T> pointerDump(const T* ptr) { return PointerDump<T>(ptr); }
+
 } // namespace WTF
 
 using WTF::CharacterDump;
+using WTF::PointerDump;
 using WTF::PrintStream;
+using WTF::pointerDump;
 
 #endif // PrintStream_h
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to