mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Make source_order u32 and shrink Rule.
MozReview-Commit-ID: AKNTZZqke1O
This commit is contained in:
parent
6e3e7b282c
commit
3afab1400a
3 changed files with 7 additions and 7 deletions
|
@ -121,7 +121,7 @@ pub struct Stylist {
|
||||||
|
|
||||||
/// A monotonically increasing counter to represent the order on which a
|
/// A monotonically increasing counter to represent the order on which a
|
||||||
/// style rule appears in a stylesheet, needed to sort them by source order.
|
/// style rule appears in a stylesheet, needed to sort them by source order.
|
||||||
rules_source_order: usize,
|
rules_source_order: u32,
|
||||||
|
|
||||||
/// Selector dependencies used to compute restyle hints.
|
/// Selector dependencies used to compute restyle hints.
|
||||||
dependencies: DependencySet,
|
dependencies: DependencySet,
|
||||||
|
@ -1497,11 +1497,11 @@ pub struct Rule {
|
||||||
/// The ancestor hashes associated with the selector.
|
/// The ancestor hashes associated with the selector.
|
||||||
#[cfg_attr(feature = "servo", ignore_heap_size_of = "No heap data")]
|
#[cfg_attr(feature = "servo", ignore_heap_size_of = "No heap data")]
|
||||||
pub hashes: AncestorHashes,
|
pub hashes: AncestorHashes,
|
||||||
|
/// The source order this style rule appears in.
|
||||||
|
pub source_order: u32,
|
||||||
/// The actual style rule.
|
/// The actual style rule.
|
||||||
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
|
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
|
||||||
pub style_rule: Arc<Locked<StyleRule>>,
|
pub style_rule: Arc<Locked<StyleRule>>,
|
||||||
/// The source order this style rule appears in.
|
|
||||||
pub source_order: usize,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SelectorMapEntry for Rule {
|
impl SelectorMapEntry for Rule {
|
||||||
|
@ -1537,7 +1537,7 @@ impl Rule {
|
||||||
pub fn new(selector: Selector<SelectorImpl>,
|
pub fn new(selector: Selector<SelectorImpl>,
|
||||||
hashes: AncestorHashes,
|
hashes: AncestorHashes,
|
||||||
style_rule: Arc<Locked<StyleRule>>,
|
style_rule: Arc<Locked<StyleRule>>,
|
||||||
source_order: usize)
|
source_order: u32)
|
||||||
-> Self
|
-> Self
|
||||||
{
|
{
|
||||||
Rule {
|
Rule {
|
||||||
|
@ -1561,7 +1561,7 @@ pub struct ApplicableDeclarationBlock {
|
||||||
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
|
#[cfg_attr(feature = "servo", ignore_heap_size_of = "Arc")]
|
||||||
pub source: StyleSource,
|
pub source: StyleSource,
|
||||||
/// The source order of this block.
|
/// The source order of this block.
|
||||||
pub source_order: usize,
|
pub source_order: u32,
|
||||||
/// The specificity of the selector this block is represented by.
|
/// The specificity of the selector this block is represented by.
|
||||||
pub specificity: u32,
|
pub specificity: u32,
|
||||||
/// The cascade level this applicable declaration block is in.
|
/// The cascade level this applicable declaration block is in.
|
||||||
|
|
|
@ -45,7 +45,7 @@ fn get_mock_rules(css_selectors: &[&str]) -> (Vec<Vec<Rule>>, SharedRwLock) {
|
||||||
let guard = shared_lock.read();
|
let guard = shared_lock.read();
|
||||||
let rule = locked.read_with(&guard);
|
let rule = locked.read_with(&guard);
|
||||||
rule.selectors.0.iter().map(|s| {
|
rule.selectors.0.iter().map(|s| {
|
||||||
Rule::new(s.selector.clone(), s.hashes.clone(), locked.clone(), i)
|
Rule::new(s.selector.clone(), s.hashes.clone(), locked.clone(), i as u32)
|
||||||
}).collect()
|
}).collect()
|
||||||
}).collect(), shared_lock)
|
}).collect(), shared_lock)
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ fn size_of_selectors_dummy_types() {
|
||||||
// The size of this is critical to performance on the bloom-basic microbenchmark.
|
// The size of this is critical to performance on the bloom-basic microbenchmark.
|
||||||
// When iterating over a large Rule array, we want to be able to fast-reject
|
// When iterating over a large Rule array, we want to be able to fast-reject
|
||||||
// selectors (with the inline hashes) with as few cache misses as possible.
|
// selectors (with the inline hashes) with as few cache misses as possible.
|
||||||
size_of_test!(test_size_of_rule, style::stylist::Rule, 40);
|
size_of_test!(test_size_of_rule, style::stylist::Rule, 32);
|
||||||
|
|
||||||
size_of_test!(test_size_of_option_arc_cv, Option<Arc<ComputedValues>>, 8);
|
size_of_test!(test_size_of_option_arc_cv, Option<Arc<ComputedValues>>, 8);
|
||||||
size_of_test!(test_size_of_option_rule_node, Option<StrongRuleNode>, 8);
|
size_of_test!(test_size_of_option_rule_node, Option<StrongRuleNode>, 8);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue