Title: [173370] trunk/Source
Revision
173370
Author
[email protected]
Date
2014-09-07 19:16:47 -0700 (Sun, 07 Sep 2014)

Log Message

Introduce COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE) and use it
https://bugs.webkit.org/show_bug.cgi?id=136616

Reviewed by Darin Adler.
Source/_javascript_Core:

        
Many compilers will analyze unrechable code paths (e.g. after an
unreachable code path), so sometimes they need dead code initializations.
But clang with suitable warnings will complain about unreachable code. So
use the quirk to include it conditionally.

* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::printGetByIdOp):
* dfg/DFGOSRExitCompilerCommon.cpp:
(JSC::DFG::handleExitCounts):
* dfg/DFGPlan.cpp:
(JSC::DFG::Plan::compileInThread):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::silentSavePlanForGPR):
* jsc.cpp:
* runtime/JSArray.cpp:
(JSC::JSArray::fillArgList):
(JSC::JSArray::copyToArguments):
* runtime/RegExp.cpp:
(JSC::RegExp::compile):
(JSC::RegExp::compileMatchOnly):

Source/WTF:


* wtf/Compiler.h: Define the quirk for all compilers but clang.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (173369 => 173370)


--- trunk/Source/_javascript_Core/ChangeLog	2014-09-08 01:36:07 UTC (rev 173369)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-09-08 02:16:47 UTC (rev 173370)
@@ -1,3 +1,31 @@
+2014-09-07  Maciej Stachowiak  <[email protected]>
+
+        Introduce COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE) and use it
+        https://bugs.webkit.org/show_bug.cgi?id=136616
+
+        Reviewed by Darin Adler.
+        
+        Many compilers will analyze unrechable code paths (e.g. after an
+        unreachable code path), so sometimes they need dead code initializations.
+        But clang with suitable warnings will complain about unreachable code. So
+        use the quirk to include it conditionally.
+
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::printGetByIdOp):
+        * dfg/DFGOSRExitCompilerCommon.cpp:
+        (JSC::DFG::handleExitCounts):
+        * dfg/DFGPlan.cpp:
+        (JSC::DFG::Plan::compileInThread):
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::silentSavePlanForGPR):
+        * jsc.cpp:
+        * runtime/JSArray.cpp:
+        (JSC::JSArray::fillArgList):
+        (JSC::JSArray::copyToArguments):
+        * runtime/RegExp.cpp:
+        (JSC::RegExp::compile):
+        (JSC::RegExp::compileMatchOnly):
+
 2014-09-06  Darin Adler  <[email protected]>
 
         Make updates suggested by new version of Xcode

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (173369 => 173370)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2014-09-08 01:36:07 UTC (rev 173369)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2014-09-08 02:16:47 UTC (rev 173370)
@@ -279,7 +279,9 @@
         break;
     default:
         RELEASE_ASSERT_NOT_REACHED();
+#if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)
         op = 0;
+#endif
     }
     int r0 = (++it)->u.operand;
     int r1 = (++it)->u.operand;

Modified: trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp (173369 => 173370)


--- trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp	2014-09-08 01:36:07 UTC (rev 173369)
+++ trunk/Source/_javascript_Core/dfg/DFGOSRExitCompilerCommon.cpp	2014-09-08 02:16:47 UTC (rev 173370)
@@ -123,7 +123,9 @@
         break;
     default:
         RELEASE_ASSERT_NOT_REACHED();
+#if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)
         clippedValue = 0; // Make some compilers, and mhahnenberg, happy.
+#endif
         break;
     }
     jit.store32(AssemblyHelpers::TrustedImm32(-clippedValue), AssemblyHelpers::Address(GPRInfo::regT0, CodeBlock::offsetOfJITExecuteCounter()));

Modified: trunk/Source/_javascript_Core/dfg/DFGPlan.cpp (173369 => 173370)


--- trunk/Source/_javascript_Core/dfg/DFGPlan.cpp	2014-09-08 01:36:07 UTC (rev 173369)
+++ trunk/Source/_javascript_Core/dfg/DFGPlan.cpp	2014-09-08 02:16:47 UTC (rev 173370)
@@ -181,7 +181,9 @@
             break;
         default:
             RELEASE_ASSERT_NOT_REACHED();
+#if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)
             pathName = "";
+#endif
             break;
         }
         double now = currentTimeMS();

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (173369 => 173370)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2014-09-08 01:36:07 UTC (rev 173369)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2014-09-08 02:16:47 UTC (rev 173370)
@@ -331,7 +331,9 @@
     } else if (registerFormat == DataFormatBoolean) {
 #if USE(JSVALUE64)
         RELEASE_ASSERT_NOT_REACHED();
+#if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)
         fillAction = DoNothingForFill;
+#endif
 #elif USE(JSVALUE32_64)
         ASSERT(info.gpr() == source);
         if (node->hasConstant()) {
@@ -367,7 +369,9 @@
             fillAction = Load64;
         else {
             RELEASE_ASSERT_NOT_REACHED();
+#if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)
             fillAction = Load64; // Make GCC happy.
+#endif
         }
     } else if (registerFormat == DataFormatStrictInt52) {
         if (node->hasConstant())
@@ -380,7 +384,9 @@
             fillAction = Load64;
         else {
             RELEASE_ASSERT_NOT_REACHED();
+#if COMPILER_QURIK(CONSIDERS_UNREACHABLE_CODE)
             fillAction = Load64; // Make GCC happy.
+#endif
         }
     } else {
         ASSERT(registerFormat & DataFormatJS);
@@ -596,7 +602,7 @@
     switch (arrayMode.arrayClass()) {
     case Array::OriginalArray: {
         CRASH();
-#if !COMPILER(CLANG)
+#if COMPILER_QURIK(CONSIDERS_UNREACHABLE_CODE)
         JITCompiler::Jump result; // I already know that VC++ takes unkindly to the _expression_ "return Jump()", so I'm doing it this way in anticipation of someone eventually using VC++ to compile the DFG.
         return result;
 #endif

Modified: trunk/Source/_javascript_Core/jsc.cpp (173369 => 173370)


--- trunk/Source/_javascript_Core/jsc.cpp	2014-09-08 01:36:07 UTC (rev 173369)
+++ trunk/Source/_javascript_Core/jsc.cpp	2014-09-08 02:16:47 UTC (rev 173370)
@@ -363,7 +363,7 @@
     static NO_RETURN_DUE_TO_CRASH bool deleteProperty(JSCell*, ExecState*, PropertyName)
     {
         RELEASE_ASSERT_NOT_REACHED();
-#if !COMPILER(CLANG) && !COMPILER(MSVC)
+#if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)
         return true;
 #endif
     }

Modified: trunk/Source/_javascript_Core/runtime/JSArray.cpp (173369 => 173370)


--- trunk/Source/_javascript_Core/runtime/JSArray.cpp	2014-09-08 01:36:07 UTC (rev 173369)
+++ trunk/Source/_javascript_Core/runtime/JSArray.cpp	2014-09-08 02:16:47 UTC (rev 173370)
@@ -1553,7 +1553,7 @@
         
     default:
         CRASH();
-#if !COMPILER(CLANG)
+#if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)
         vector = 0;
         vectorEnd = 0;
         break;
@@ -1617,7 +1617,7 @@
         
     default:
         CRASH();
-#if !COMPILER(CLANG)
+#if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)
         vector = 0;
         vectorEnd = 0;
         break;

Modified: trunk/Source/_javascript_Core/runtime/RegExp.cpp (173369 => 173370)


--- trunk/Source/_javascript_Core/runtime/RegExp.cpp	2014-09-08 01:36:07 UTC (rev 173369)
+++ trunk/Source/_javascript_Core/runtime/RegExp.cpp	2014-09-08 02:16:47 UTC (rev 173370)
@@ -273,8 +273,10 @@
     Yarr::YarrPattern pattern(m_patternString, ignoreCase(), multiline(), &m_constructionError);
     if (m_constructionError) {
         RELEASE_ASSERT_NOT_REACHED();
+#if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)
         m_state = ParseError;
         return;
+#endif
     }
     ASSERT(m_numSubpatterns == pattern.m_numSubpatterns);
 
@@ -396,8 +398,10 @@
     Yarr::YarrPattern pattern(m_patternString, ignoreCase(), multiline(), &m_constructionError);
     if (m_constructionError) {
         RELEASE_ASSERT_NOT_REACHED();
+#if COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE)
         m_state = ParseError;
         return;
+#endif
     }
     ASSERT(m_numSubpatterns == pattern.m_numSubpatterns);
 

Modified: trunk/Source/WTF/ChangeLog (173369 => 173370)


--- trunk/Source/WTF/ChangeLog	2014-09-08 01:36:07 UTC (rev 173369)
+++ trunk/Source/WTF/ChangeLog	2014-09-08 02:16:47 UTC (rev 173370)
@@ -1,3 +1,12 @@
+2014-09-07  Maciej Stachowiak  <[email protected]>
+
+        Introduce COMPILER_QUIRK(CONSIDERS_UNREACHABLE_CODE) and use it
+        https://bugs.webkit.org/show_bug.cgi?id=136616
+
+        Reviewed by Darin Adler.
+
+        * wtf/Compiler.h: Define the quirk for all compilers but clang.
+
 2014-09-06  Sam Weinig  <[email protected]>
 
         XPCPtr should be converted into an all purpose smart pointer for os_objects

Modified: trunk/Source/WTF/wtf/Compiler.h (173369 => 173370)


--- trunk/Source/WTF/wtf/Compiler.h	2014-09-08 01:36:07 UTC (rev 173369)
+++ trunk/Source/WTF/wtf/Compiler.h	2014-09-08 02:16:47 UTC (rev 173370)
@@ -74,6 +74,10 @@
 #define WTF_COMPILER_SUPPORTS_CXX_USER_LITERALS 1
 #endif
 
+#if !COMPILER(CLANG)
+#define WTF_COMPILER_QUIRK_CONSIDERS_UNREACHABLE_CODE 1
+#endif
+
 #if COMPILER(GCC) && !COMPILER(CLANG) && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
 #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT 1
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to