Use a singleton invalidation set for self invalidations.

We used to create separate invalidation set instances for every single
invalidation set which just contains InvalidatesSelf(). That is, every
simple selector which only appears in the rightmost compound selector:

.a {}
#b:hover {}
#parent > .c {}

The invalidation sets for ".a", "#b", ".c", and ":hover" above are all
the same with only InvalidatesSelf() set.

Instead we can use a singleton invalidation set which is shared for all
such invalidation sets. If we later add more features to the set, we
replace the singleton with a new DescendantInvalidationSet instance
with InvalidatesSelf() set and add new features to that set.

This reduces memory use for invalidation sets from ~1MB to ~256kB on
facebook.com (see measurements in 773880).

Bug: 773880
Change-Id: I1018cea1f51628f1f940c3722cc2b48a3164a777
Reviewed-on: https://chromium-review.googlesource.com/713859
Reviewed-by: Eric Willigers <ericwilligers@chromium.org>
Commit-Queue: Rune Lillesveen <rune@opera.com>
Cr-Commit-Position: refs/heads/master@{#508692}
7 files changed