From e7e03fac7b3afb61675d954f3a2d37b24947fddf Mon Sep 17 00:00:00 2001 From: Julian Seward Date: Tue, 12 Sep 2017 15:18:49 +0200 Subject: [PATCH] Bug 1398593 - stylo: mitigate performance impact of fallible allocation on stylist rebuilds. r=emilio. --- components/fallible/lib.rs | 4 ++-- components/hashglobe/src/hash_map.rs | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/fallible/lib.rs b/components/fallible/lib.rs index 816e20573f9..4a48190a1eb 100644 --- a/components/fallible/lib.rs +++ b/components/fallible/lib.rs @@ -27,7 +27,7 @@ pub trait FallibleVec { // Vec impl FallibleVec for Vec { - #[inline] + #[inline(always)] fn try_push(&mut self, val: T) -> Result<(), FailedAllocationError> { #[cfg(feature = "known_system_malloc")] { @@ -92,7 +92,7 @@ fn try_double_vec(vec: &mut Vec) -> Result<(), FailedAllocationError> { // SmallVec impl FallibleVec for SmallVec { - #[inline] + #[inline(always)] fn try_push(&mut self, val: T::Item) -> Result<(), FailedAllocationError> { #[cfg(feature = "known_system_malloc")] { diff --git a/components/hashglobe/src/hash_map.rs b/components/hashglobe/src/hash_map.rs index c73f88cef66..69bd06344e0 100644 --- a/components/hashglobe/src/hash_map.rs +++ b/components/hashglobe/src/hash_map.rs @@ -1002,6 +1002,7 @@ impl HashMap self.try_entry(key).unwrap() } + #[inline(always)] pub fn try_entry(&mut self, key: K) -> Result, FailedAllocationError> { // Gotta resize now. self.try_reserve(1)?;