Commit graph

28 commits

Author SHA1 Message Date
Nicholas Nethercote
32548e5312 Overhaul MallocSizeOf and related things.
This patch makes the MallocSizeOf stuff in Stylo work more like the HeapSizeOf
stuff already in Servo, except better. In particular, it adds deriving support
for MallocSizeOf, which will make it easier to improve coverage.

The patch does the following.

- Combines servo/components/style/stylesheets/memory.rs and the heapsize crate
  into a new crate, malloc_size_of.

- Forks the heapsize_derive crate, calling it malloc_size_of, so that
  MallocSizeOf can be derived.

- Both the new crates have MIT/Apache licenses, like heapsize, in case they are
  incorporated into heapsize in the future.

- Renames the methods within MallocSizeOf and the related traits so they are
  more concise.

- Removes MallocSizeOfWithGuard.

- Adds `derive(MallocSizeOf)` to a lot of types, in some cases replacing an
  equivalent or almost-equivalent hand-written implementation.

- Adds stuff so that Rc/Arc can be handled properly.
2017-09-12 12:37:51 +10:00
Julian Seward
c85633f48e
stylo: Add uses of fallible Vec, SmallVec and HashMap facilities.
Bug: 1395064
Reviewed-by: emilio
2017-09-10 16:42:06 +02:00
Emilio Cobos Álvarez
0a1a134050
style: remove selector_map::find_push.
It has a single caller and is overly generic, which is going to make harder to
add fallible allocations to it.
2017-09-09 09:56:09 +02:00
Nicholas Nethercote
ae1216a717 Measure SmallVecs in SelectorMap and InvalidationMap. 2017-09-06 15:39:20 +10:00
Nicholas Nethercote
d880efcab3
Measure the stylist during memory reporting. 2017-09-05 19:43:50 +02:00
Manish Goregaokar
3ddb1fda74 Tidy fixes 2017-09-01 09:53:18 -07:00
Manish Goregaokar
5cd296a264
stylo: Replace all hashtable collections with ones from style::hash 2017-08-31 16:28:30 -07:00
Emilio Cobos Álvarez
4c80cccbd2
stylo: Cleanup a bit of the Stylist clear setup.
This moves us to clear on rebuild, which allows us to remove yet another place
where we track stylist dirtiness.

Bug: 1390255
Reviewed-by: heycam
MozReview-Commit-ID: nihQbUAbh8
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-16 08:49:41 +02:00
Emilio Cobos Álvarez
b040d79333
style: Avoid multiple selector walk-ups during SelectorMap insertion.
MozReview-Commit-ID: 5b2X0GL2753
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-16 08:49:39 +02:00
Emilio Cobos Álvarez
64a96ce21c
style: Rework how precomputed pseudo stuff works, to avoid malloc/free churn.
This showed up in a few profiles, and was an easy improvement.

MozReview-Commit-ID: HVqATaSB2Ak
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-08 10:28:02 +02:00
Emilio Cobos Álvarez
b67c8935eb
style: Remove outdated comments. 2017-08-07 18:31:17 +02:00
Emilio Cobos Álvarez
3d54c0710f
style: Make PrecomputedHasher fail loudly and with error messages when used incorrectly. 2017-08-07 14:12:40 +02:00
Emilio Cobos Álvarez
720b17a54b
style: Avoid hashing the precomputed hash atoms already have.
This shaves a fair amount of time of stylist rebuild.

Most of the extra remaining overhead are memory allocations...

I'll try to get those sorted out next, though fixing that may overlap quite a
bit with the work Cameron is doing in bug 1382925.

MozReview-Commit-ID: 3j2SBY4QnKf
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-08-07 14:12:39 +02:00
Bobby Holley
2f39213072 Use a 1-entry smallvec in the selector maps.
MozReview-Commit-ID: 1JPkVxs3cdP
2017-08-06 23:15:13 -07:00
Emilio Cobos Álvarez
445b8fb3e8
style: Remove SelectorAndHashes. 2017-07-13 05:44:55 +02:00
Emilio Cobos Álvarez
dee4aea264
style: Remove hashes from style rules and dependencies.
Dependencies are very numerous, and now we shouldn't be getting so many of them.

Style rules just don't need them, so it's a waste of memory.
2017-07-13 05:44:53 +02:00
Emilio Cobos Álvarez
9394ea9644
style: Remove unneeded bounds in SelectorMap and related code.
MozReview-Commit-ID: CWwdVCwWijn
2017-07-13 03:34:33 +02:00
Bobby Holley
1c7f2a9f09 Account for left-to-right rather than right-to-left precedence of classes in selector maps.
MozReview-Commit-ID: 8qIl4k3RxaC
2017-06-20 11:59:12 -07:00
Emilio Cobos Álvarez
cb06375fe2
style: Implement a more fine-grained invalidation method.
This commit also removes the old restyle_hints module and splits it into
multiple modules under components/style/invalidation/element/.

The basic approach is to walk down the tree using compound selectors as needed,
in order to do as little selector-matching as possible.

Bug: 1368240
MozReview-Commit-ID: 2YO8fKFygZI
2017-06-13 13:26:41 +02:00
Simon Sapin
5bccf98aa4 ID and class selectors are ASCII case-insensitive in quirks mode.
https://bugzilla.mozilla.org/show_bug.cgi?id=1363778
2017-06-12 23:33:53 +02:00
Bobby Holley
a98fff1af8 Hoist ApplicableDeclaration{Block,List} into a separate file.
MozReview-Commit-ID: EXnAzfyoZ1e
2017-06-12 12:13:21 -07:00
Bobby Holley
0caad2ffdc Use even fewer bits for source order and shrink ApplicableDeclarationsBlock by another word.
MozReview-Commit-ID: 7B1i1g0HLTj
2017-06-12 12:13:16 -07:00
Bobby Holley
1281fd9353 Stop slicing selectors when noting dependencies, and match with an offset instead.
MozReview-Commit-ID: KLqmdRKygO0
2017-06-05 19:44:01 -07:00
Bobby Holley
5ddabef636 Collapse Selector, SelectorInner, and ComplexSelector into a single Selector.
The refcounting is still internal. We'll fix that up next.

MozReview-Commit-ID: CTxZNaR3Qgj
2017-06-05 19:44:00 -07:00
Bobby Holley
713c9a63f6 Move the ancestor hashes out of Selector.
MozReview-Commit-ID: 5mipXnjgSED
2017-06-05 19:43:58 -07:00
Boris Zbarsky
ad1309552d Allow style sharing for elements with ids as long as the ID is not being used for styling. 2017-06-05 13:32:03 -04:00
Emilio Cobos Álvarez
e51ca0958e
style: Add a SelectorMapEntry trait. 2017-05-23 14:48:06 +02:00
Emilio Cobos Álvarez
a67e880256
style: Move SelectorMap to its own submodule. 2017-05-23 14:48:04 +02:00