Backed out changeset 9f852d187722 (bug 883789)
authorKannan Vijayan <kvijayan@mozilla.com>
Wed, 19 Jun 2013 13:09:45 -0400
changeset 135650 60a18af6cc27a05d769e0da68973a0551466acae
parent 135649 9f852d1877225f189b35d6c6136ae5d6f5f693d8
child 135651 3efe3f3d2c25b1a8a86912f32c623e4e2d6fa0c1
push id24847
push userkwierso@gmail.com
push dateWed, 19 Jun 2013 23:38:15 +0000
treeherdermozilla-central@8ea92aeab783 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs883789
milestone24.0a1
backs out9f852d1877225f189b35d6c6136ae5d6f5f693d8
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
Backed out changeset 9f852d187722 (bug 883789)
js/src/ion/BaselineIC.cpp
js/src/ion/BaselineIC.h
js/src/ion/BaselineInspector.cpp
js/src/ion/BaselineInspector.h
js/src/ion/MIR.cpp
--- a/js/src/ion/BaselineIC.cpp
+++ b/js/src/ion/BaselineIC.cpp
@@ -2463,19 +2463,16 @@ DoBinaryArithFallback(JSContext *cx, Bas
             return false;
         break;
       }
       default:
         JS_NOT_REACHED("Unhandled baseline arith op");
         return false;
     }
 
-    if (ret.isDouble())
-        stub->setSawDoubleResult();
-
     // Check to see if a new stub should be generated.
     if (stub->numOptimizedStubs() >= ICBinaryArith_Fallback::MAX_OPTIMIZED_STUBS) {
         // TODO: Discard all stubs in this IC and replace with inert megamorphic stub.
         // But for now we just bail.
         return true;
     }
 
     // Handle string concat.
@@ -2968,19 +2965,16 @@ DoUnaryArithFallback(JSContext *cx, Base
         if (!NegOperation(cx, script, pc, val, res))
             return false;
         break;
       default:
         JS_NOT_REACHED("Unexpected op");
         return false;
     }
 
-    if (res.isDouble())
-        stub->setSawDoubleResult();
-
     if (stub->numOptimizedStubs() >= ICUnaryArith_Fallback::MAX_OPTIMIZED_STUBS) {
         // TODO: Discard/replace stubs.
         return true;
     }
 
     if (val.isInt32() && res.isInt32()) {
         IonSpew(IonSpew_BaselineIC, "  Generating %s(Int32 => Int32) stub", js_CodeName[op]);
         ICUnaryArith_Int32::Compiler compiler(cx, op);
--- a/js/src/ion/BaselineIC.h
+++ b/js/src/ion/BaselineIC.h
@@ -2370,37 +2370,27 @@ class ICToNumber_Fallback : public ICFal
 //      JSOP_BITAND, JSOP_BITXOR, JSOP_BITOR
 //      JSOP_LSH, JSOP_RSH, JSOP_URSH
 
 class ICBinaryArith_Fallback : public ICFallbackStub
 {
     friend class ICStubSpace;
 
     ICBinaryArith_Fallback(IonCode *stubCode)
-      : ICFallbackStub(BinaryArith_Fallback, stubCode)
-    {
-        extra_ = 0;
-    }
+      : ICFallbackStub(BinaryArith_Fallback, stubCode) {}
 
   public:
     static const uint32_t MAX_OPTIMIZED_STUBS = 8;
 
     static inline ICBinaryArith_Fallback *New(ICStubSpace *space, IonCode *code) {
         if (!code)
             return NULL;
         return space->allocate<ICBinaryArith_Fallback>(code);
     }
 
-    bool sawDoubleResult() {
-        return extra_;
-    }
-    void setSawDoubleResult() {
-        extra_ = 1;
-    }
-
     // Compiler for this stub kind.
     class Compiler : public ICStubCompiler {
       protected:
         bool generateStubCode(MacroAssembler &masm);
 
       public:
         Compiler(JSContext *cx)
           : ICStubCompiler(cx, ICStub::BinaryArith_Fallback) {}
@@ -2668,37 +2658,27 @@ class ICBinaryArith_DoubleWithInt32 : pu
 //     JSOP_BITNOT
 //     JSOP_NEG
 
 class ICUnaryArith_Fallback : public ICFallbackStub
 {
     friend class ICStubSpace;
 
     ICUnaryArith_Fallback(IonCode *stubCode)
-      : ICFallbackStub(UnaryArith_Fallback, stubCode)
-    {
-        extra_ = 0;
-    }
+      : ICFallbackStub(UnaryArith_Fallback, stubCode) {}
 
   public:
     static const uint32_t MAX_OPTIMIZED_STUBS = 8;
 
     static inline ICUnaryArith_Fallback *New(ICStubSpace *space, IonCode *code) {
         if (!code)
             return NULL;
         return space->allocate<ICUnaryArith_Fallback>(code);
     }
 
-    bool sawDoubleResult() {
-        return extra_;
-    }
-    void setSawDoubleResult() {
-        extra_ = 1;
-    }
-
     // Compiler for this stub kind.
     class Compiler : public ICStubCompiler {
       protected:
         bool generateStubCode(MacroAssembler &masm);
 
       public:
         Compiler(JSContext *cx)
           : ICStubCompiler(cx, ICStub::UnaryArith_Fallback)
--- a/js/src/ion/BaselineInspector.cpp
+++ b/js/src/ion/BaselineInspector.cpp
@@ -160,19 +160,19 @@ BaselineInspector::expectedResultType(js
 
     switch (stub->kind()) {
       case ICStub::BinaryArith_Int32:
         if (stub->toBinaryArith_Int32()->allowDouble())
             return MIRType_Double;
         return MIRType_Int32;
       case ICStub::BinaryArith_BooleanWithInt32:
       case ICStub::UnaryArith_Int32:
-      case ICStub::BinaryArith_DoubleWithInt32:
         return MIRType_Int32;
       case ICStub::BinaryArith_Double:
+      case ICStub::BinaryArith_DoubleWithInt32:
       case ICStub::UnaryArith_Double:
         return MIRType_Double;
       case ICStub::BinaryArith_StringConcat:
       case ICStub::BinaryArith_StringObjectConcat:
         return MIRType_String;
       default:
         return MIRType_None;
     }
@@ -306,27 +306,8 @@ BaselineInspector::hasSeenAccessedGetter
 
     const ICEntry &entry = icEntryFromPC(pc);
     ICStub *stub = entry.fallbackStub();
 
     if (stub->isGetProp_Fallback())
         return stub->toGetProp_Fallback()->hasAccessedGetter();
     return false;
 }
-
-bool
-BaselineInspector::hasSeenDoubleResult(jsbytecode *pc)
-{
-    if (!hasBaselineScript())
-        return false;
-
-    const ICEntry &entry = icEntryFromPC(pc);
-    ICStub *stub = entry.fallbackStub();
-
-    JS_ASSERT(stub->isUnaryArith_Fallback() || stub->isBinaryArith_Fallback());
-
-    if (stub->isUnaryArith_Fallback())
-        return stub->toUnaryArith_Fallback()->sawDoubleResult();
-    else
-        return stub->toBinaryArith_Fallback()->sawDoubleResult();
-
-    return false;
-}
--- a/js/src/ion/BaselineInspector.h
+++ b/js/src/ion/BaselineInspector.h
@@ -103,17 +103,16 @@ class BaselineInspector
     }
 
     MIRType expectedResultType(jsbytecode *pc);
     MCompare::CompareType expectedCompareType(jsbytecode *pc);
     MIRType expectedBinaryArithSpecialization(jsbytecode *pc);
 
     bool hasSeenNonNativeGetElement(jsbytecode *pc);
     bool hasSeenAccessedGetter(jsbytecode *pc);
-    bool hasSeenDoubleResult(jsbytecode *pc);
 };
 
 } // namespace ion
 } // namespace js
 
 #endif // JS_ION
 
 #endif // jsion_baseline_inspector_h__
--- a/js/src/ion/MIR.cpp
+++ b/js/src/ion/MIR.cpp
@@ -950,17 +950,17 @@ void
 MUrsh::infer(BaselineInspector *inspector, jsbytecode *pc)
 {
     if (getOperand(0)->mightBeType(MIRType_Object) || getOperand(1)->mightBeType(MIRType_Object)) {
         specialization_ = MIRType_None;
         setResultType(MIRType_Value);
         return;
     }
 
-    if (inspector->hasSeenDoubleResult(pc)) {
+    if (inspector->expectedResultType(pc) == MIRType_Double) {
         specialization_ = MIRType_Double;
         setResultType(MIRType_Double);
         return;
     }
 
     specialization_ = MIRType_Int32;
     setResultType(MIRType_Int32);
 }
@@ -1304,17 +1304,17 @@ MBinaryArithInstruction::infer(BaselineI
     if (lhs == MIRType_Int32 && rhs == MIRType_Int32)
         setResultType(MIRType_Int32);
     else if (lhs == MIRType_Double || rhs == MIRType_Double)
         setResultType(MIRType_Double);
     else
         return inferFallback(inspector, pc);
 
     // If the operation has ever overflowed, use a double specialization.
-    if (inspector->hasSeenDoubleResult(pc))
+    if (inspector->expectedResultType(pc) == MIRType_Double)
         setResultType(MIRType_Double);
 
     // If the operation will always overflow on its constant operands, use a
     // double specialization so that it can be constant folded later.
     if ((isMul() || isDiv()) && lhs == MIRType_Int32 && rhs == MIRType_Int32) {
         bool typeChange = false;
         EvaluateConstantOperands(this, &typeChange);
         if (typeChange)