Bug 1269317 - Don't use AlignedStorage2 in RegisterSets.h. r=nbp a=sylvestre
☠☠ backed out by 8b7e3ca6ddb7 ☠ ☠
authorJan de Mooij <jdemooij@mozilla.com>
Mon, 09 May 2016 11:06:58 +0200
changeset 333193 e4d613a6d1caf92ec1b5804cf48fabe0f30b09de
parent 333192 3cc4a98864ad31001292b38c97df30962b9e94d0
child 333194 b73cfa00dab309c8b999550363df0c0456128b90
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp, sylvestre
bugs1269317
milestone48.0a2
Bug 1269317 - Don't use AlignedStorage2 in RegisterSets.h. r=nbp a=sylvestre
js/src/jit/RegisterSets.h
--- a/js/src/jit/RegisterSets.h
+++ b/js/src/jit/RegisterSets.h
@@ -2,17 +2,16 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef jit_RegisterSets_h
 #define jit_RegisterSets_h
 
-#include "mozilla/Alignment.h"
 #include "mozilla/MathAlgorithms.h"
 
 #include "jit/JitAllocPolicy.h"
 #include "jit/Registers.h"
 
 namespace js {
 namespace jit {
 
@@ -21,18 +20,18 @@ struct AnyRegister {
 
     static const uint32_t Total = Registers::Total + FloatRegisters::Total;
     static const uint32_t Invalid = UINT_MAX;
 
   private:
     Code code_;
 
   public:
-    AnyRegister()
-    { }
+    AnyRegister() = default;
+
     explicit AnyRegister(Register gpr) {
         code_ = gpr.code();
     }
     explicit AnyRegister(FloatRegister fpu) {
         code_ = fpu.code() + Registers::Total;
     }
     static AnyRegister FromCode(uint32_t i) {
         MOZ_ASSERT(i < Total);
@@ -164,76 +163,57 @@ class ValueOperand
 };
 
 // Registers to hold either either a typed or untyped value.
 class TypedOrValueRegister
 {
     // Type of value being stored.
     MIRType type_;
 
-    // Space to hold either an AnyRegister or a ValueOperand.
     union U {
-        mozilla::AlignedStorage2<AnyRegister> typed;
-        mozilla::AlignedStorage2<ValueOperand> value;
+        AnyRegister typed;
+        ValueOperand value;
     } data;
 
-    AnyRegister& dataTyped() {
-        MOZ_ASSERT(hasTyped());
-        return *data.typed.addr();
-    }
-    ValueOperand& dataValue() {
-        MOZ_ASSERT(hasValue());
-        return *data.value.addr();
-    }
-
-    AnyRegister dataTyped() const {
-        MOZ_ASSERT(hasTyped());
-        return *data.typed.addr();
-    }
-    const ValueOperand& dataValue() const {
-        MOZ_ASSERT(hasValue());
-        return *data.value.addr();
-    }
-
   public:
 
-    TypedOrValueRegister()
-      : type_(MIRType_None)
-    {}
+    TypedOrValueRegister() = default;
 
     TypedOrValueRegister(MIRType type, AnyRegister reg)
       : type_(type)
     {
-        dataTyped() = reg;
+        data.typed = reg;
     }
 
     MOZ_IMPLICIT TypedOrValueRegister(ValueOperand value)
       : type_(MIRType_Value)
     {
-        dataValue() = value;
+        data.value = value;
     }
 
     MIRType type() const {
         return type_;
     }
 
     bool hasTyped() const {
         return type() != MIRType_None && type() != MIRType_Value;
     }
 
     bool hasValue() const {
         return type() == MIRType_Value;
     }
 
     AnyRegister typedReg() const {
-        return dataTyped();
+        MOZ_ASSERT(hasTyped());
+        return data.typed;
     }
 
     ValueOperand valueReg() const {
-        return dataValue();
+        MOZ_ASSERT(hasValue());
+        return data.value;
     }
 
     AnyRegister scratchReg() {
         if (hasValue())
             return AnyRegister(valueReg().scratchReg());
         return typedReg();
     }
 };
@@ -241,27 +221,27 @@ class TypedOrValueRegister
 // A constant value, or registers to hold a typed/untyped value.
 class ConstantOrRegister
 {
     // Whether a constant value is being stored.
     bool constant_;
 
     // Space to hold either a Value or a TypedOrValueRegister.
     union U {
-        mozilla::AlignedStorage2<Value> constant;
-        mozilla::AlignedStorage2<TypedOrValueRegister> reg;
+        Value constant;
+        TypedOrValueRegister reg;
     } data;
 
     Value& dataValue() {
         MOZ_ASSERT(constant());
-        return *data.constant.addr();
+        return data.constant;
     }
     TypedOrValueRegister& dataReg() {
         MOZ_ASSERT(!constant());
-        return *data.reg.addr();
+        return data.reg;
     }
 
   public:
 
     ConstantOrRegister()
     {}
 
     MOZ_IMPLICIT ConstantOrRegister(Value value)