Title: [235020] trunk/Source/WebCore
Revision
235020
Author
[email protected]
Date
2018-08-19 16:59:12 -0700 (Sun, 19 Aug 2018)

Log Message

Shrink size of WebCore::Event further by reordering members
https://bugs.webkit.org/show_bug.cgi?id=188734

Reviewed by Daniel Bates.

Since WebCore::Event is ref-counted class, it has 4bytes m_refCount at the head of the class.
So placing 4bytes just after that before placing 8bytes aligned member (like pointers in 64bit
platforms) can save the size of WebCore::Event further.
This patch reorders members of WebCore::Event to shrink the size from 80bytes to 72bytes.

No behavior change.

* dom/Event.cpp:
(WebCore::Event::Event):
* dom/Event.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (235019 => 235020)


--- trunk/Source/WebCore/ChangeLog	2018-08-19 22:54:24 UTC (rev 235019)
+++ trunk/Source/WebCore/ChangeLog	2018-08-19 23:59:12 UTC (rev 235020)
@@ -1,3 +1,21 @@
+2018-08-19  Yusuke Suzuki  <[email protected]>
+
+        Shrink size of WebCore::Event further by reordering members
+        https://bugs.webkit.org/show_bug.cgi?id=188734
+
+        Reviewed by Daniel Bates.
+
+        Since WebCore::Event is ref-counted class, it has 4bytes m_refCount at the head of the class.
+        So placing 4bytes just after that before placing 8bytes aligned member (like pointers in 64bit
+        platforms) can save the size of WebCore::Event further.
+        This patch reorders members of WebCore::Event to shrink the size from 80bytes to 72bytes.
+
+        No behavior change.
+
+        * dom/Event.cpp:
+        (WebCore::Event::Event):
+        * dom/Event.h:
+
 2018-08-18  David Kilzer  <[email protected]>
 
         Let Xcode have its way with the WebCore project

Modified: trunk/Source/WebCore/dom/Event.cpp (235019 => 235020)


--- trunk/Source/WebCore/dom/Event.cpp	2018-08-19 22:54:24 UTC (rev 235019)
+++ trunk/Source/WebCore/dom/Event.cpp	2018-08-19 23:59:12 UTC (rev 235020)
@@ -35,8 +35,7 @@
 namespace WebCore {
 
 ALWAYS_INLINE Event::Event(MonotonicTime createTime, const AtomicString& type, IsTrusted isTrusted, CanBubble canBubble, IsCancelable cancelable, IsComposed composed)
-    : m_type { type }
-    , m_isInitialized { !type.isNull() }
+    : m_isInitialized { !type.isNull() }
     , m_canBubble { canBubble == CanBubble::Yes }
     , m_cancelable { cancelable == IsCancelable::Yes }
     , m_composed { composed == IsComposed::Yes }
@@ -48,6 +47,7 @@
     , m_isTrusted { isTrusted == IsTrusted::Yes }
     , m_isExecutingPassiveEventListener { false }
     , m_eventPhase { NONE }
+    , m_type { type }
     , m_createTime { createTime }
 {
 }

Modified: trunk/Source/WebCore/dom/Event.h (235019 => 235020)


--- trunk/Source/WebCore/dom/Event.h	2018-08-19 22:54:24 UTC (rev 235019)
+++ trunk/Source/WebCore/dom/Event.h	2018-08-19 23:59:12 UTC (rev 235020)
@@ -45,7 +45,7 @@
     enum class IsCancelable : uint8_t { No, Yes };
     enum class IsComposed : uint8_t { No, Yes };
 
-    enum PhaseType {
+    enum PhaseType : uint8_t {
         NONE = 0,
         CAPTURING_PHASE = 1,
         AT_TARGET = 2,
@@ -153,8 +153,6 @@
 
     void setCanceledFlagIfPossible();
 
-    AtomicString m_type;
-
     unsigned m_isInitialized : 1;
     unsigned m_canBubble : 1;
     unsigned m_cancelable : 1;
@@ -170,6 +168,8 @@
 
     unsigned m_eventPhase : 2;
 
+    AtomicString m_type;
+
     RefPtr<EventTarget> m_currentTarget;
     const EventPath* m_eventPath { nullptr };
     RefPtr<EventTarget> m_target;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to