Add heuristic to order non bit fields in ComputedStyleBase.

Currently, when we generate non bit fields, we order them in
alphabetical order. This may result in unnecessary padding, e.g.

struct {
  char a;
  /* char padding[3] */
  int b;
  char c;
  /* char padding[3] */
};

See [1] for an explanation.

This patch defines an ordering on field types so that we can sort
non bit fields from largest alignment size to smallest. This heuristic
minimises the padding most of the time:

struct {
  int b;
  char a;
  char c;
  /* char padding[2] */
};

This is purely a memory optimisation, not speed. It does not take into
account data access patterns and cache locality. We use the data from
[2] to define the order of types.

With this heuristic, some of the generated code has changed, but it is
unlikely to have changed the size of any structs.

Diff of generated files:
https://gist.github.com/darrnshn/81d146c2696ef100d56309e5b4b529ff/revisions

[1] http://www.drdobbs.com/cpp/padding-and-rearranging-structure-member/240007649?pgno=2
[2] https://codereview.chromium.org/2841413002

BUG=628043

Review-Url: https://codereview.chromium.org/2844223002
Cr-Commit-Position: refs/heads/master@{#468293}
1 file changed