From 37e9cf49582328f541f0ff25e287cf2236a8719f Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Tue, 1 Dec 2015 19:24:49 +0100 Subject: [PATCH] Bug 1229396: Templatize Float/Double/SimdData in MacroAssembler-x86-shared.h; r=jandem --- .../x86-shared/MacroAssembler-x86-shared.h | 39 +++++++------------ 1 file changed, 14 insertions(+), 25 deletions(-) diff --git a/js/src/jit/x86-shared/MacroAssembler-x86-shared.h b/js/src/jit/x86-shared/MacroAssembler-x86-shared.h index 297e1724532..6b889daac86 100644 --- a/js/src/jit/x86-shared/MacroAssembler-x86-shared.h +++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared.h @@ -52,46 +52,35 @@ class MacroAssemblerX86Shared : public Assembler // For Double, Float and SimdData, make the move ctors explicit so that MSVC // knows what to use instead of copying these data structures. - struct Double { - typedef double Pod; - double value; + template + struct Constant { + typedef T Pod; + + T value; UsesVector uses; - explicit Double(double value) : value(value) {} - Double(Double&& other) : value(other.value), uses(mozilla::Move(other.uses)) {} - explicit Double(const Double&) = delete; + explicit Constant(const T& value) : value(value) {} + Constant(Constant&& other) : value(other.value), uses(mozilla::Move(other.uses)) {} + explicit Constant(const Constant&) = delete; }; - // These use SystemAllocPolicy since asm.js releases memory after each + // Containers use SystemAllocPolicy since asm.js releases memory after each // function is compiled, and these need to live until after all functions // are compiled. + using Double = Constant; Vector doubles_; typedef HashMap, SystemAllocPolicy> DoubleMap; DoubleMap doubleMap_; - struct Float { - typedef float Pod; - float value; - UsesVector uses; - - explicit Float(float value) : value(value) {} - Float(Float&& other) : value(other.value), uses(mozilla::Move(other.uses)) {} - explicit Float(const Float&) = delete; - }; - + using Float = Constant; Vector floats_; typedef HashMap, SystemAllocPolicy> FloatMap; FloatMap floatMap_; - struct SimdData { - typedef SimdConstant Pod; - SimdConstant value; - UsesVector uses; - - explicit SimdData(const SimdConstant& v) : value(v) {} - SimdData(SimdData&& other) : value(other.value), uses(mozilla::Move(other.uses)) {} + struct SimdData : public Constant { + explicit SimdData(SimdConstant d) : Constant(d) {} + SimdData(SimdData&& d) : Constant(mozilla::Move(d)) {} explicit SimdData(const SimdData&) = delete; - SimdConstant::Type type() const { return value.type(); } };