Bug 1056529 - Remove old workarounds for MSVC PGO bugs. r=h4writer
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 27 Aug 2014 10:14:07 +0200
changeset 223553 a2a10e38f42d1193b357af480918e206887cc1af
parent 223552 66e350a413a6790c12c5394e4c63049e71e25c5f
child 223554 fdd2bb040eb676c6c7d0ab9b62e7f9118ddad796
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersh4writer
bugs1056529
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1056529 - Remove old workarounds for MSVC PGO bugs. r=h4writer
js/src/jit/BaselineIC.cpp
js/src/jsmath.cpp
js/src/jsnum.cpp
js/src/vm/ObjectImpl.cpp
js/src/vm/Stack.cpp
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -2498,20 +2498,16 @@ ICToNumber_Fallback::Compiler::generateS
 
     return tailCallVM(DoToNumberFallbackInfo, masm);
 }
 
 //
 // BinaryArith_Fallback
 //
 
-// Disable PGO (see bug 851490).
-#if defined(_MSC_VER)
-# pragma optimize("g", off)
-#endif
 static bool
 DoBinaryArithFallback(JSContext *cx, BaselineFrame *frame, ICBinaryArith_Fallback *stub_,
                       HandleValue lhs, HandleValue rhs, MutableHandleValue ret)
 {
     // This fallback stub may trigger debug mode toggling.
     DebugModeOSRVolatileStub<ICBinaryArith_Fallback *> stub(frame, stub_);
 
     RootedScript script(cx, frame->script());
@@ -2717,19 +2713,16 @@ DoBinaryArithFallback(JSContext *cx, Bas
           default:
             break;
         }
     }
 
     stub->noteUnoptimizableOperands();
     return true;
 }
-#if defined(_MSC_VER)
-# pragma optimize("", on)
-#endif
 
 typedef bool (*DoBinaryArithFallbackFn)(JSContext *, BaselineFrame *, ICBinaryArith_Fallback *,
                                         HandleValue, HandleValue, MutableHandleValue);
 static const VMFunction DoBinaryArithFallbackInfo =
     FunctionInfo<DoBinaryArithFallbackFn>(DoBinaryArithFallback, PopValues(2));
 
 bool
 ICBinaryArith_Fallback::Compiler::generateStubCode(MacroAssembler &masm)
@@ -3064,20 +3057,16 @@ ICBinaryArith_DoubleWithInt32::Compiler:
     EmitStubGuardFailure(masm);
     return true;
 }
 
 //
 // UnaryArith_Fallback
 //
 
-// Disable PGO (see bug 851490).
-#if defined(_MSC_VER)
-# pragma optimize("g", off)
-#endif
 static bool
 DoUnaryArithFallback(JSContext *cx, BaselineFrame *frame, ICUnaryArith_Fallback *stub_,
                      HandleValue val, MutableHandleValue res)
 {
     // This fallback stub may trigger debug mode toggling.
     DebugModeOSRVolatileStub<ICUnaryArith_Fallback *> stub(frame, stub_);
 
     RootedScript script(cx, frame->script());
@@ -3134,19 +3123,16 @@ DoUnaryArithFallback(JSContext *cx, Base
         if (!doubleStub)
             return false;
         stub->addNewStub(doubleStub);
         return true;
     }
 
     return true;
 }
-#if defined(_MSC_VER)
-# pragma optimize("", on)
-#endif
 
 typedef bool (*DoUnaryArithFallbackFn)(JSContext *, BaselineFrame *, ICUnaryArith_Fallback *,
                                        HandleValue, MutableHandleValue);
 static const VMFunction DoUnaryArithFallbackInfo =
     FunctionInfo<DoUnaryArithFallbackFn>(DoUnaryArithFallback, PopValues(1));
 
 bool
 ICUnaryArith_Fallback::Compiler::generateStubCode(MacroAssembler &masm)
--- a/js/src/jsmath.cpp
+++ b/js/src/jsmath.cpp
@@ -628,20 +628,16 @@ js::minmax_impl(JSContext *cx, bool max,
     if (max)
         res.setNumber(max_double(x, y));
     else
         res.setNumber(min_double(x, y));
 
     return true;
 }
 
-// Disable PGO for Math.pow() and related functions (see bug 791214).
-#if defined(_MSC_VER)
-# pragma optimize("g", off)
-#endif
 double
 js::powi(double x, int y)
 {
     unsigned n = (y < 0) ? -y : y;
     double m = x;
     double p = 1;
     while (true) {
         if ((n & 1) != 0) p *= m;
@@ -659,24 +655,17 @@ js::powi(double x, int y)
                        : result;
             }
 
             return p;
         }
         m *= m;
     }
 }
-#if defined(_MSC_VER)
-# pragma optimize("", on)
-#endif
 
-// Disable PGO for Math.pow() and related functions (see bug 791214).
-#if defined(_MSC_VER)
-# pragma optimize("g", off)
-#endif
 double
 js::ecmaPow(double x, double y)
 {
     /*
      * Use powi if the exponent is an integer-valued double. We don't have to
      * check for NaN since a comparison with NaN is always false.
      */
     int32_t yi;
@@ -701,24 +690,17 @@ js::ecmaPow(double x, double y)
     if (IsFinite(x) && x != 0.0) {
         if (y == 0.5)
             return sqrt(x);
         if (y == -0.5)
             return 1.0 / sqrt(x);
     }
     return pow(x, y);
 }
-#if defined(_MSC_VER)
-# pragma optimize("", on)
-#endif
 
-// Disable PGO for Math.pow() and related functions (see bug 791214).
-#if defined(_MSC_VER)
-# pragma optimize("g", off)
-#endif
 bool
 js::math_pow_handle(JSContext *cx, HandleValue base, HandleValue power, MutableHandleValue result)
 {
     double x;
     if (!ToNumber(cx, base, &x))
         return false;
 
     double y;
@@ -732,19 +714,16 @@ js::math_pow_handle(JSContext *cx, Handl
 
 bool
 js::math_pow(JSContext *cx, unsigned argc, Value *vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
 
     return math_pow_handle(cx, args.get(0), args.get(1), args.rval());
 }
-#if defined(_MSC_VER)
-# pragma optimize("", on)
-#endif
 
 static uint64_t
 random_generateSeed()
 {
     union {
         uint8_t     u8[8];
         uint32_t    u32[2];
         uint64_t    u64;
--- a/js/src/jsnum.cpp
+++ b/js/src/jsnum.cpp
@@ -1563,20 +1563,16 @@ js::NonObjectToNumberSlow(ThreadSafeCont
         return false;
     }
 
     JS_ASSERT(v.isUndefined());
     *out = GenericNaN();
     return true;
 }
 
-#if defined(_MSC_VER)
-# pragma optimize("g", off)
-#endif
-
 bool
 js::ToNumberSlow(ExclusiveContext *cx, Value v, double *out)
 {
     JS_ASSERT(!v.isNumber());
     goto skip_int_double;
     for (;;) {
         if (v.isNumber()) {
             *out = v.toNumber();
@@ -1603,20 +1599,16 @@ js::ToNumberSlow(ExclusiveContext *cx, V
 }
 
 JS_PUBLIC_API(bool)
 js::ToNumberSlow(JSContext *cx, Value v, double *out)
 {
     return ToNumberSlow(static_cast<ExclusiveContext *>(cx), v, out);
 }
 
-#if defined(_MSC_VER)
-# pragma optimize("", on)
-#endif
-
 /*
  * Convert a value to an int64_t, according to the WebIDL rules for long long
  * conversion. Return converted value in *out on success, false on failure.
  */
 JS_PUBLIC_API(bool)
 js::ToInt64Slow(JSContext *cx, const HandleValue v, int64_t *out)
 {
     JS_ASSERT(!v.isInt32());
--- a/js/src/vm/ObjectImpl.cpp
+++ b/js/src/vm/ObjectImpl.cpp
@@ -247,41 +247,32 @@ js::ObjectImpl::slotInRange(uint32_t slo
 {
     uint32_t capacity = numFixedSlots() + numDynamicSlots();
     if (sentinel == SENTINEL_ALLOWED)
         return slot <= capacity;
     return slot < capacity;
 }
 #endif /* DEBUG */
 
-// See bug 844580.
-#if defined(_MSC_VER)
-# pragma optimize("g", off)
-#endif
-
 #if defined(_MSC_VER) && _MSC_VER >= 1500
 /*
  * Work around a compiler bug in MSVC9 and above, where inlining this function
  * causes stack pointer offsets to go awry and spp to refer to something higher
  * up the stack.
  */
 MOZ_NEVER_INLINE
 #endif
 Shape *
 js::ObjectImpl::nativeLookup(ExclusiveContext *cx, jsid id)
 {
     MOZ_ASSERT(isNative());
     Shape **spp;
     return Shape::search(cx, lastProperty(), id, &spp);
 }
 
-#if defined(_MSC_VER)
-# pragma optimize("", on)
-#endif
-
 Shape *
 js::ObjectImpl::nativeLookupPure(jsid id)
 {
     MOZ_ASSERT(isNative());
     return Shape::searchNoHashify(lastProperty(), id);
 }
 
 uint32_t
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -497,21 +497,16 @@ InterpreterStack::pushExecuteFrame(JSCon
     fp->initExecuteFrame(cx, script, evalInFrame, thisv, *scopeChain, type);
     fp->initVarsToUndefined();
 
     return fp;
 }
 
 /*****************************************************************************/
 
-/* MSVC PGO causes xpcshell startup crashes. */
-#if defined(_MSC_VER)
-# pragma optimize("g", off)
-#endif
-
 void
 FrameIter::popActivation()
 {
     ++data_.activations_;
     settleOnActivation();
 }
 
 void
@@ -1327,20 +1322,16 @@ FrameIter::frameSlotValue(size_t index) 
         index += data_.jitFrames_.script()->nfixed();
         return *data_.jitFrames_.baselineFrame()->valueSlot(index);
       case INTERP:
           return interpFrame()->base()[index];
     }
     MOZ_CRASH("Unexpected state");
 }
 
-#if defined(_MSC_VER)
-# pragma optimize("", on)
-#endif
-
 #ifdef DEBUG
 bool
 js::SelfHostedFramesVisible()
 {
     static bool checked = false;
     static bool visible = false;
     if (!checked) {
         checked = true;