[Webkit-unassigned] [Bug 33896] FastAllocBase is probably making many of our objects a bit bigger

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Mar 31 01:02:42 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=33896


Zoltan Horvath <zoltan at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #48558|0                           |1
        is obsolete|                            |
  Attachment #48560|0                           |1
        is obsolete|                            |




--- Comment #4 from Zoltan Horvath <zoltan at webkit.org>  2010-03-31 01:02:41 PST ---
Created an attachment (id=52139)
 --> (https://bugs.webkit.org/attachment.cgi?id=52139)
List of classes whose size grows

I've put more effort on this topic, the results:

The problem:
If a FastAllocBase class' first member is a FasAllocBase class then padding is
added to the object and this making the object bigger.

The object's size grows by 4 bytes.
e.g. (on my Debian-x86)
FontPlatformDataCacheKey 28 bytes -> 32 bytes
Parser 76 bytes -> 80 bytes
MediaQueryExp 12 bytes -> 16 bytes

This problem stands for only in non-template cases, so aren't valid for the
following cases: 
  - if the class is inherited from FastAllocBase through (e.g.) RefCounted<X>,
padding are not added; 
  - if the first member is a template instantiation, padding are not added;

Solutions:
1. We can reorder the members (we can do this only a subset of the listed
classes)
e.g. struct ScopeNodeData (JavaScriptCore/parser/Nodes.h:1375)
If we place int m_numConstants; to the first member of ScopeNodeData padding
wont' be added.

2. Make FastAllocBase a class template and inherit from FastAllocBase<X>, so
padding won't be added.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list