Backed out 2 changesets (bug 1269319, bug 1269317)
authorJan de Mooij <jdemooij@mozilla.com>
Wed, 01 Jun 2016 12:26:12 +0200
changeset 333195 8b7e3ca6ddb7c3d7ad1dfd8b61ab18189e6ca1f3
parent 333194 b73cfa00dab309c8b999550363df0c0456128b90
child 333196 76d7c6af162c72bbc0b8fb4be01159408b9f2ff4
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)
bugs1269319, 1269317
milestone48.0a2
backs outb73cfa00dab309c8b999550363df0c0456128b90
e4d613a6d1caf92ec1b5804cf48fabe0f30b09de
Backed out 2 changesets (bug 1269319, bug 1269317) Backed out changeset b73cfa00dab3 (bug 1269319) Backed out changeset e4d613a6d1ca (bug 1269317)
dom/plugins/base/nsJSNPRuntime.h
js/public/HashTable.h
js/src/jit/JitCompartment.h
js/src/jit/RegisterSets.h
js/src/jit/Snapshots.h
js/src/vm/ObjectGroup.cpp
mfbt/Alignment.h
--- a/dom/plugins/base/nsJSNPRuntime.h
+++ b/dom/plugins/base/nsJSNPRuntime.h
@@ -33,27 +33,18 @@ public:
   bool operator!=(const nsJSObjWrapperKey& other) const {
     return !(*this == other);
   }
 
   void trace(JSTracer* trc) {
       JS::TraceEdge(trc, &mJSObj, "nsJSObjWrapperKey");
   }
 
-  nsJSObjWrapperKey(const nsJSObjWrapperKey& other)
-    : mJSObj(other.mJSObj),
-      mNpp(other.mNpp)
-  {}
-  void operator=(const nsJSObjWrapperKey& other) {
-    mJSObj = other.mJSObj;
-    mNpp = other.mNpp;
-  }
-
   JS::Heap<JSObject*> mJSObj;
-  NPP mNpp;
+  const NPP mNpp;
 };
 
 class nsJSObjWrapper : public NPObject
 {
 public:
   JS::Heap<JSObject *> mJSObj;
   const NPP mNpp;
   bool mDestroyPending;
--- a/js/public/HashTable.h
+++ b/js/public/HashTable.h
@@ -699,21 +699,16 @@ class HashMapEntry
         value_(mozilla::Forward<ValueInput>(v))
     {}
 
     HashMapEntry(HashMapEntry&& rhs)
       : key_(mozilla::Move(rhs.key_)),
         value_(mozilla::Move(rhs.value_))
     {}
 
-    void operator=(HashMapEntry&& rhs) {
-        key_ = mozilla::Move(rhs.key_);
-        value_ = mozilla::Move(rhs.value_);
-    }
-
     typedef Key KeyType;
     typedef Value ValueType;
 
     const Key& key() const { return key_; }
     Key& mutableKey() { return key_; }
     const Value& value() const { return value_; }
     Value& value() { return value_; }
 
@@ -774,26 +769,18 @@ class HashTableEntry
     }
 
     void destroy() {
         MOZ_ASSERT(isLive());
         mem.addr()->~T();
     }
 
     void swap(HashTableEntry* other) {
-        if (this == other)
-            return;
-        MOZ_ASSERT(isLive());
-        if (other->isLive()) {
-            mozilla::Swap(*mem.addr(), *other->mem.addr());
-        } else {
-            *other->mem.addr() = mozilla::Move(*mem.addr());
-            destroy();
-        }
         mozilla::Swap(keyHash, other->keyHash);
+        mozilla::Swap(mem, other->mem);
     }
 
     T& get() { MOZ_ASSERT(isLive()); return *mem.addr(); }
     NonConstT& getMutable() { MOZ_ASSERT(isLive()); return *mem.addr(); }
 
     bool isFree() const    { return keyHash == sFreeKey; }
     void clearLive()       { MOZ_ASSERT(isLive()); keyHash = sFreeKey; mem.addr()->~T(); }
     void clear()           { if (isLive()) mem.addr()->~T(); keyHash = sFreeKey; }
--- a/js/src/jit/JitCompartment.h
+++ b/js/src/jit/JitCompartment.h
@@ -398,20 +398,16 @@ struct CacheIRStubKey : public DefaultHa
 
     static HashNumber hash(const Lookup& l);
     static bool match(const CacheIRStubKey& entry, const Lookup& l);
 
     UniquePtr<CacheIRStubInfo, JS::FreePolicy> stubInfo;
 
     explicit CacheIRStubKey(CacheIRStubInfo* info) : stubInfo(info) {}
     CacheIRStubKey(CacheIRStubKey&& other) : stubInfo(Move(other.stubInfo)) { }
-
-    void operator=(CacheIRStubKey&& other) {
-        stubInfo = Move(other.stubInfo);
-    }
 };
 
 class JitCompartment
 {
     friend class JitActivation;
 
     template<typename Key>
     struct IcStubCodeMapGCPolicy {
--- a/js/src/jit/RegisterSets.h
+++ b/js/src/jit/RegisterSets.h
@@ -2,16 +2,17 @@
  * 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 {
 
@@ -20,18 +21,18 @@ struct AnyRegister {
 
     static const uint32_t Total = Registers::Total + FloatRegisters::Total;
     static const uint32_t Invalid = UINT_MAX;
 
   private:
     Code code_;
 
   public:
-    AnyRegister() = default;
-
+    AnyRegister()
+    { }
     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);
@@ -163,57 +164,76 @@ 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 {
-        AnyRegister typed;
-        ValueOperand value;
+        mozilla::AlignedStorage2<AnyRegister> typed;
+        mozilla::AlignedStorage2<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() = default;
+    TypedOrValueRegister()
+      : type_(MIRType_None)
+    {}
 
     TypedOrValueRegister(MIRType type, AnyRegister reg)
       : type_(type)
     {
-        data.typed = reg;
+        dataTyped() = reg;
     }
 
     MOZ_IMPLICIT TypedOrValueRegister(ValueOperand value)
       : type_(MIRType_Value)
     {
-        data.value = value;
+        dataValue() = 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 {
-        MOZ_ASSERT(hasTyped());
-        return data.typed;
+        return dataTyped();
     }
 
     ValueOperand valueReg() const {
-        MOZ_ASSERT(hasValue());
-        return data.value;
+        return dataValue();
     }
 
     AnyRegister scratchReg() {
         if (hasValue())
             return AnyRegister(valueReg().scratchReg());
         return typedReg();
     }
 };
@@ -221,27 +241,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 {
-        Value constant;
-        TypedOrValueRegister reg;
+        mozilla::AlignedStorage2<Value> constant;
+        mozilla::AlignedStorage2<TypedOrValueRegister> reg;
     } data;
 
     Value& dataValue() {
         MOZ_ASSERT(constant());
-        return data.constant;
+        return *data.constant.addr();
     }
     TypedOrValueRegister& dataReg() {
         MOZ_ASSERT(!constant());
-        return data.reg;
+        return *data.reg.addr();
     }
 
   public:
 
     ConstantOrRegister()
     {}
 
     MOZ_IMPLICIT ConstantOrRegister(Value value)
--- a/js/src/jit/Snapshots.h
+++ b/js/src/jit/Snapshots.h
@@ -499,35 +499,17 @@ class SnapshotReader
     uint32_t numAllocationsRead() const {
         return allocRead_;
     }
     void resetNumAllocationsRead() {
         allocRead_ = 0;
     }
 };
 
-class RInstructionStorage
-{
-    static const size_t Size = 4 * sizeof(uint32_t);
-    mozilla::AlignedStorage<Size> mem;
-
-  public:
-    const void* addr() const { return mem.addr(); }
-    void* addr() { return mem.addr(); }
-
-    RInstructionStorage() = default;
-
-    RInstructionStorage(const RInstructionStorage& other) {
-        memcpy(addr(), other.addr(), Size);
-    }
-    void operator=(const RInstructionStorage& other) {
-        memcpy(addr(), other.addr(), Size);
-    }
-};
-
+typedef mozilla::AlignedStorage<4 * sizeof(uint32_t)> RInstructionStorage;
 class RInstruction;
 
 class RecoverReader
 {
     CompactBufferReader reader_;
 
     // Number of encoded instructions.
     uint32_t numInstructions_;
--- a/js/src/vm/ObjectGroup.cpp
+++ b/js/src/vm/ObjectGroup.cpp
@@ -1349,36 +1349,29 @@ struct ObjectGroupCompartment::Allocatio
     static const uint32_t OFFSET_LIMIT = (1 << 23);
 
     AllocationSiteKey(JSScript* script_, uint32_t offset_, JSProtoKey kind_, JSObject* proto_)
       : script(script_), offset(offset_), kind(kind_), proto(proto_)
     {
         MOZ_ASSERT(offset_ < OFFSET_LIMIT);
     }
 
-    AllocationSiteKey(const AllocationSiteKey& key)
-      : script(key.script),
-        offset(key.offset),
-        kind(key.kind),
-        proto(key.proto)
-    { }
-
     AllocationSiteKey(AllocationSiteKey&& key)
       : script(mozilla::Move(key.script)),
         offset(key.offset),
         kind(key.kind),
         proto(mozilla::Move(key.proto))
     { }
 
-    void operator=(AllocationSiteKey&& key) {
-        script = mozilla::Move(key.script);
-        offset = key.offset;
-        kind = key.kind;
-        proto = mozilla::Move(key.proto);
-    }
+    AllocationSiteKey(const AllocationSiteKey& key)
+      : script(key.script),
+        offset(key.offset),
+        kind(key.kind),
+        proto(key.proto)
+    { }
 
     static inline uint32_t hash(AllocationSiteKey key) {
         return uint32_t(size_t(key.script->offsetToPC(key.offset)) ^ key.kind ^
                MovableCellHasher<JSObject*>::hash(key.proto));
     }
 
     static inline bool match(const AllocationSiteKey& a, const AllocationSiteKey& b) {
         return DefaultHasher<JSScript*>::match(a.script, b.script) &&
--- a/mfbt/Alignment.h
+++ b/mfbt/Alignment.h
@@ -115,40 +115,26 @@ struct AlignedStorage
   union U
   {
     char mBytes[Nbytes];
     uint64_t mDummy;
   } u;
 
   const void* addr() const { return u.mBytes; }
   void* addr() { return u.mBytes; }
-
-  AlignedStorage() = default;
-
-  // AlignedStorage is non-copyable: the default copy constructor violates
-  // strict aliasing rules, per bug 1269319.
-  AlignedStorage(const AlignedStorage&) = delete;
-  void operator=(const AlignedStorage&) = delete;
 };
 
 template<typename T>
 struct MOZ_INHERIT_TYPE_ANNOTATIONS_FROM_TEMPLATE_ARGS AlignedStorage2
 {
   union U
   {
     char mBytes[sizeof(T)];
     uint64_t mDummy;
   } u;
 
   const T* addr() const { return reinterpret_cast<const T*>(u.mBytes); }
   T* addr() { return static_cast<T*>(static_cast<void*>(u.mBytes)); }
-
-  AlignedStorage2() = default;
-
-  // AlignedStorage2 is non-copyable: the default copy constructor violates
-  // strict aliasing rules, per bug 1269319.
-  AlignedStorage2(const AlignedStorage2&) = delete;
-  void operator=(const AlignedStorage2&) = delete;
 };
 
 } /* namespace mozilla */
 
 #endif /* mozilla_Alignment_h */