зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1491622 - Make LonghandId::flags an indexing operation. r=xidorn
I always see a bunch of time in our profiles in the iterator over the declarations, this ensures it's not something dumb. I suspect it's just a bunch of cache misses from walking the rule tree but in any case this is consistent with the other getters we have and such. Differential Revision: https://phabricator.services.mozilla.com/D5971 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
b9a29ce72d
Коммит
491be8bc82
|
@ -1113,16 +1113,19 @@ impl LonghandId {
|
|||
}
|
||||
|
||||
/// Returns PropertyFlags for given longhand property.
|
||||
pub fn flags(&self) -> PropertyFlags {
|
||||
match *self {
|
||||
#[inline(always)]
|
||||
pub fn flags(self) -> PropertyFlags {
|
||||
// TODO(emilio): This can be simplified further as Rust gains more
|
||||
// constant expression support.
|
||||
const FLAGS: [u8; ${len(data.longhands)}] = [
|
||||
% for property in data.longhands:
|
||||
LonghandId::${property.camel_case} =>
|
||||
% for flag in property.flags:
|
||||
PropertyFlags::${flag} |
|
||||
% endfor
|
||||
PropertyFlags::empty(),
|
||||
% for flag in property.flags:
|
||||
PropertyFlags::${flag}.bits |
|
||||
% endfor
|
||||
0,
|
||||
% endfor
|
||||
}
|
||||
];
|
||||
PropertyFlags::from_bits_truncate(FLAGS[self as usize])
|
||||
}
|
||||
|
||||
/// Only a few properties are allowed to depend on the visited state of
|
||||
|
|
Загрузка…
Ссылка в новой задаче