Title: [184958] trunk/Source/_javascript_Core
Revision
184958
Author
basile_clem...@apple.com
Date
2015-05-28 12:14:30 -0700 (Thu, 28 May 2015)

Log Message

Add debug mode assertions for accessors casting JSC::DFG::Node.m_opInfo
https://bugs.webkit.org/show_bug.cgi?id=145441

Reviewed by Filip Pizlo.

Most accessor functions casting m_opInfo in JSC::DFG::Node are
performing debug checks that they are only accessed for node types that
should have them. This patch adds similar checks for the accessors that
were missing them.

* dfg/DFGNode.h:
(JSC::DFG::Node::watchpointSet):
(JSC::DFG::Node::storagePointer):
(JSC::DFG::Node::multiGetByOffsetData):
(JSC::DFG::Node::multiPutByOffsetData):
(JSC::DFG::Node::hasTypeLocation):
(JSC::DFG::Node::typeLocation):
(JSC::DFG::Node::hasBasicBlockLocation):
(JSC::DFG::Node::basicBlockLocation):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (184957 => 184958)


--- trunk/Source/_javascript_Core/ChangeLog	2015-05-28 17:45:22 UTC (rev 184957)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-05-28 19:14:30 UTC (rev 184958)
@@ -1,3 +1,25 @@
+2015-05-28  Basile Clement  <basile_clem...@apple.com>
+
+        Add debug mode assertions for accessors casting JSC::DFG::Node.m_opInfo
+        https://bugs.webkit.org/show_bug.cgi?id=145441
+
+        Reviewed by Filip Pizlo.
+
+        Most accessor functions casting m_opInfo in JSC::DFG::Node are
+        performing debug checks that they are only accessed for node types that
+        should have them. This patch adds similar checks for the accessors that
+        were missing them.
+
+        * dfg/DFGNode.h:
+        (JSC::DFG::Node::watchpointSet):
+        (JSC::DFG::Node::storagePointer):
+        (JSC::DFG::Node::multiGetByOffsetData):
+        (JSC::DFG::Node::multiPutByOffsetData):
+        (JSC::DFG::Node::hasTypeLocation):
+        (JSC::DFG::Node::typeLocation):
+        (JSC::DFG::Node::hasBasicBlockLocation):
+        (JSC::DFG::Node::basicBlockLocation):
+
 2015-05-28  Matt Rajca  <mra...@apple.com>
 
         Add ENABLE_MEDIA_SESSION feature flag (which is off by default).

Modified: trunk/Source/_javascript_Core/dfg/DFGNode.h (184957 => 184958)


--- trunk/Source/_javascript_Core/dfg/DFGNode.h	2015-05-28 17:45:22 UTC (rev 184957)
+++ trunk/Source/_javascript_Core/dfg/DFGNode.h	2015-05-28 19:14:30 UTC (rev 184958)
@@ -1321,6 +1321,7 @@
     
     WatchpointSet* watchpointSet()
     {
+        ASSERT(hasWatchpointSet());
         return reinterpret_cast<WatchpointSet*>(m_opInfo);
     }
     
@@ -1331,6 +1332,7 @@
     
     void* storagePointer()
     {
+        ASSERT(hasStoragePointer());
         return reinterpret_cast<void*>(m_opInfo);
     }
 
@@ -1412,6 +1414,7 @@
     
     MultiGetByOffsetData& multiGetByOffsetData()
     {
+        ASSERT(hasMultiGetByOffsetData());
         return *reinterpret_cast<MultiGetByOffsetData*>(m_opInfo);
     }
     
@@ -1422,6 +1425,7 @@
     
     MultiPutByOffsetData& multiPutByOffsetData()
     {
+        ASSERT(hasMultiPutByOffsetData());
         return *reinterpret_cast<MultiPutByOffsetData*>(m_opInfo);
     }
     
@@ -1995,13 +1999,25 @@
         return canSpeculateInt52(sourceFor(pass));
     }
 
+    bool hasTypeLocation()
+    {
+        return op() == ProfileType;
+    }
+
     TypeLocation* typeLocation()
     {
+        ASSERT(hasTypeLocation());
         return reinterpret_cast<TypeLocation*>(m_opInfo);
     }
 
+    bool hasBasicBlockLocation()
+    {
+        return op() == ProfileControlFlow;
+    }
+
     BasicBlockLocation* basicBlockLocation()
     {
+        ASSERT(hasBasicBlockLocation());
         return reinterpret_cast<BasicBlockLocation*>(m_opInfo);
     }
     
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to