Bug 1444125 - don't poison Maybe on construction; r=gerald
authorNathan Froyd <froydnj@mozilla.com>
Tue, 10 Apr 2018 13:46:00 -0400
changeset 412613 a2217ad18058ac7c3167c4a39028fc4fb1e18e31
parent 412612 84c72a259b96bf116456351fbd8361cce50ef9c2
child 412614 417fa1dd6bb9019f8b6da83096761be573bdc52b
push id101961
push usernfroyd@mozilla.com
push dateTue, 10 Apr 2018 17:46:36 +0000
treeherdermozilla-inbound@a2217ad18058 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1444125
milestone61.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 1444125 - don't poison Maybe on construction; r=gerald This behavior is pretty heavy-handed and degrades performance.
mfbt/Maybe.h
--- a/mfbt/Maybe.h
+++ b/mfbt/Maybe.h
@@ -179,78 +179,68 @@ class MOZ_NON_PARAM MOZ_INHERIT_TYPE_ANN
     detail::MaybePoisoner<T>::poison(data());
   }
 
 public:
   using ValueType = T;
 
   Maybe() : mIsSome(false)
   {
-    poisonData();
   }
   ~Maybe() { reset(); }
 
   MOZ_IMPLICIT Maybe(Nothing) : mIsSome(false)
   {
-    poisonData();
   }
 
   Maybe(const Maybe& aOther)
     : mIsSome(false)
   {
     if (aOther.mIsSome) {
       emplace(*aOther);
-    } else {
-      poisonData();
     }
   }
 
   /**
    * Maybe<T> can be copy-constructed from a Maybe<U> if U is convertible to T.
    */
   template<typename U,
            typename =
              typename std::enable_if<std::is_convertible<U, T>::value>::type>
   MOZ_IMPLICIT
   Maybe(const Maybe<U>& aOther)
     : mIsSome(false)
   {
     if (aOther.isSome()) {
       emplace(*aOther);
-    } else {
-      poisonData();
     }
   }
 
   Maybe(Maybe&& aOther)
     : mIsSome(false)
   {
     if (aOther.mIsSome) {
       emplace(Move(*aOther));
       aOther.reset();
-    } else {
-      poisonData();
     }
   }
 
   /**
    * Maybe<T> can be move-constructed from a Maybe<U> if U is convertible to T.
    */
   template<typename U,
            typename =
              typename std::enable_if<std::is_convertible<U, T>::value>::type>
   MOZ_IMPLICIT
   Maybe(Maybe<U>&& aOther)
     : mIsSome(false)
   {
     if (aOther.isSome()) {
       emplace(Move(*aOther));
       aOther.reset();
-    } else {
-      poisonData();
     }
   }
 
   Maybe& operator=(const Maybe& aOther)
   {
     if (&aOther != this) {
       if (aOther.mIsSome) {
         if (mIsSome) {