Title: [172648] trunk/Source/_javascript_Core
Revision
172648
Author
[email protected]
Date
2014-08-15 14:04:31 -0700 (Fri, 15 Aug 2014)

Log Message

Made native inlining errors not segfault.
https://bugs.webkit.org/show_bug.cgi?id=135988

Reviewed by Geoffrey Garen.

* ftl/FTLAbbreviations.h:
(JSC::FTL::disposeMessage): Added.
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compilePutById):
abstracted out Options::verboseCompilation as was the case in the rest of the file.
(JSC::FTL::LowerDFGToLLVM::compileNativeCallOrConstruct):
(JSC::FTL::LowerDFGToLLVM::getModuleByPathForSymbol):
added output error messages for llvm module loading.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (172647 => 172648)


--- trunk/Source/_javascript_Core/ChangeLog	2014-08-15 20:48:35 UTC (rev 172647)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-08-15 21:04:31 UTC (rev 172648)
@@ -1,3 +1,19 @@
+2014-08-15  Matthew Mirman  <[email protected]>
+
+        Made native inlining errors not segfault. 
+        https://bugs.webkit.org/show_bug.cgi?id=135988
+        
+        Reviewed by Geoffrey Garen.
+
+        * ftl/FTLAbbreviations.h:
+        (JSC::FTL::disposeMessage): Added.
+        * ftl/FTLLowerDFGToLLVM.cpp:
+        (JSC::FTL::LowerDFGToLLVM::compilePutById): 
+        abstracted out Options::verboseCompilation as was the case in the rest of the file.
+        (JSC::FTL::LowerDFGToLLVM::compileNativeCallOrConstruct):
+        (JSC::FTL::LowerDFGToLLVM::getModuleByPathForSymbol): 
+        added output error messages for llvm module loading.
+
 2014-08-14  Andreas Kling  <[email protected]>
 
         Allocate the whole RegExpMatchesArray backing store up front.

Modified: trunk/Source/_javascript_Core/ftl/FTLAbbreviations.h (172647 => 172648)


--- trunk/Source/_javascript_Core/ftl/FTLAbbreviations.h	2014-08-15 20:48:35 UTC (rev 172647)
+++ trunk/Source/_javascript_Core/ftl/FTLAbbreviations.h	2014-08-15 21:04:31 UTC (rev 172648)
@@ -187,6 +187,8 @@
 static inline LModule moduleCreateWithNameInContext(const char* moduleID, LContext context){ return llvm->ModuleCreateWithNameInContext(moduleID, context); }
 static inline void disposeModule(LModule m){ llvm->DisposeModule(m); }
 
+static inline void disposeMessage(char* outMsg) { llvm->DisposeMessage(outMsg); }
+
 static inline LValue getParam(LValue function, unsigned index) { return llvm->GetParam(function, index); }
 
 static inline void getParamTypes(LType function, LType* dest) { return llvm->GetParamTypes(function, dest); }

Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp (172647 => 172648)


--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2014-08-15 20:48:35 UTC (rev 172647)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToLLVM.cpp	2014-08-15 21:04:31 UTC (rev 172648)
@@ -1899,7 +1899,7 @@
         // Arguments: id, bytes, target, numArgs, args...
         unsigned stackmapID = m_stackmapIDs++;
 
-        if (Options::verboseCompilation())
+        if (verboseCompilationEnabled())
             dataLog("    Emitting PutById patchpoint with stackmap #", stackmapID, "\n");
         
         LValue call = m_out.call(
@@ -3715,7 +3715,7 @@
             : m_out.bitCast(calleeCallFrame, typeCalleeArg);
         LValue call = vmCall(callee, argument);
 
-        if (Options::verboseCompilation())
+        if (verboseCompilationEnabled())
             dataLog("Native calling: ", info.dli_sname, "\n");
 
         setJSValue(call);
@@ -4382,16 +4382,22 @@
             isX86() ? "/Resources/Runtime/x86_64/" : "/Resources/Runtime/arm64/",
             path.data());
 
-        if (createMemoryBufferWithContentsOfFile(actualPath.data(), &memBuf, nullptr)) {
-            if (Options::verboseCompilation()) 
-                dataLog("Failed to load module at ", actualPath.data(), "\n for symbol ", symbol.data());
+        char* outMsg;
+        
+        if (createMemoryBufferWithContentsOfFile(actualPath.data(), &memBuf, &outMsg)) {
+            if (Options::verboseFTLFailure())
+                dataLog("Failed to load module at ", actualPath, "\n for symbol ", symbol, "\nERROR: ", outMsg, "\n");
+            disposeMessage(outMsg);
             return false;
         }
 
         LModule module;
 
-        if (parseBitcodeInContext(m_ftlState.context, memBuf, &module, nullptr)) {
+        if (parseBitcodeInContext(m_ftlState.context, memBuf, &module, &outMsg)) {
+            if (Options::verboseFTLFailure())
+                dataLog("Failed to parse module at ", actualPath, "\n for symbol ", symbol, "\nERROR: ", outMsg, "\n");
             disposeMemoryBuffer(memBuf);
+            disposeMessage(outMsg);
             return false;
         }
 
@@ -4424,8 +4430,12 @@
             namedGlobals.append(globalName);
         }
 
-        if (linkModules(m_ftlState.module, module, LLVMLinkerDestroySource, nullptr))
+        if (linkModules(m_ftlState.module, module, LLVMLinkerDestroySource, &outMsg)) {
+            if (Options::verboseFTLFailure())
+                dataLog("Failed to link module at ", actualPath, "\n for symbol ", symbol, "\nERROR: ", outMsg, "\n");
+            disposeMessage(outMsg);
             return false;
+        }
         
         for (CString* symbol = namedFunctions.begin(); symbol != namedFunctions.end(); ++symbol) {
             LValue function = getNamedFunction(m_ftlState.module, symbol->data());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to