зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1477628 - Convert FnvHash{Set,Map} instances to FxHash{Set,Map} (attempt 2). r=heycam
This commit is contained in:
Родитель
38f29ba537
Коммит
6a531f189d
|
@ -1805,6 +1805,7 @@ dependencies = [
|
||||||
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cssparser 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -1952,7 +1953,7 @@ dependencies = [
|
||||||
"cssparser 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cssparser 0.24.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"euclid 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"euclid 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fallible 0.0.1",
|
"fallible 0.0.1",
|
||||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hashglobe 0.1.0",
|
"hashglobe 0.1.0",
|
||||||
"itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itertools 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itoa 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -25,6 +25,7 @@ matches = "0.1"
|
||||||
cssparser = "0.24.0"
|
cssparser = "0.24.0"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
fnv = "1.0"
|
fnv = "1.0"
|
||||||
|
fxhash = "0.2"
|
||||||
phf = "0.7.18"
|
phf = "0.7.18"
|
||||||
precomputed-hash = "0.1"
|
precomputed-hash = "0.1"
|
||||||
servo_arc = { version = "0.1", path = "../servo_arc" }
|
servo_arc = { version = "0.1", path = "../servo_arc" }
|
||||||
|
|
|
@ -297,6 +297,9 @@ impl Clone for BloomStorageBool {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn hash<T: Hash>(elem: &T) -> u32 {
|
fn hash<T: Hash>(elem: &T) -> u32 {
|
||||||
|
// We generally use FxHasher in Stylo because it's faster than FnvHasher,
|
||||||
|
// but the increased collision rate has outsized effect on the bloom
|
||||||
|
// filter, so we use FnvHasher instead here.
|
||||||
let mut hasher = FnvHasher::default();
|
let mut hasher = FnvHasher::default();
|
||||||
elem.hash(&mut hasher);
|
elem.hash(&mut hasher);
|
||||||
let hash: u64 = hasher.finish();
|
let hash: u64 = hasher.finish();
|
||||||
|
|
|
@ -10,6 +10,7 @@ extern crate bitflags;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate cssparser;
|
extern crate cssparser;
|
||||||
extern crate fnv;
|
extern crate fnv;
|
||||||
|
extern crate fxhash;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate log;
|
extern crate log;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use fnv::FnvHashMap;
|
use fxhash::FxHashMap;
|
||||||
use tree::OpaqueElement;
|
use tree::OpaqueElement;
|
||||||
|
|
||||||
/// A cache to speed up matching of nth-index-like selectors.
|
/// A cache to speed up matching of nth-index-like selectors.
|
||||||
|
@ -32,7 +32,7 @@ impl NthIndexCache {
|
||||||
|
|
||||||
/// The concrete per-pseudo-class cache.
|
/// The concrete per-pseudo-class cache.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct NthIndexCacheInner(FnvHashMap<OpaqueElement, i32>);
|
pub struct NthIndexCacheInner(FxHashMap<OpaqueElement, i32>);
|
||||||
|
|
||||||
impl NthIndexCacheInner {
|
impl NthIndexCacheInner {
|
||||||
/// Does a lookup for a given element in the cache.
|
/// Does a lookup for a given element in the cache.
|
||||||
|
|
|
@ -36,7 +36,7 @@ new_debug_unreachable = "1.0"
|
||||||
encoding_rs = {version = "0.7", optional = true}
|
encoding_rs = {version = "0.7", optional = true}
|
||||||
euclid = "0.18"
|
euclid = "0.18"
|
||||||
fallible = { path = "../fallible" }
|
fallible = { path = "../fallible" }
|
||||||
fnv = "1.0"
|
fxhash = "0.2"
|
||||||
hashglobe = { path = "../hashglobe" }
|
hashglobe = { path = "../hashglobe" }
|
||||||
html5ever = {version = "0.22", optional = true}
|
html5ever = {version = "0.22", optional = true}
|
||||||
itertools = "0.7.6"
|
itertools = "0.7.6"
|
||||||
|
|
|
@ -14,7 +14,7 @@ use dom::{SendElement, TElement};
|
||||||
use dom::OpaqueNode;
|
use dom::OpaqueNode;
|
||||||
use euclid::Size2D;
|
use euclid::Size2D;
|
||||||
use euclid::TypedScale;
|
use euclid::TypedScale;
|
||||||
use fnv::FnvHashMap;
|
use fxhash::FxHashMap;
|
||||||
use font_metrics::FontMetricsProvider;
|
use font_metrics::FontMetricsProvider;
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
use gecko_bindings::structs;
|
use gecko_bindings::structs;
|
||||||
|
@ -173,11 +173,11 @@ pub struct SharedStyleContext<'a> {
|
||||||
|
|
||||||
/// The animations that are currently running.
|
/// The animations that are currently running.
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
pub running_animations: Arc<RwLock<FnvHashMap<OpaqueNode, Vec<Animation>>>>,
|
pub running_animations: Arc<RwLock<FxHashMap<OpaqueNode, Vec<Animation>>>>,
|
||||||
|
|
||||||
/// The list of animations that have expired since the last style recalculation.
|
/// The list of animations that have expired since the last style recalculation.
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
pub expired_animations: Arc<RwLock<FnvHashMap<OpaqueNode, Vec<Animation>>>>,
|
pub expired_animations: Arc<RwLock<FxHashMap<OpaqueNode, Vec<Animation>>>>,
|
||||||
|
|
||||||
/// Paint worklets
|
/// Paint worklets
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
|
@ -570,7 +570,7 @@ type CacheItem<E> = (SendElement<E>, ElementSelectorFlags);
|
||||||
/// flags until after the traversal.
|
/// flags until after the traversal.
|
||||||
pub struct SelectorFlagsMap<E: TElement> {
|
pub struct SelectorFlagsMap<E: TElement> {
|
||||||
/// The hashmap storing the flags to apply.
|
/// The hashmap storing the flags to apply.
|
||||||
map: FnvHashMap<SendElement<E>, ElementSelectorFlags>,
|
map: FxHashMap<SendElement<E>, ElementSelectorFlags>,
|
||||||
/// An LRU cache to avoid hashmap lookups, which can be slow if the map
|
/// An LRU cache to avoid hashmap lookups, which can be slow if the map
|
||||||
/// gets big.
|
/// gets big.
|
||||||
cache: LRUCache<[Entry<CacheItem<E>>; 4 + 1]>,
|
cache: LRUCache<[Entry<CacheItem<E>>; 4 + 1]>,
|
||||||
|
@ -587,7 +587,7 @@ impl<E: TElement> SelectorFlagsMap<E> {
|
||||||
/// Creates a new empty SelectorFlagsMap.
|
/// Creates a new empty SelectorFlagsMap.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
SelectorFlagsMap {
|
SelectorFlagsMap {
|
||||||
map: FnvHashMap::default(),
|
map: FxHashMap::default(),
|
||||||
cache: LRUCache::default(),
|
cache: LRUCache::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -833,7 +833,7 @@ pub trait RegisteredSpeculativePainter: SpeculativePainter {
|
||||||
/// The name it was registered with
|
/// The name it was registered with
|
||||||
fn name(&self) -> Atom;
|
fn name(&self) -> Atom;
|
||||||
/// The properties it was registered with
|
/// The properties it was registered with
|
||||||
fn properties(&self) -> &FnvHashMap<Atom, PropertyId>;
|
fn properties(&self) -> &FxHashMap<Atom, PropertyId>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A set of registered painters
|
/// A set of registered painters
|
||||||
|
|
|
@ -62,7 +62,7 @@ use gecko_bindings::structs::nsChangeHint;
|
||||||
use gecko_bindings::structs::nsIDocument_DocumentTheme as DocumentTheme;
|
use gecko_bindings::structs::nsIDocument_DocumentTheme as DocumentTheme;
|
||||||
use gecko_bindings::structs::nsRestyleHint;
|
use gecko_bindings::structs::nsRestyleHint;
|
||||||
use gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI};
|
use gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI};
|
||||||
use hash::FnvHashMap;
|
use hash::FxHashMap;
|
||||||
use logical_geometry::WritingMode;
|
use logical_geometry::WritingMode;
|
||||||
use media_queries::Device;
|
use media_queries::Device;
|
||||||
use properties::{ComputedValues, LonghandId};
|
use properties::{ComputedValues, LonghandId};
|
||||||
|
@ -867,12 +867,12 @@ impl<'le> GeckoElement<'le> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn css_transitions_info(&self) -> FnvHashMap<LonghandId, Arc<AnimationValue>> {
|
fn css_transitions_info(&self) -> FxHashMap<LonghandId, Arc<AnimationValue>> {
|
||||||
use gecko_bindings::bindings::Gecko_ElementTransitions_EndValueAt;
|
use gecko_bindings::bindings::Gecko_ElementTransitions_EndValueAt;
|
||||||
use gecko_bindings::bindings::Gecko_ElementTransitions_Length;
|
use gecko_bindings::bindings::Gecko_ElementTransitions_Length;
|
||||||
|
|
||||||
let collection_length = unsafe { Gecko_ElementTransitions_Length(self.0) } as usize;
|
let collection_length = unsafe { Gecko_ElementTransitions_Length(self.0) } as usize;
|
||||||
let mut map = FnvHashMap::with_capacity_and_hasher(collection_length, Default::default());
|
let mut map = FxHashMap::with_capacity_and_hasher(collection_length, Default::default());
|
||||||
|
|
||||||
for i in 0..collection_length {
|
for i in 0..collection_length {
|
||||||
let raw_end_value = unsafe { Gecko_ElementTransitions_EndValueAt(self.0, i) };
|
let raw_end_value = unsafe { Gecko_ElementTransitions_EndValueAt(self.0, i) };
|
||||||
|
@ -893,7 +893,7 @@ impl<'le> GeckoElement<'le> {
|
||||||
combined_duration: f32,
|
combined_duration: f32,
|
||||||
before_change_style: &ComputedValues,
|
before_change_style: &ComputedValues,
|
||||||
after_change_style: &ComputedValues,
|
after_change_style: &ComputedValues,
|
||||||
existing_transitions: &FnvHashMap<LonghandId, Arc<AnimationValue>>,
|
existing_transitions: &FxHashMap<LonghandId, Arc<AnimationValue>>,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
use values::animated::{Animate, Procedure};
|
use values::animated::{Animate, Procedure};
|
||||||
debug_assert!(!longhand_id.is_logical());
|
debug_assert!(!longhand_id.is_logical());
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
//! Can go away when the stdlib gets fallible collections
|
//! Can go away when the stdlib gets fallible collections
|
||||||
//! https://github.com/rust-lang/rfcs/pull/2116
|
//! https://github.com/rust-lang/rfcs/pull/2116
|
||||||
|
|
||||||
use fnv;
|
use fxhash;
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
pub use hashglobe::hash_map::HashMap;
|
pub use hashglobe::hash_map::HashMap;
|
||||||
|
@ -25,7 +25,7 @@ pub mod map {
|
||||||
pub use std::collections::hash_map::{Entry, Iter};
|
pub use std::collections::hash_map::{Entry, Iter};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Hash map that uses the FNV hasher
|
/// Hash map that uses the Fx hasher
|
||||||
pub type FnvHashMap<K, V> = HashMap<K, V, fnv::FnvBuildHasher>;
|
pub type FxHashMap<K, V> = HashMap<K, V, fxhash::FxBuildHasher>;
|
||||||
/// Hash set that uses the FNV hasher
|
/// Hash set that uses the Fx hasher
|
||||||
pub type FnvHashSet<T> = HashSet<T, fnv::FnvBuildHasher>;
|
pub type FxHashSet<T> = HashSet<T, fxhash::FxBuildHasher>;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
//! Code related to the invalidation of media-query-affected rules.
|
//! Code related to the invalidation of media-query-affected rules.
|
||||||
|
|
||||||
use context::QuirksMode;
|
use context::QuirksMode;
|
||||||
use fnv::FnvHashSet;
|
use fxhash::FxHashSet;
|
||||||
use media_queries::Device;
|
use media_queries::Device;
|
||||||
use shared_lock::SharedRwLockReadGuard;
|
use shared_lock::SharedRwLockReadGuard;
|
||||||
use stylesheets::{DocumentRule, ImportRule, MediaRule};
|
use stylesheets::{DocumentRule, ImportRule, MediaRule};
|
||||||
|
@ -54,14 +54,14 @@ impl ToMediaListKey for MediaRule {}
|
||||||
#[derive(Debug, MallocSizeOf, PartialEq)]
|
#[derive(Debug, MallocSizeOf, PartialEq)]
|
||||||
pub struct EffectiveMediaQueryResults {
|
pub struct EffectiveMediaQueryResults {
|
||||||
/// The set of media lists that matched last time.
|
/// The set of media lists that matched last time.
|
||||||
set: FnvHashSet<MediaListKey>,
|
set: FxHashSet<MediaListKey>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EffectiveMediaQueryResults {
|
impl EffectiveMediaQueryResults {
|
||||||
/// Trivially constructs an empty `EffectiveMediaQueryResults`.
|
/// Trivially constructs an empty `EffectiveMediaQueryResults`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
set: FnvHashSet::default(),
|
set: FxHashSet::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ use Atom;
|
||||||
use CaseSensitivityExt;
|
use CaseSensitivityExt;
|
||||||
use LocalName as SelectorLocalName;
|
use LocalName as SelectorLocalName;
|
||||||
use dom::{TDocument, TElement, TNode};
|
use dom::{TDocument, TElement, TNode};
|
||||||
use fnv::FnvHashSet;
|
use fxhash::FxHashSet;
|
||||||
use invalidation::element::element_wrapper::{ElementSnapshot, ElementWrapper};
|
use invalidation::element::element_wrapper::{ElementSnapshot, ElementWrapper};
|
||||||
use invalidation::element::restyle_hints::RestyleHint;
|
use invalidation::element::restyle_hints::RestyleHint;
|
||||||
use media_queries::Device;
|
use media_queries::Device;
|
||||||
|
@ -106,9 +106,9 @@ impl Invalidation {
|
||||||
#[derive(MallocSizeOf)]
|
#[derive(MallocSizeOf)]
|
||||||
pub struct StylesheetInvalidationSet {
|
pub struct StylesheetInvalidationSet {
|
||||||
/// The subtrees we know we have to restyle so far.
|
/// The subtrees we know we have to restyle so far.
|
||||||
invalid_scopes: FnvHashSet<Invalidation>,
|
invalid_scopes: FxHashSet<Invalidation>,
|
||||||
/// The elements we know we have to restyle so far.
|
/// The elements we know we have to restyle so far.
|
||||||
invalid_elements: FnvHashSet<Invalidation>,
|
invalid_elements: FxHashSet<Invalidation>,
|
||||||
/// Whether the whole document should be restyled.
|
/// Whether the whole document should be restyled.
|
||||||
fully_invalid: bool,
|
fully_invalid: bool,
|
||||||
}
|
}
|
||||||
|
@ -117,8 +117,8 @@ impl StylesheetInvalidationSet {
|
||||||
/// Create an empty `StylesheetInvalidationSet`.
|
/// Create an empty `StylesheetInvalidationSet`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
invalid_scopes: FnvHashSet::default(),
|
invalid_scopes: FxHashSet::default(),
|
||||||
invalid_elements: FnvHashSet::default(),
|
invalid_elements: FxHashSet::default(),
|
||||||
fully_invalid: false,
|
fully_invalid: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ extern crate cssparser;
|
||||||
extern crate debug_unreachable;
|
extern crate debug_unreachable;
|
||||||
extern crate euclid;
|
extern crate euclid;
|
||||||
extern crate fallible;
|
extern crate fallible;
|
||||||
extern crate fnv;
|
extern crate fxhash;
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
pub mod gecko_string_cache;
|
pub mod gecko_string_cache;
|
||||||
|
|
|
@ -25,7 +25,7 @@ use servo_arc::Arc;
|
||||||
use smallvec::SmallVec;
|
use smallvec::SmallVec;
|
||||||
use std::{cmp, ptr};
|
use std::{cmp, ptr};
|
||||||
use std::mem::{self, ManuallyDrop};
|
use std::mem::{self, ManuallyDrop};
|
||||||
use hash::FnvHashMap;
|
use hash::FxHashMap;
|
||||||
use super::ComputedValues;
|
use super::ComputedValues;
|
||||||
use values::CSSFloat;
|
use values::CSSFloat;
|
||||||
use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
|
use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
|
||||||
|
@ -232,7 +232,7 @@ impl AnimatedProperty {
|
||||||
/// A collection of AnimationValue that were composed on an element.
|
/// A collection of AnimationValue that were composed on an element.
|
||||||
/// This HashMap stores the values that are the last AnimationValue to be
|
/// This HashMap stores the values that are the last AnimationValue to be
|
||||||
/// composed for each TransitionProperty.
|
/// composed for each TransitionProperty.
|
||||||
pub type AnimationValueMap = FnvHashMap<LonghandId, AnimationValue>;
|
pub type AnimationValueMap = FxHashMap<LonghandId, AnimationValue>;
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
unsafe impl HasFFI for AnimationValueMap {
|
unsafe impl HasFFI for AnimationValueMap {
|
||||||
|
|
|
@ -2387,7 +2387,7 @@ pub use gecko_properties::style_structs;
|
||||||
/// The module where all the style structs are defined.
|
/// The module where all the style structs are defined.
|
||||||
#[cfg(feature = "servo")]
|
#[cfg(feature = "servo")]
|
||||||
pub mod style_structs {
|
pub mod style_structs {
|
||||||
use fnv::FnvHasher;
|
use fx::FxHasher;
|
||||||
use super::longhands;
|
use super::longhands;
|
||||||
use std::hash::{Hash, Hasher};
|
use std::hash::{Hash, Hasher};
|
||||||
use logical_geometry::WritingMode;
|
use logical_geometry::WritingMode;
|
||||||
|
@ -2534,7 +2534,7 @@ pub mod style_structs {
|
||||||
pub fn compute_font_hash(&mut self) {
|
pub fn compute_font_hash(&mut self) {
|
||||||
// Corresponds to the fields in
|
// Corresponds to the fields in
|
||||||
// `gfx::font_template::FontTemplateDescriptor`.
|
// `gfx::font_template::FontTemplateDescriptor`.
|
||||||
let mut hasher: FnvHasher = Default::default();
|
let mut hasher: FxHasher = Default::default();
|
||||||
self.font_weight.hash(&mut hasher);
|
self.font_weight.hash(&mut hasher);
|
||||||
self.font_stretch.hash(&mut hasher);
|
self.font_stretch.hash(&mut hasher);
|
||||||
self.font_style.hash(&mut hasher);
|
self.font_style.hash(&mut hasher);
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
//! A cache from rule node to computed values, in order to cache reset
|
//! A cache from rule node to computed values, in order to cache reset
|
||||||
//! properties.
|
//! properties.
|
||||||
|
|
||||||
use fnv::FnvHashMap;
|
use fxhash::FxHashMap;
|
||||||
use logical_geometry::WritingMode;
|
use logical_geometry::WritingMode;
|
||||||
use properties::{ComputedValues, StyleBuilder};
|
use properties::{ComputedValues, StyleBuilder};
|
||||||
use rule_tree::StrongRuleNode;
|
use rule_tree::StrongRuleNode;
|
||||||
|
@ -71,14 +71,14 @@ impl RuleCacheConditions {
|
||||||
/// A TLS cache from rules matched to computed values.
|
/// A TLS cache from rules matched to computed values.
|
||||||
pub struct RuleCache {
|
pub struct RuleCache {
|
||||||
// FIXME(emilio): Consider using LRUCache or something like that?
|
// FIXME(emilio): Consider using LRUCache or something like that?
|
||||||
map: FnvHashMap<StrongRuleNode, SmallVec<[(RuleCacheConditions, Arc<ComputedValues>); 1]>>,
|
map: FxHashMap<StrongRuleNode, SmallVec<[(RuleCacheConditions, Arc<ComputedValues>); 1]>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl RuleCache {
|
impl RuleCache {
|
||||||
/// Creates an empty `RuleCache`.
|
/// Creates an empty `RuleCache`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
map: FnvHashMap::default(),
|
map: FxHashMap::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1146,13 +1146,13 @@ impl StrongRuleNode {
|
||||||
|
|
||||||
unsafe fn assert_free_list_has_no_duplicates_or_null(&self) {
|
unsafe fn assert_free_list_has_no_duplicates_or_null(&self) {
|
||||||
assert!(cfg!(debug_assertions), "This is an expensive check!");
|
assert!(cfg!(debug_assertions), "This is an expensive check!");
|
||||||
use hash::FnvHashSet;
|
use hash::FxHashSet;
|
||||||
|
|
||||||
let me = &*self.ptr();
|
let me = &*self.ptr();
|
||||||
assert!(me.is_root());
|
assert!(me.is_root());
|
||||||
|
|
||||||
let mut current = self.ptr();
|
let mut current = self.ptr();
|
||||||
let mut seen = FnvHashSet::default();
|
let mut seen = FxHashSet::default();
|
||||||
while current != FREE_LIST_SENTINEL {
|
while current != FREE_LIST_SENTINEL {
|
||||||
let next = (*current).next_free.load(Ordering::Relaxed);
|
let next = (*current).next_free.load(Ordering::Relaxed);
|
||||||
assert!(!next.is_null());
|
assert!(!next.is_null());
|
||||||
|
|
|
@ -11,7 +11,7 @@ use attr::{AttrIdentifier, AttrValue};
|
||||||
use cssparser::{serialize_identifier, CowRcStr, Parser as CssParser, SourceLocation, ToCss};
|
use cssparser::{serialize_identifier, CowRcStr, Parser as CssParser, SourceLocation, ToCss};
|
||||||
use dom::{OpaqueNode, TElement, TNode};
|
use dom::{OpaqueNode, TElement, TNode};
|
||||||
use element_state::{DocumentState, ElementState};
|
use element_state::{DocumentState, ElementState};
|
||||||
use fnv::FnvHashMap;
|
use fxhash::FxHashMap;
|
||||||
use invalidation::element::document_state::InvalidationMatchingData;
|
use invalidation::element::document_state::InvalidationMatchingData;
|
||||||
use invalidation::element::element_wrapper::ElementSnapshot;
|
use invalidation::element::element_wrapper::ElementSnapshot;
|
||||||
use properties::{ComputedValues, PropertyFlags};
|
use properties::{ComputedValues, PropertyFlags};
|
||||||
|
@ -617,12 +617,12 @@ impl SelectorImpl {
|
||||||
|
|
||||||
/// A map from elements to snapshots for the Servo style back-end.
|
/// A map from elements to snapshots for the Servo style back-end.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct SnapshotMap(FnvHashMap<OpaqueNode, ServoElementSnapshot>);
|
pub struct SnapshotMap(FxHashMap<OpaqueNode, ServoElementSnapshot>);
|
||||||
|
|
||||||
impl SnapshotMap {
|
impl SnapshotMap {
|
||||||
/// Create a new empty `SnapshotMap`.
|
/// Create a new empty `SnapshotMap`.
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
SnapshotMap(FnvHashMap::default())
|
SnapshotMap(FxHashMap::default())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a snapshot given an element.
|
/// Get a snapshot given an element.
|
||||||
|
@ -632,7 +632,7 @@ impl SnapshotMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Deref for SnapshotMap {
|
impl Deref for SnapshotMap {
|
||||||
type Target = FnvHashMap<OpaqueNode, ServoElementSnapshot>;
|
type Target = FxHashMap<OpaqueNode, ServoElementSnapshot>;
|
||||||
|
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
&self.0
|
&self.0
|
||||||
|
|
|
@ -7,7 +7,7 @@ use context::QuirksMode;
|
||||||
use cssparser::{Parser, ParserInput, RuleListParser};
|
use cssparser::{Parser, ParserInput, RuleListParser};
|
||||||
use error_reporting::{ContextualParseError, ParseErrorReporter};
|
use error_reporting::{ContextualParseError, ParseErrorReporter};
|
||||||
use fallible::FallibleVec;
|
use fallible::FallibleVec;
|
||||||
use fnv::FnvHashMap;
|
use fxhash::FxHashMap;
|
||||||
use invalidation::media_queries::{MediaListKey, ToMediaListKey};
|
use invalidation::media_queries::{MediaListKey, ToMediaListKey};
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
use malloc_size_of::{MallocSizeOfOps, MallocUnconditionalShallowSizeOf};
|
||||||
|
@ -42,7 +42,7 @@ pub struct UserAgentStylesheets {
|
||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
pub struct Namespaces {
|
pub struct Namespaces {
|
||||||
pub default: Option<Namespace>,
|
pub default: Option<Namespace>,
|
||||||
pub prefixes: FnvHashMap<Prefix, Namespace>,
|
pub prefixes: FxHashMap<Prefix, Namespace>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The contents of a given stylesheet. This effectively maps to a
|
/// The contents of a given stylesheet. This effectively maps to a
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
//! [position]: https://drafts.csswg.org/css-backgrounds-3/#position
|
//! [position]: https://drafts.csswg.org/css-backgrounds-3/#position
|
||||||
|
|
||||||
use cssparser::Parser;
|
use cssparser::Parser;
|
||||||
use hash::FnvHashMap;
|
use hash::FxHashMap;
|
||||||
use parser::{Parse, ParserContext};
|
use parser::{Parse, ParserContext};
|
||||||
use selectors::parser::SelectorParseErrorKind;
|
use selectors::parser::SelectorParseErrorKind;
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
|
@ -548,7 +548,7 @@ impl TemplateAreas {
|
||||||
let mut width = 0;
|
let mut width = 0;
|
||||||
{
|
{
|
||||||
let mut row = 0u32;
|
let mut row = 0u32;
|
||||||
let mut area_indices = FnvHashMap::<&str, usize>::default();
|
let mut area_indices = FxHashMap::<&str, usize>::default();
|
||||||
for string in &strings {
|
for string in &strings {
|
||||||
let mut current_area_index: Option<usize> = None;
|
let mut current_area_index: Option<usize> = None;
|
||||||
row += 1;
|
row += 1;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче