Exploit sharing when comparing and copying groups in ComputedStyle.

Groups inside ComputedStyle, such as StyleSurroundData, are stored as
pointers. When we copy the StyleSurroundData of a ComputedStyle, instead
of copying each member inside StyleSurroundData, we can copy the pointer
itself and do a copy when we write to it (copy-on-write). Similarly,
when we compare two StyleSurroundData pointers, we can first check if
they're pointing to the same object. If so, then we know that the two
StyleSurroundDatas are equal without having to compare each member
inside StyleSurroundData.

This patch introduces two macros: fieldwise_compare and fieldwise_copy,
which generate the code to do this optimisation. These macros take a
a list of fields to compare/copy and generate the cheapest set of code
for that task, taking advantage of group sharing.

This patch removes the perf cost of:

by generating the exact same code as what was originally handwritten.

Diff of generated code:


Review-Url: https://codereview.chromium.org/2826633002
Cr-Commit-Position: refs/heads/master@{#467243}
5 files changed