Title: [233652] trunk/Source/WebCore
Revision
233652
Author
[email protected]
Date
2018-07-09 12:23:37 -0700 (Mon, 09 Jul 2018)

Log Message

Shrink WebCore::Pair
https://bugs.webkit.org/show_bug.cgi?id=187450

Reviewed by Sam Weinig.

Move m_encoding to pack in with m_refCount and remove the virtual destructor,
shrinking the class from 40 to 24 bytes.
Also make the enum take only a byte, in case it gets used elsewhere

There are about 500 Pairs on nytimes.com, so this memory saving is non-trivial.

* css/Pair.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (233651 => 233652)


--- trunk/Source/WebCore/ChangeLog	2018-07-09 19:20:12 UTC (rev 233651)
+++ trunk/Source/WebCore/ChangeLog	2018-07-09 19:23:37 UTC (rev 233652)
@@ -1,3 +1,18 @@
+2018-07-09  Simon Fraser  <[email protected]>
+
+        Shrink WebCore::Pair
+        https://bugs.webkit.org/show_bug.cgi?id=187450
+
+        Reviewed by Sam Weinig.
+
+        Move m_encoding to pack in with m_refCount and remove the virtual destructor,
+        shrinking the class from 40 to 24 bytes.
+        Also make the enum take only a byte, in case it gets used elsewhere
+        
+        There are about 500 Pairs on nytimes.com, so this memory saving is non-trivial.
+
+        * css/Pair.h:
+
 2018-07-09  Yusuke Suzuki  <[email protected]>
 
         [WebCore] Annotate classes with WTF_MAKE_FAST_ALLOCATED as much as possible

Modified: trunk/Source/WebCore/css/Pair.h (233651 => 233652)


--- trunk/Source/WebCore/css/Pair.h	2018-07-09 19:20:12 UTC (rev 233651)
+++ trunk/Source/WebCore/css/Pair.h	2018-07-09 19:23:37 UTC (rev 233652)
@@ -30,9 +30,9 @@
 // and border-spacing (all of which are space-separated sets of two values).  At the moment we are only using it for
 // border-radius and background-size, but (FIXME) border-spacing and background-position could be converted over to use
 // it (eliminating some extra -webkit- internal properties).
-class Pair final : public RefCounted<Pair> {
+class Pair : public RefCounted<Pair> {
 public:
-    enum class IdenticalValueEncoding {
+    enum class IdenticalValueEncoding : uint8_t {
         DoNotCoalesce,
         Coalesce
     };
@@ -45,8 +45,6 @@
     {
         return adoptRef(*new Pair(WTFMove(first), WTFMove(second), encoding));
     }
-    virtual ~Pair() = default;
-
     CSSPrimitiveValue* first() const { return m_first.get(); }
     CSSPrimitiveValue* second() const { return m_second.get(); }
 
@@ -62,12 +60,20 @@
     bool equals(const Pair& other) const { return compareCSSValuePtr(m_first, other.m_first) && compareCSSValuePtr(m_second, other.m_second); }
 
 private:
-    Pair(RefPtr<CSSPrimitiveValue>&& first, RefPtr<CSSPrimitiveValue>&& second) : m_first(WTFMove(first)), m_second(WTFMove(second)) { }
-    Pair(RefPtr<CSSPrimitiveValue>&& first, RefPtr<CSSPrimitiveValue>&& second, IdenticalValueEncoding encoding) : m_first(WTFMove(first)), m_second(WTFMove(second)), m_encoding(encoding) { }
+    Pair(RefPtr<CSSPrimitiveValue>&& first, RefPtr<CSSPrimitiveValue>&& second)
+        : m_first(WTFMove(first))
+        , m_second(WTFMove(second))
+    { }
 
+    Pair(RefPtr<CSSPrimitiveValue>&& first, RefPtr<CSSPrimitiveValue>&& second, IdenticalValueEncoding encoding)
+        : m_encoding(encoding)
+        , m_first(WTFMove(first))
+        , m_second(WTFMove(second))
+    { }
+
+    IdenticalValueEncoding m_encoding { IdenticalValueEncoding::Coalesce };
     RefPtr<CSSPrimitiveValue> m_first;
     RefPtr<CSSPrimitiveValue> m_second;
-    IdenticalValueEncoding m_encoding { IdenticalValueEncoding::Coalesce };
 };
 
 } // namespace
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to