Bug 977538 - Disable PGO for CanonicalizeNaN. r=luke
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 27 Feb 2014 20:48:59 +0100
changeset 171348 00f1d0e19c9b5bd812a50957a41888f711f583a3
parent 171347 ca08ca9fd1570951c7e31ce3f071b418a4262bf9
child 171349 e9f7deb46a0813bc42918374edddecc016affbaf
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersluke
bugs977538
milestone30.0a1
Bug 977538 - Disable PGO for CanonicalizeNaN. r=luke
js/public/Value.h
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -857,23 +857,30 @@ static inline JS_VALUE_CONSTEXPR JS::Val
  * bit pattern restrictions.
  */
 static MOZ_ALWAYS_INLINE double
 GenericNaN()
 {
   return mozilla::SpecificNaN<double>(0, 0x8000000000000ULL);
 }
 
+/* MSVC with PGO miscompiles this function. */
+#if defined(_MSC_VER)
+# pragma optimize("g", off)
+#endif
 static inline double
 CanonicalizeNaN(double d)
 {
     if (MOZ_UNLIKELY(mozilla::IsNaN(d)))
         return GenericNaN();
     return d;
 }
+#if defined(_MSC_VER)
+# pragma optimize("", on)
+#endif
 
 /*
  * JS::Value is the interface for a single JavaScript Engine value.  A few
  * general notes on JS::Value:
  *
  * - JS::Value has setX() and isX() members for X in
  *
  *     { Int32, Double, String, Boolean, Undefined, Null, Object, Magic }