mirror of
https://github.com/servo/servo.git
synced 2025-07-29 18:20:24 +01:00
Use SmallBitVec to replace BitVec
This commit is contained in:
parent
4721ef81fd
commit
21006fb752
5 changed files with 17 additions and 11 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -3019,6 +3019,11 @@ name = "slab"
|
||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "smallbitvec"
|
||||||
|
version = "1.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "0.4.3"
|
version = "0.4.3"
|
||||||
|
@ -3077,7 +3082,6 @@ dependencies = [
|
||||||
"arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
"arrayvec 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bindgen 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bindgen 0.29.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bit-vec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -3112,6 +3116,7 @@ dependencies = [
|
||||||
"servo_atoms 0.0.1",
|
"servo_atoms 0.0.1",
|
||||||
"servo_config 0.0.1",
|
"servo_config 0.0.1",
|
||||||
"servo_url 0.0.1",
|
"servo_url 0.0.1",
|
||||||
|
"smallbitvec 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"style_derive 0.0.1",
|
"style_derive 0.0.1",
|
||||||
"style_traits 0.0.1",
|
"style_traits 0.0.1",
|
||||||
|
@ -3948,6 +3953,7 @@ dependencies = [
|
||||||
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
|
"checksum siphasher 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0df90a788073e8d0235a67e50441d47db7c8ad9debd91cbf43736a2a92d36537"
|
||||||
"checksum skeptic 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd7d8dc1315094150052d0ab767840376335a98ac66ef313ff911cdf439a5b69"
|
"checksum skeptic 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd7d8dc1315094150052d0ab767840376335a98ac66ef313ff911cdf439a5b69"
|
||||||
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
|
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
|
||||||
|
"checksum smallbitvec 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1ebf4681dc284c22efb7248986bbdf8aa23c2749ea85a0107e0e787038d303e"
|
||||||
"checksum smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8fcd03faf178110ab0334d74ca9631d77f94c8c11cc77fcb59538abf0025695d"
|
"checksum smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8fcd03faf178110ab0334d74ca9631d77f94c8c11cc77fcb59538abf0025695d"
|
||||||
"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b"
|
"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b"
|
||||||
"checksum string_cache 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "413fc7852aeeb5472f1986ef755f561ddf0c789d3d796e65f0b6fe293ecd4ef8"
|
"checksum string_cache 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "413fc7852aeeb5472f1986ef755f561ddf0c789d3d796e65f0b6fe293ecd4ef8"
|
||||||
|
|
|
@ -34,7 +34,6 @@ arrayvec = "0.3.20"
|
||||||
arraydeque = "0.2.3"
|
arraydeque = "0.2.3"
|
||||||
atomic_refcell = "0.1"
|
atomic_refcell = "0.1"
|
||||||
bitflags = "0.7"
|
bitflags = "0.7"
|
||||||
bit-vec = "0.4.3"
|
|
||||||
byteorder = "1.0"
|
byteorder = "1.0"
|
||||||
cfg-if = "0.1.0"
|
cfg-if = "0.1.0"
|
||||||
cssparser = "0.20"
|
cssparser = "0.20"
|
||||||
|
@ -65,6 +64,7 @@ serde = {version = "1.0", optional = true, features = ["derive"]}
|
||||||
servo_arc = { path = "../servo_arc" }
|
servo_arc = { path = "../servo_arc" }
|
||||||
servo_atoms = {path = "../atoms", optional = true}
|
servo_atoms = {path = "../atoms", optional = true}
|
||||||
servo_config = {path = "../config", optional = true}
|
servo_config = {path = "../config", optional = true}
|
||||||
|
smallbitvec = "1.0"
|
||||||
smallvec = "0.4"
|
smallvec = "0.4"
|
||||||
style_derive = {path = "../style_derive"}
|
style_derive = {path = "../style_derive"}
|
||||||
style_traits = {path = "../style_traits"}
|
style_traits = {path = "../style_traits"}
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
extern crate app_units;
|
extern crate app_units;
|
||||||
extern crate arrayvec;
|
extern crate arrayvec;
|
||||||
extern crate atomic_refcell;
|
extern crate atomic_refcell;
|
||||||
extern crate bit_vec;
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate bitflags;
|
extern crate bitflags;
|
||||||
#[allow(unused_extern_crates)] extern crate byteorder;
|
#[allow(unused_extern_crates)] extern crate byteorder;
|
||||||
|
@ -80,6 +79,7 @@ pub extern crate servo_arc;
|
||||||
#[cfg(feature = "servo")] #[macro_use] extern crate servo_atoms;
|
#[cfg(feature = "servo")] #[macro_use] extern crate servo_atoms;
|
||||||
#[cfg(feature = "servo")] extern crate servo_config;
|
#[cfg(feature = "servo")] extern crate servo_config;
|
||||||
#[cfg(feature = "servo")] extern crate servo_url;
|
#[cfg(feature = "servo")] extern crate servo_url;
|
||||||
|
extern crate smallbitvec;
|
||||||
extern crate smallvec;
|
extern crate smallvec;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate style_derive;
|
extern crate style_derive;
|
||||||
|
|
|
@ -67,7 +67,6 @@
|
||||||
use Atom;
|
use Atom;
|
||||||
use applicable_declarations::ApplicableDeclarationBlock;
|
use applicable_declarations::ApplicableDeclarationBlock;
|
||||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||||
use bit_vec::BitVec;
|
|
||||||
use bloom::StyleBloom;
|
use bloom::StyleBloom;
|
||||||
use cache::{LRUCache, LRUCacheMutIterator};
|
use cache::{LRUCache, LRUCacheMutIterator};
|
||||||
use context::{SelectorFlagsMap, SharedStyleContext, StyleContext};
|
use context::{SelectorFlagsMap, SharedStyleContext, StyleContext};
|
||||||
|
@ -78,6 +77,7 @@ use owning_ref::OwningHandle;
|
||||||
use properties::ComputedValues;
|
use properties::ComputedValues;
|
||||||
use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
|
use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
|
use smallbitvec::SmallBitVec;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
@ -123,7 +123,7 @@ pub struct ValidationData {
|
||||||
|
|
||||||
/// The cached result of matching this entry against the revalidation
|
/// The cached result of matching this entry against the revalidation
|
||||||
/// selectors.
|
/// selectors.
|
||||||
revalidation_match_results: Option<BitVec>,
|
revalidation_match_results: Option<SmallBitVec>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ValidationData {
|
impl ValidationData {
|
||||||
|
@ -177,7 +177,7 @@ impl ValidationData {
|
||||||
bloom: &StyleBloom<E>,
|
bloom: &StyleBloom<E>,
|
||||||
bloom_known_valid: bool,
|
bloom_known_valid: bool,
|
||||||
flags_setter: &mut F
|
flags_setter: &mut F
|
||||||
) -> &BitVec
|
) -> &SmallBitVec
|
||||||
where E: TElement,
|
where E: TElement,
|
||||||
F: FnMut(&E, ElementSelectorFlags),
|
F: FnMut(&E, ElementSelectorFlags),
|
||||||
{
|
{
|
||||||
|
@ -256,7 +256,7 @@ impl<E: TElement> StyleSharingCandidate<E> {
|
||||||
&mut self,
|
&mut self,
|
||||||
stylist: &Stylist,
|
stylist: &Stylist,
|
||||||
bloom: &StyleBloom<E>,
|
bloom: &StyleBloom<E>,
|
||||||
) -> &BitVec {
|
) -> &SmallBitVec {
|
||||||
self.validation_data.revalidation_match_results(
|
self.validation_data.revalidation_match_results(
|
||||||
self.element,
|
self.element,
|
||||||
stylist,
|
stylist,
|
||||||
|
@ -309,7 +309,7 @@ impl<E: TElement> StyleSharingTarget<E> {
|
||||||
stylist: &Stylist,
|
stylist: &Stylist,
|
||||||
bloom: &StyleBloom<E>,
|
bloom: &StyleBloom<E>,
|
||||||
selector_flags_map: &mut SelectorFlagsMap<E>
|
selector_flags_map: &mut SelectorFlagsMap<E>
|
||||||
) -> &BitVec {
|
) -> &SmallBitVec {
|
||||||
// It's important to set the selector flags. Otherwise, if we succeed in
|
// It's important to set the selector flags. Otherwise, if we succeed in
|
||||||
// sharing the style, we may not set the slow selector flags for the
|
// sharing the style, we may not set the slow selector flags for the
|
||||||
// right elements (which may not necessarily be |element|), causing
|
// right elements (which may not necessarily be |element|), causing
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
|
|
||||||
use {Atom, LocalName, Namespace};
|
use {Atom, LocalName, Namespace};
|
||||||
use applicable_declarations::{ApplicableDeclarationBlock, ApplicableDeclarationList};
|
use applicable_declarations::{ApplicableDeclarationBlock, ApplicableDeclarationList};
|
||||||
use bit_vec::BitVec;
|
|
||||||
use context::{CascadeInputs, QuirksMode};
|
use context::{CascadeInputs, QuirksMode};
|
||||||
use dom::TElement;
|
use dom::TElement;
|
||||||
use element_state::ElementState;
|
use element_state::ElementState;
|
||||||
|
@ -34,6 +33,7 @@ use selectors::sink::Push;
|
||||||
use selectors::visitor::SelectorVisitor;
|
use selectors::visitor::SelectorVisitor;
|
||||||
use servo_arc::{Arc, ArcBorrow};
|
use servo_arc::{Arc, ArcBorrow};
|
||||||
use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
|
use shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
|
||||||
|
use smallbitvec::SmallBitVec;
|
||||||
use smallvec::VecLike;
|
use smallvec::VecLike;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
use std::ops;
|
use std::ops;
|
||||||
|
@ -1493,7 +1493,7 @@ impl Stylist {
|
||||||
element: &E,
|
element: &E,
|
||||||
bloom: Option<&BloomFilter>,
|
bloom: Option<&BloomFilter>,
|
||||||
flags_setter: &mut F
|
flags_setter: &mut F
|
||||||
) -> BitVec
|
) -> SmallBitVec
|
||||||
where
|
where
|
||||||
E: TElement,
|
E: TElement,
|
||||||
F: FnMut(&E, ElementSelectorFlags),
|
F: FnMut(&E, ElementSelectorFlags),
|
||||||
|
@ -1508,7 +1508,7 @@ impl Stylist {
|
||||||
// This means we're guaranteed to get the same rulehash buckets for all
|
// This means we're guaranteed to get the same rulehash buckets for all
|
||||||
// the lookups, which means that the bitvecs are comparable. We verify
|
// the lookups, which means that the bitvecs are comparable. We verify
|
||||||
// this in the caller by asserting that the bitvecs are same-length.
|
// this in the caller by asserting that the bitvecs are same-length.
|
||||||
let mut results = BitVec::new();
|
let mut results = SmallBitVec::new();
|
||||||
for (data, _) in self.cascade_data.iter_origins() {
|
for (data, _) in self.cascade_data.iter_origins() {
|
||||||
data.selectors_for_cache_revalidation.lookup(
|
data.selectors_for_cache_revalidation.lookup(
|
||||||
*element,
|
*element,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue