servo: Merge #19558 - selectors: Manually inline any(..) in matches_selector_list (from emilio:sadness); r=heycam

Since the compiler refuses to inline the inner closure even with -O3, which is
sad :(.

Sad try run:

  https://treeherder.mozilla.org/perf.html#/compare?originalProject=try&originalRevision=c2724c47e98f990826327da05220cd83b772d144&newProject=try&newRevision=52ac88b40a08a5ef6a629bd681f2e5a444b75f54&framework=1

Source-Repo: https://github.com/servo/servo
Source-Revision: 370f5acf6dcf2fa2b4755105376302b41a88fed3

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : c9111fe877a9e1d7893c91f13be33fded64acbe9
This commit is contained in:
Emilio Cobos Álvarez 2017-12-14 10:19:23 -06:00
Родитель cf0c6d5220
Коммит 232ec02559
1 изменённых файлов: 18 добавлений и 8 удалений

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

@ -72,14 +72,24 @@ pub fn matches_selector_list<E>(
where
E: Element
{
selector_list.0.iter().any(|selector| {
matches_selector(selector,
0,
None,
element,
context,
&mut |_, _| {})
})
// This is pretty much any(..) but manually inlined because the compiler
// refuses to do so from querySelector / querySelectorAll.
for selector in &selector_list.0 {
let matches = matches_selector(
selector,
0,
None,
element,
context,
&mut |_, _| {},
);
if matches {
return true;
}
}
false
}
#[inline(always)]