Bug 73168 - CSSStyleRule: Pack m_sourceLine with CSSRule bits.
Summary: CSSStyleRule: Pack m_sourceLine with CSSRule bits.
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
Depends on:
Reported: 2011-11-27 07:40 PST by Andreas Kling
Modified: 2011-11-27 19:52 PST (History)
3 users (show)

See Also:

Patch (2.69 KB, patch)
2011-11-27 07:48 PST, Andreas Kling
koivisto: review+
koivisto: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2011-11-27 07:40:09 PST
We can save one CPU word per instance by packing CSSStyleRule::m_sourceLine with the other bits in CSSRule.
Comment 1 Andreas Kling 2011-11-27 07:48:17 PST
Created attachment 116672 [details]
Comment 2 WebKit Review Bot 2011-11-27 07:57:05 PST
Attachment 116672 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/css/CSSRule.h:125:  Please declare integral type bitfields with either signed or unsigned.  [runtime/bitfields] [5]
Total errors found: 1 in 3 files

If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Antti Koivisto 2011-11-27 10:48:22 PST
Comment on attachment 116672 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=116672&action=review

r=me, with the stylebot fix.

>> Source/WebCore/css/CSSRule.h:125
>> +    // Only used by CSSStyleRule but kept here to maximize struct packing.
>> +    int m_sourceLine : 27;
> Please declare integral type bitfields with either signed or unsigned.  [runtime/bitfields] [5]

I think it is nicer to keep the fields together even if it means multiple private/protected sections. Especially when the fields are being packed.
Comment 4 Andreas Kling 2011-11-27 19:52:00 PST
Committed r101218: <http://trac.webkit.org/changeset/101218>