RESOLVED FIXED85751
Shrink TextRun object size
https://bugs.webkit.org/show_bug.cgi?id=85751
Summary Shrink TextRun object size
Rob Buis
Reported 2012-05-06 15:13:23 PDT
TextRun does not do a very good job of bit packing. Since most of the time this is an auto var, no big deal, but for SVG it is a member var of SVGTextMetricsBuilder, and thus RenderSVGText. It also is a member var in
Attachments
Patch (3.10 KB, patch)
2012-05-06 15:18 PDT, Rob Buis
no flags
Patch (3.71 KB, patch)
2012-05-06 16:08 PDT, Rob Buis
darin: review+
Rob Buis
Comment 1 2012-05-06 15:18:24 PDT
Eric Seidel (no email)
Comment 2 2012-05-06 15:49:01 PDT
Comment on attachment 140440 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=140440&action=review > Source/WebCore/platform/graphics/TextRun.h:170 > + ExpansionBehavior m_expansionBehavior : 2; bitfield enums will fail on MSVC (since they're signed). > Source/WebCore/platform/graphics/TextRun.h:172 > + TextDirection m_direction : 1; Similar problem.
Eric Seidel (no email)
Comment 3 2012-05-06 15:49:21 PDT
Also, if we're going to shrink the size of this, we should keep it small with a COMPILE_ASSERT.
Rob Buis
Comment 4 2012-05-06 16:08:25 PDT
Eric Seidel (no email)
Comment 5 2012-05-06 16:12:36 PDT
Comment on attachment 140442 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=140442&action=review > Source/WebCore/platform/graphics/TextRun.h:170 > + ExpansionBehavior m_expansionBehavior : 2; Same problem as before. MSVC will make the enum signed, and thus you'll have one fewer bit than you think you do. :) I thought we had helper macros for this?
Rob Buis
Comment 6 2012-05-06 16:14:53 PDT
Hi Eric, (In reply to comment #5) > (From update of attachment 140442 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=140442&action=review > > > Source/WebCore/platform/graphics/TextRun.h:170 > > + ExpansionBehavior m_expansionBehavior : 2; > > Same problem as before. MSVC will make the enum signed, and thus you'll have one fewer bit than you think you do. :) I thought we had helper macros for this? It is an unsigned in disguise! typedef unsigned ExpansionBehavior;
Darin Adler
Comment 7 2012-05-06 18:09:52 PDT
Comment on attachment 140442 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=140442&action=review Can we add some compile time assertions to check if this is packed right, like we normally do in cases like this? >>> Source/WebCore/platform/graphics/TextRun.h:170 >>> + ExpansionBehavior m_expansionBehavior : 2; >> >> Same problem as before. MSVC will make the enum signed, and thus you'll have one fewer bit than you think you do. :) I thought we had helper macros for this? > > It is an unsigned in disguise! > > typedef unsigned ExpansionBehavior; Why not be explicit about it, given the likelihood of confusion?
Rob Buis
Comment 8 2012-05-06 19:32:36 PDT
Hi Darin, (In reply to comment #7) > (From update of attachment 140442 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=140442&action=review > > Can we add some compile time assertions to check if this is packed right, like we normally do in cases like this? Good idea, did that before landing. > >>> Source/WebCore/platform/graphics/TextRun.h:170 > >>> + ExpansionBehavior m_expansionBehavior : 2; > >> > >> Same problem as before. MSVC will make the enum signed, and thus you'll have one fewer bit than you think you do. :) I thought we had helper macros for this? > > > > It is an unsigned in disguise! > > > > typedef unsigned ExpansionBehavior; > > Why not be explicit about it, given the likelihood of confusion? I tried but unfortunately this would mean changing a lot of files that use this ExpansionBehavior. Let me know if you want a follow-up bug for that. Cheers, Rob.
Raphael Kubo da Costa (:rakuco)
Comment 9 2012-05-06 19:52:47 PDT
Build fix for r116260 landed in r116262.
Rob Buis
Comment 10 2012-05-07 04:11:43 PDT
(In reply to comment #9) > Build fix for r116260 landed in r116262. Thanks!
Rob Buis
Comment 11 2012-05-07 04:12:09 PDT
Landed in r116260.
Note You need to log in before you can comment on or make changes to this bug.