Commit 2abe5b0b authored by ch.dumez@samsung.com's avatar ch.dumez@samsung.com

Reduce the size of Node by 8 bytes on 64bit with gcc/clang compilers

Reduce the size of Node by 8 bytes on 64bit with gcc and clang compilers
(from 72 bytes to 64 bytes) by altering the order of its parent classes. The
TreeShared<Node> parent class now comes last because it contains only 1 member
(in release) which is an int and the first member of Node is a uint32_t. This
way no padding is added by gcc/clang and these two members will use the same
word in memory.

MSVC likely won't get any benefit from this because it makes sure each class
in the hierarchy is memory-aligned (see "Compiler being used" section in [1]).
There should be no size impact for MSVC.

[1] http://www.cprogramming.com/tutorial/size_of_class_object.html

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/326793002

git-svn-id: svn://svn.chromium.org/blink/trunk@175844 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b394211b
...@@ -107,7 +107,7 @@ private: ...@@ -107,7 +107,7 @@ private:
RenderObject* m_renderer; RenderObject* m_renderer;
}; };
class Node : public TreeSharedWillBeRefCountedGarbageCollected<Node>, public EventTarget, public ScriptWrappable { class Node : public EventTarget, public ScriptWrappable, public TreeSharedWillBeRefCountedGarbageCollected<Node> {
friend class Document; friend class Document;
friend class TreeScope; friend class TreeScope;
friend class TreeScopeAdopter; friend class TreeScopeAdopter;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment