Crashing with information should have an abort reason
authorkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jul 2017 00:05:36 +0000 (00:05 +0000)
committerkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jul 2017 00:05:36 +0000 (00:05 +0000)
https://bugs.webkit.org/show_bug.cgi?id=174185

Reviewed by Saam Barati.

Source/JavaScriptCore:

Add crash information for the abstract interpreter and add an enum
value for object allocation sinking.

* assembler/AbortReason.h:
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::verifyEdge):
* dfg/DFGGraph.cpp:
(JSC::DFG::logDFGAssertionFailure):
* dfg/DFGObjectAllocationSinkingPhase.cpp:

Source/WTF:

Fix an ifdef to actually work with X86_64. It turns out X64_64 is
not an architecture... Whoops.

* wtf/Assertions.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219172 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/assembler/AbortReason.h
Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
Source/JavaScriptCore/dfg/DFGGraph.cpp
Source/JavaScriptCore/dfg/DFGObjectAllocationSinkingPhase.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/Assertions.cpp

index e3d5b5b..d00e545 100644 (file)
@@ -1,3 +1,20 @@
+2017-07-05  Keith Miller  <keith_miller@apple.com>
+
+        Crashing with information should have an abort reason
+        https://bugs.webkit.org/show_bug.cgi?id=174185
+
+        Reviewed by Saam Barati.
+
+        Add crash information for the abstract interpreter and add an enum
+        value for object allocation sinking.
+
+        * assembler/AbortReason.h:
+        * dfg/DFGAbstractInterpreterInlines.h:
+        (JSC::DFG::AbstractInterpreter<AbstractStateType>::verifyEdge):
+        * dfg/DFGGraph.cpp:
+        (JSC::DFG::logDFGAssertionFailure):
+        * dfg/DFGObjectAllocationSinkingPhase.cpp:
+
 2017-07-03  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Remove copy of ICU headers from WebKit
index 32ae086..4b7e766 100644 (file)
@@ -76,4 +76,12 @@ enum AbortReason {
     YARRNoInputConsumed                               = 340,
 };
 
+// This enum is for CRASH_WITH_SECURITY_IMPLICATION_AND_INFO so we can easily identify which assertion
+// we are looking at even if the calls to crash get coalesed. The same numbering rules above for
+// AbortReason apply here.
+enum CompilerAbortReason {
+    AbstractInterpreterInvalidType                =  10,
+    ObjectAllocationSinkingAssertionFailure       = 100,
+};
+
 } // namespace JSC
index c73a278..b8b1f38 100644 (file)
@@ -131,7 +131,7 @@ void AbstractInterpreter<AbstractStateType>::verifyEdge(Node* node, Edge edge)
     if (!(forNode(edge).m_type & ~typeFilterFor(edge.useKind())))
         return;
     
-    DFG_CRASH(m_graph, node, toCString("Edge verification error: ", node, "->", edge, " was expected to have type ", SpeculationDump(typeFilterFor(edge.useKind())), " but has type ", SpeculationDump(forNode(edge).m_type), " (", forNode(edge).m_type, ")").data());
+    DFG_CRASH(m_graph, node, toCString("Edge verification error: ", node, "->", edge, " was expected to have type ", SpeculationDump(typeFilterFor(edge.useKind())), " but has type ", SpeculationDump(forNode(edge).m_type), " (", forNode(edge).m_type, ")").data(), AbstractInterpreterInvalidType, node->op(), edge->op(), edge.useKind(), forNode(edge).m_type);
 }
 
 template<typename AbstractStateType>
index 9424e59..db06b01 100644 (file)
@@ -1452,7 +1452,6 @@ static void logDFGAssertionFailure(
     dataLog("\n");
     dataLog("DFG ASSERTION FAILED: ", assertion, "\n");
     dataLog(file, "(", line, ") : ", function, "\n");
-    WTFReportBacktrace();
 }
 
 void Graph::logAssertionFailure(
index ce862df..a676b2f 100644 (file)
@@ -50,7 +50,7 @@ namespace {
 
 NO_RETURN_DUE_TO_CRASH NEVER_INLINE void crash(const char*, int line, int)
 {
-    CRASH_WITH_SECURITY_IMPLICATION_AND_INFO(line);
+    CRASH_WITH_SECURITY_IMPLICATION_AND_INFO(ObjectAllocationSinkingAssertionFailure, line);
 }
 
 #undef RELEASE_ASSERT
index 25a3102..a2c075a 100644 (file)
@@ -1,3 +1,15 @@
+2017-07-05  Keith Miller  <keith_miller@apple.com>
+
+        Crashing with information should have an abort reason
+        https://bugs.webkit.org/show_bug.cgi?id=174185
+
+        Reviewed by Saam Barati.
+
+        Fix an ifdef to actually work with X86_64. It turns out X64_64 is
+        not an architecture... Whoops.
+
+        * wtf/Assertions.cpp:
+
 2017-07-03  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Remove copy of ICU headers from WebKit
index 8e104cb..a70325d 100644 (file)
@@ -559,7 +559,7 @@ void WTFInitializeLogChannelStatesFromString(WTFLogChannel* channels[], size_t c
 
 } // extern "C"
 
-#if OS(DARWIN) && (CPU(X64_64) || CPU(ARM64))
+#if OS(DARWIN) && (CPU(X86_64) || CPU(ARM64))
 #if CPU(X86_64)
 #define STUFF_REGISTER_FOR_CRASH(reg, info) __asm__ volatile ("movq %0, %%" reg : : "r" (static_cast<uint64_t>(info)) : reg)