DescriptionExploit 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:
https://codereview.chromium.org/2786883002
by generating the exact same code as what was originally handwritten.
Diff of generated code:
https://gist.github.com/darrnshn/fe97404e680016753030fc788fcf24ff/revisions
BUG=628043
Review-Url: https://codereview.chromium.org/2826633002
Cr-Commit-Position: refs/heads/master@{#467243}
Committed: https://chromium.googlesource.com/chromium/src/+/51ad943c5fac355ab0166e1f47a104e8bc0b3bc6
Patch Set 1 #Patch Set 2 : Fix #Patch Set 3 : Fix #Patch Set 4 : Description #Patch Set 5 : Add comments #
Total comments: 2
Patch Set 6 : Fix #Patch Set 7 : Rebase #Patch Set 8 : Rebase #Patch Set 9 : Rebase #Patch Set 10 : Rebase #
Depends on Patchset: Dependent Patchsets: Messages
Total messages: 39 (32 generated)
|