Bug 1464496 - Part 2: Move the mRaw before the two booleans for better packing r?emilio draft
authorNazım Can Altınova <canaltinova@gmail.com>
Thu, 31 May 2018 10:31:44 +0200
changeset 802013 bf4e6d2b4a30662cd5473038fbde9d5ddcfb7790
parent 802012 9130d9e25eb55b54a2ca1d4b648f3747f5f11fb1
push id111809
push userbmo:canaltinova@gmail.com
push dateThu, 31 May 2018 09:39:19 +0000
reviewersemilio
bugs1464496
milestone62.0a1
Bug 1464496 - Part 2: Move the mRaw before the two booleans for better packing r?emilio MozReview-Commit-ID: Gi4Is7RgVmN
layout/style/DeclarationBlock.h
--- a/layout/style/DeclarationBlock.h
+++ b/layout/style/DeclarationBlock.h
@@ -26,30 +26,30 @@ class Declaration;
 class Rule;
 } // namespace css
 
 class DeclarationBlock final
 {
 public:
   explicit DeclarationBlock(
     already_AddRefed<RawServoDeclarationBlock> aRaw)
-    : mImmutable(false)
+    : mRaw(aRaw)
+    , mImmutable(false)
     , mIsDirty(false)
-    , mRaw(aRaw)
   {
     mContainer.mRaw = 0;
   }
 
   DeclarationBlock()
     : DeclarationBlock(Servo_DeclarationBlock_CreateEmpty().Consume()) {}
 
   DeclarationBlock(const DeclarationBlock& aCopy)
-    : mImmutable(false)
+    : mRaw(Servo_DeclarationBlock_Clone(aCopy.mRaw).Consume())
+    , mImmutable(false)
     , mIsDirty(false)
-    , mRaw(Servo_DeclarationBlock_Clone(aCopy.mRaw).Consume())
   {
     mContainer.mRaw = 0;
   }
 
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DeclarationBlock)
 
   inline already_AddRefed<DeclarationBlock> Clone() const
   {
@@ -204,30 +204,30 @@ private:
     // The style rule that owns this declaration.  May be null.
     css::Rule* mOwningRule;
 
     // The nsHTMLCSSStyleSheet that is responsible for this declaration.
     // Only non-null for style attributes.
     nsHTMLCSSStyleSheet* mHTMLCSSStyleSheet;
   } mContainer;
 
+  RefPtr<RawServoDeclarationBlock> mRaw;
+
   // set when declaration put in the rule tree;
   bool mImmutable;
 
   // True if this declaration has not been restyled after modified.
   //
   // Since we can clear this flag from style worker threads, we use an Atomic.
   //
   // Note that although a single DeclarationBlock can be shared between
   // different rule nodes (due to the style="" attribute cache), whenever a
   // DeclarationBlock has its mIsDirty flag set to true, we always clone it to
   // a unique object first. So when we clear this flag during Servo traversal,
   // we know that we are clearing it on a DeclarationBlock that has a single
   // reference, and there is no problem with another user of the same
   // DeclarationBlock thinking that it is not dirty.
   Atomic<bool, MemoryOrdering::Relaxed> mIsDirty;
-
-  RefPtr<RawServoDeclarationBlock> mRaw;
 };
 
 } // namespace mozilla
 
 #endif // mozilla_DeclarationBlock_h