Skip to content

Commit

Permalink
Merge r235020 - Shrink size of WebCore::Event further by reordering m…
Browse files Browse the repository at this point in the history
…embers

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:
  • Loading branch information
Constellation authored and carlosgcampos committed Aug 20, 2018
1 parent 5cb0d8b commit 74a35b7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
18 changes: 18 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,21 @@
2018-08-19 Yusuke Suzuki <yusukesuzuki@slowstart.org>

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 Ali Juma <ajuma@chromium.org>

[IntersectionObserver] Fire an initial dummy notification
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/dom/Event.cpp
Expand Up @@ -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 }
Expand All @@ -48,6 +47,7 @@ ALWAYS_INLINE Event::Event(MonotonicTime createTime, const AtomicString& type, I
, m_isTrusted { isTrusted == IsTrusted::Yes }
, m_isExecutingPassiveEventListener { false }
, m_eventPhase { NONE }
, m_type { type }
, m_createTime { createTime }
{
}
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/dom/Event.h
Expand Up @@ -45,7 +45,7 @@ class Event : public ScriptWrappable, public RefCounted<Event> {
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,
Expand Down Expand Up @@ -153,8 +153,6 @@ class Event : public ScriptWrappable, public RefCounted<Event> {

void setCanceledFlagIfPossible();

AtomicString m_type;

unsigned m_isInitialized : 1;
unsigned m_canBubble : 1;
unsigned m_cancelable : 1;
Expand All @@ -170,6 +168,8 @@ class Event : public ScriptWrappable, public RefCounted<Event> {

unsigned m_eventPhase : 2;

AtomicString m_type;

RefPtr<EventTarget> m_currentTarget;
const EventPath* m_eventPath { nullptr };
RefPtr<EventTarget> m_target;
Expand Down

0 comments on commit 74a35b7

Please sign in to comment.