Bug 581341 - Part 6: Hack around an MSVC PGO bug. r=ted
authorJosh Matthews <josh@joshmatthews.net>
Fri, 30 Sep 2011 13:02:52 -0400
changeset 78570 43c07840c4a55291bfe88902ccca2eeaa7118999
parent 78569 9b851182cd64c6176835e9b8b5b8a139aecff6f0
child 78571 04377b9142c24fe1b8b7ef929135332eb88730f9
push id506
push userclegnitto@mozilla.com
push dateWed, 09 Nov 2011 02:03:18 +0000
treeherdermozilla-aurora@63587fc7bb93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs581341
milestone10.0a1
Bug 581341 - Part 6: Hack around an MSVC PGO bug. r=ted
toolkit/crashreporter/nsExceptionHandler.cpp
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -1100,16 +1100,20 @@ static PLDHashOperator EnumerateEntries(
                                         nsCString entry,
                                         void* userData)
 {
   crashReporterAPIData->Append(key + NS_LITERAL_CSTRING("=") + entry +
                                NS_LITERAL_CSTRING("\n"));
   return PL_DHASH_NEXT;
 }
 
+// This function is miscompiled with MSVC 2005/2008 when PGO is on.
+#ifdef _MSC_VER
+#pragma optimize("", off)
+#endif
 static nsresult
 EscapeAnnotation(const nsACString& key, const nsACString& data, nsCString& escapedData)
 {
   if (DoFindInReadable(key, NS_LITERAL_CSTRING("=")) ||
       DoFindInReadable(key, NS_LITERAL_CSTRING("\n")))
     return NS_ERROR_INVALID_ARG;
 
   if (DoFindInReadable(data, NS_LITERAL_CSTRING("\0")))
@@ -1120,16 +1124,19 @@ EscapeAnnotation(const nsACString& key, 
   // escape backslashes
   ReplaceChar(escapedData, NS_LITERAL_CSTRING("\\"),
               NS_LITERAL_CSTRING("\\\\"));
   // escape newlines
   ReplaceChar(escapedData, NS_LITERAL_CSTRING("\n"),
               NS_LITERAL_CSTRING("\\n"));
   return NS_OK;
 }
+#ifdef _MSC_VER
+#pragma optimize("", on)
+#endif
 
 class DelayedNote
 {
  public:
   DelayedNote(const nsACString& aKey, const nsACString& aData)
   : mKey(aKey), mData(aData), mType(Annotation) {}
 
   DelayedNote(const nsACString& aData)