Bug 73168

Summary: CSSStyleRule: Pack m_sourceLine with CSSRule bits.
Product: WebKit Reporter: Andreas Kling <kling>
Component: CSSAssignee: Andreas Kling <kling>
Status: RESOLVED FIXED    
Severity: Normal CC: koivisto, macpherson, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch koivisto: review+, koivisto: commit-queue-

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]
Patch
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]
Patch

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>