Bug 1287006 - Put Maybe::mIsSome after mStorage to allow for possible efficient packing. - r=waldo draft
authorJeff Gilbert <jgilbert@mozilla.com>
Thu, 14 Jul 2016 14:55:20 -0700
changeset 387890 28149d6a371960783eee4eb814d2e82aec889f06
parent 387889 a511bb0ae889d7550a54533858d8a42029e60b17
child 525473 8ebfd4f2bb1c98a4358762f73c04d36a9bf6fbe6
push id23095
push userbmo:jgilbert@mozilla.com
push dateFri, 15 Jul 2016 00:30:49 +0000
reviewerswaldo
bugs1287006
milestone50.0a1
Bug 1287006 - Put Maybe::mIsSome after mStorage to allow for possible efficient packing. - r=waldo MozReview-Commit-ID: 6SmVUkRDM7s
mfbt/Maybe.h
--- a/mfbt/Maybe.h
+++ b/mfbt/Maybe.h
@@ -77,18 +77,18 @@ struct Nothing { };
  *
  * N.B. GCC has missed optimizations with Maybe in the past and may generate
  * extra branches/loads/stores. Use with caution on hot paths; it's not known
  * whether or not this is still a problem.
  */
 template<class T>
 class Maybe
 {
+  AlignedStorage2<T> mStorage;
   bool mIsSome;
-  AlignedStorage2<T> mStorage;
 
 public:
   typedef T ValueType;
 
   Maybe() : mIsSome(false) { }
   ~Maybe() { reset(); }
 
   MOZ_IMPLICIT Maybe(Nothing) : mIsSome(false) { }