servo: Merge #19451 - style: Inline some things that should never ever appear in a profile (from emilio:inlining-is-fun); r=upsuper

Source-Repo: https://github.com/servo/servo
Source-Revision: f7aa22a87ee2571d3cdb90bfe361b22ba45ddb23

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : cb3fcff96422313c36f06435a585eed84c82d62b
This commit is contained in:
Emilio Cobos Álvarez 2017-12-01 16:52:34 -06:00
Родитель 6d8177ca14
Коммит 4b8603c01c
3 изменённых файлов: 13 добавлений и 5 удалений

Просмотреть файл

@ -211,6 +211,7 @@ impl<'ln> GeckoNode<'ln> {
/// WARNING: This logic is duplicated in Gecko's FlattenedTreeParentIsParent.
/// Make sure to mirror any modifications in both places.
#[inline]
fn flattened_tree_parent_is_parent(&self) -> bool {
use gecko_bindings::structs::*;
let flags = self.flags();
@ -236,6 +237,7 @@ impl<'ln> GeckoNode<'ln> {
true
}
#[inline]
fn flattened_tree_parent(&self) -> Option<Self> {
let fast_path = self.flattened_tree_parent_is_parent();
debug_assert!(fast_path == unsafe { bindings::Gecko_FlattenedTreeParentIsParent(self.0) });
@ -246,6 +248,7 @@ impl<'ln> GeckoNode<'ln> {
}
}
#[inline]
fn contains_non_whitespace_content(&self) -> bool {
unsafe { Gecko_IsSignificantChild(self.0, true, false) }
}

Просмотреть файл

@ -91,7 +91,7 @@ pub struct DeclarationImportanceIterator<'a> {
}
impl<'a> DeclarationImportanceIterator<'a> {
/// Constructor
/// Constructor.
pub fn new(declarations: &'a [PropertyDeclaration], important: &'a SmallBitVec) -> Self {
DeclarationImportanceIterator {
iter: declarations.iter().zip(important.iter()),
@ -102,17 +102,20 @@ impl<'a> DeclarationImportanceIterator<'a> {
impl<'a> Iterator for DeclarationImportanceIterator<'a> {
type Item = (&'a PropertyDeclaration, Importance);
#[inline]
fn next(&mut self) -> Option<Self::Item> {
self.iter.next().map(|(decl, important)|
(decl, if important { Importance::Important } else { Importance::Normal }))
}
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
self.iter.size_hint()
}
}
impl<'a> DoubleEndedIterator for DeclarationImportanceIterator<'a> {
#[inline(always)]
fn next_back(&mut self) -> Option<Self::Item> {
self.iter.next_back().map(|(decl, important)|
(decl, if important { Importance::Important } else { Importance::Normal }))
@ -123,7 +126,8 @@ impl<'a> DoubleEndedIterator for DeclarationImportanceIterator<'a> {
pub struct NormalDeclarationIterator<'a>(DeclarationImportanceIterator<'a>);
impl<'a> NormalDeclarationIterator<'a> {
/// Constructor
/// Constructor.
#[inline]
pub fn new(declarations: &'a [PropertyDeclaration], important: &'a SmallBitVec) -> Self {
NormalDeclarationIterator(
DeclarationImportanceIterator::new(declarations, important)

Просмотреть файл

@ -3129,6 +3129,9 @@ pub fn cascade(
) -> Arc<ComputedValues> {
debug_assert_eq!(parent_style.is_some(), parent_style_ignoring_first_line.is_some());
let empty = SmallBitVec::new();
let property_restriction = pseudo.and_then(|p| p.property_restriction());
let iter_declarations = || {
rule_node.self_and_ancestors().flat_map(|node| {
let cascade_level = node.cascade_level();
@ -3142,8 +3145,6 @@ pub fn cascade(
};
let node_importance = node.importance();
let property_restriction = pseudo.and_then(|p| p.property_restriction());
declarations
// Yield declarations later in source order (with more precedence) first.
.rev()
@ -3168,6 +3169,7 @@ pub fn cascade(
})
})
};
apply_declarations(
device,
pseudo,
@ -3187,7 +3189,6 @@ pub fn cascade(
/// NOTE: This function expects the declaration with more priority to appear
/// first.
#[allow(unused_mut)] // conditionally compiled code for "position"
pub fn apply_declarations<'a, F, I>(
device: &Device,
pseudo: Option<<&PseudoElement>,