Title: [152305] branches/dfgFourthTier/Source/_javascript_Core
Revision
152305
Author
[email protected]
Date
2013-07-02 12:00:39 -0700 (Tue, 02 Jul 2013)

Log Message

fourthTier: since the FTL disassembly hacks cannot distinguish between code and data, the LLVM disassembler symbol table callback should be able to deal gracefully with arbitrary garbage
https://bugs.webkit.org/show_bug.cgi?id=118313

Reviewed by Mark Hahnenberg.
        
Give it a mode where we can still crash on unrecognized reference types, so that we might
implement them in the future, but by default just print some stuff and keep going.

* disassembler/LLVMDisassembler.cpp:
(JSC):
(JSC::symbolLookupCallback):

Modified Paths

Diff

Modified: branches/dfgFourthTier/Source/_javascript_Core/ChangeLog (152304 => 152305)


--- branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-07-02 18:15:41 UTC (rev 152304)
+++ branches/dfgFourthTier/Source/_javascript_Core/ChangeLog	2013-07-02 19:00:39 UTC (rev 152305)
@@ -1,5 +1,19 @@
 2013-07-02  Filip Pizlo  <[email protected]>
 
+        fourthTier: since the FTL disassembly hacks cannot distinguish between code and data, the LLVM disassembler symbol table callback should be able to deal gracefully with arbitrary garbage
+        https://bugs.webkit.org/show_bug.cgi?id=118313
+
+        Reviewed by Mark Hahnenberg.
+        
+        Give it a mode where we can still crash on unrecognized reference types, so that we might
+        implement them in the future, but by default just print some stuff and keep going.
+
+        * disassembler/LLVMDisassembler.cpp:
+        (JSC):
+        (JSC::symbolLookupCallback):
+
+2013-07-02  Filip Pizlo  <[email protected]>
+
         fourthTier: FTL should use the equivalent of llvm opt -O2 by default
         https://bugs.webkit.org/show_bug.cgi?id=118311
 

Modified: branches/dfgFourthTier/Source/_javascript_Core/disassembler/LLVMDisassembler.cpp (152304 => 152305)


--- branches/dfgFourthTier/Source/_javascript_Core/disassembler/LLVMDisassembler.cpp	2013-07-02 18:15:41 UTC (rev 152304)
+++ branches/dfgFourthTier/Source/_javascript_Core/disassembler/LLVMDisassembler.cpp	2013-07-02 19:00:39 UTC (rev 152305)
@@ -33,12 +33,17 @@
 
 namespace JSC {
 
-static const unsigned symbolStringSize = 20;
+static const unsigned symbolStringSize = 40;
 
 static const char *symbolLookupCallback(
     void* opaque, uint64_t referenceValue, uint64_t* referenceType, uint64_t referencePC,
     const char** referenceName)
 {
+    // Set this if you want to debug an unexpected reference type. Currently we only encounter these
+    // if we try to disassemble garbage, since our code generator never uses them. These include things
+    // like PC-relative references.
+    static const bool crashOnUnexpected = false;
+    
     char* symbolString = static_cast<char*>(opaque);
     
     switch (*referenceType) {
@@ -52,13 +57,21 @@
             static_cast<unsigned long>(referenceValue));
         return symbolString;
     default:
-        dataLog("referenceValue = ", referenceValue, "\n");
-        dataLog("referenceType = ", RawPointer(referenceType), ", *referenceType = ", *referenceType, "\n");
-        dataLog("referencePC = ", referencePC, "\n");
-        dataLog("referenceName = ", RawPointer(referenceName), "\n");
-    
-        RELEASE_ASSERT_NOT_REACHED();
-        return 0;
+        if (crashOnUnexpected) {
+            dataLog("referenceValue = ", referenceValue, "\n");
+            dataLog("referenceType = ", RawPointer(referenceType), ", *referenceType = ", *referenceType, "\n");
+            dataLog("referencePC = ", referencePC, "\n");
+            dataLog("referenceName = ", RawPointer(referenceName), "\n");
+            
+            RELEASE_ASSERT_NOT_REACHED();
+        }
+        
+        *referenceName = "unimplemented reference type!";
+        *referenceType = LLVMDisassembler_ReferenceType_InOut_None;
+        snprintf(
+            symbolString, symbolStringSize, "unimplemented:0x%lx",
+            static_cast<unsigned long>(referenceValue));
+        return symbolString;
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to