Bug 1134638: 9. Drive-by cleanup: FloatingTypePolicy can just have SPECIALIZATION_DATA; r=nbp
authorBenjamin Bouvier <benj@benj.me>
Fri, 20 Feb 2015 18:42:11 +0100
changeset 231300 b0a80dbf11ca07ee8e7ee8e41bfd363eec2a7eb4
parent 231299 6ab15d0a97c207d84d0d786c0a9d0ed7ddb2eb44
child 231301 771f49cc99e7f80772dacab732a3406f379697f8
push id28348
push userkwierso@gmail.com
push dateMon, 02 Mar 2015 20:13:43 +0000
treeherdermozilla-central@abb7f0d180da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1134638
milestone39.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 1134638: 9. Drive-by cleanup: FloatingTypePolicy can just have SPECIALIZATION_DATA; r=nbp
js/src/jit/MIR.cpp
js/src/jit/MIR.h
js/src/jit/TypePolicy.h
--- a/js/src/jit/MIR.cpp
+++ b/js/src/jit/MIR.cpp
@@ -1354,33 +1354,33 @@ EnsureFloatInputOrConvert(MUnaryInstruct
     return true;
 }
 
 void
 MFloor::trySpecializeFloat32(TempAllocator &alloc)
 {
     MOZ_ASSERT(type() == MIRType_Int32);
     if (EnsureFloatInputOrConvert(this, alloc))
-        setPolicyType(MIRType_Float32);
+        specialization_ = MIRType_Float32;
 }
 
 void
 MCeil::trySpecializeFloat32(TempAllocator &alloc)
 {
     MOZ_ASSERT(type() == MIRType_Int32);
     if (EnsureFloatInputOrConvert(this, alloc))
-        setPolicyType(MIRType_Float32);
+        specialization_ = MIRType_Float32;
 }
 
 void
 MRound::trySpecializeFloat32(TempAllocator &alloc)
 {
     MOZ_ASSERT(type() == MIRType_Int32);
     if (EnsureFloatInputOrConvert(this, alloc))
-        setPolicyType(MIRType_Float32);
+        specialization_ = MIRType_Float32;
 }
 
 MCompare *
 MCompare::New(TempAllocator &alloc, MDefinition *left, MDefinition *right, JSOp op)
 {
     return new(alloc) MCompare(left, right, op);
 }
 
@@ -2303,17 +2303,17 @@ MMathFunction::trySpecializeFloat32(Temp
 {
     if (!input()->canProduceFloat32() || !CheckUsesAreFloat32Consumers(this)) {
         if (input()->type() == MIRType_Float32)
             ConvertDefinitionToDouble<0>(alloc, input(), this);
         return;
     }
 
     setResultType(MIRType_Float32);
-    setPolicyType(MIRType_Float32);
+    specialization_ = MIRType_Float32;
 }
 
 MHypot *MHypot::New(TempAllocator &alloc, const MDefinitionVector & vector)
 {
     uint32_t length = vector.length();
     MHypot * hypot = new(alloc) MHypot;
     if (!hypot->init(alloc, length))
         return nullptr;
@@ -4325,17 +4325,17 @@ void
 MSqrt::trySpecializeFloat32(TempAllocator &alloc) {
     if (!input()->canProduceFloat32() || !CheckUsesAreFloat32Consumers(this)) {
         if (input()->type() == MIRType_Float32)
             ConvertDefinitionToDouble<0>(alloc, input(), this);
         return;
     }
 
     setResultType(MIRType_Float32);
-    setPolicyType(MIRType_Float32);
+    specialization_ = MIRType_Float32;
 }
 
 MDefinition *
 MClz::foldsTo(TempAllocator &alloc)
 {
     if (num()->isConstantValue()) {
         int32_t n = num()->constantValue().toInt32();
         if (n == 0)
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -5528,17 +5528,17 @@ class MClz
 class MSqrt
   : public MUnaryInstruction,
     public FloatingPointPolicy<0>::Data
 {
     MSqrt(MDefinition *num, MIRType type)
       : MUnaryInstruction(num)
     {
         setResultType(type);
-        setPolicyType(type);
+        specialization_ = type;
         setMovable();
     }
 
   public:
     INSTRUCTION_HEADER(Sqrt)
     static MSqrt *New(TempAllocator &alloc, MDefinition *num) {
         return new(alloc) MSqrt(num, MIRType_Double);
     }
@@ -5809,17 +5809,17 @@ class MMathFunction
   private:
     Function function_;
     const MathCache *cache_;
 
     MMathFunction(MDefinition *input, Function function, const MathCache *cache)
       : MUnaryInstruction(input), function_(function), cache_(cache)
     {
         setResultType(MIRType_Double);
-        setPolicyType(MIRType_Double);
+        specialization_ = MIRType_Double;
         setMovable();
     }
 
   public:
     INSTRUCTION_HEADER(MathFunction)
 
     // A nullptr cache means this function will neither access nor update the cache.
     static MMathFunction *New(TempAllocator &alloc, MDefinition *input, Function function,
@@ -10937,17 +10937,17 @@ class MStringLength
 class MFloor
   : public MUnaryInstruction,
     public FloatingPointPolicy<0>::Data
 {
     explicit MFloor(MDefinition *num)
       : MUnaryInstruction(num)
     {
         setResultType(MIRType_Int32);
-        setPolicyType(MIRType_Double);
+        specialization_ = MIRType_Double;
         setMovable();
     }
 
   public:
     INSTRUCTION_HEADER(Floor)
 
     static MFloor *New(TempAllocator &alloc, MDefinition *num) {
         return new(alloc) MFloor(num);
@@ -10981,17 +10981,17 @@ class MFloor
 class MCeil
   : public MUnaryInstruction,
     public FloatingPointPolicy<0>::Data
 {
     explicit MCeil(MDefinition *num)
       : MUnaryInstruction(num)
     {
         setResultType(MIRType_Int32);
-        setPolicyType(MIRType_Double);
+        specialization_ = MIRType_Double;
         setMovable();
     }
 
   public:
     INSTRUCTION_HEADER(Ceil)
 
     static MCeil *New(TempAllocator &alloc, MDefinition *num) {
         return new(alloc) MCeil(num);
@@ -11025,17 +11025,17 @@ class MCeil
 class MRound
   : public MUnaryInstruction,
     public FloatingPointPolicy<0>::Data
 {
     explicit MRound(MDefinition *num)
       : MUnaryInstruction(num)
     {
         setResultType(MIRType_Int32);
-        setPolicyType(MIRType_Double);
+        specialization_ = MIRType_Double;
         setMovable();
     }
 
   public:
     INSTRUCTION_HEADER(Round)
 
     static MRound *New(TempAllocator &alloc, MDefinition *num) {
         return new(alloc) MRound(num);
--- a/js/src/jit/TypePolicy.h
+++ b/js/src/jit/TypePolicy.h
@@ -216,34 +216,18 @@ class Float32Policy MOZ_FINAL : public T
     }
 };
 
 // Expect a float32 OR a double for operand Op, but will prioritize Float32
 // if the result type is set as such. If the input is a Value, it is unboxed.
 template <unsigned Op>
 class FloatingPointPolicy MOZ_FINAL : public TypePolicy
 {
-
   public:
-    struct PolicyTypeData
-    {
-        MIRType policyType_;
-
-        void setPolicyType(MIRType type) {
-            policyType_ = type;
-        }
-
-      protected:
-        MIRType &thisTypeSpecialization() {
-            return policyType_;
-        }
-    };
-
-    INHERIT_DATA_(PolicyTypeData);
-
+    SPECIALIZATION_DATA_;
     virtual bool adjustInputs(TempAllocator &alloc, MInstruction *def) MOZ_OVERRIDE;
 };
 
 template <unsigned Op>
 class NoFloatPolicy MOZ_FINAL : public TypePolicy
 {
   public:
     EMPTY_DATA_;