mirror of
https://github.com/servo/servo.git
synced 2025-07-03 13:33:39 +01:00
Bug 1398593 - stylo: mitigate performance impact of fallible allocation on stylist rebuilds. r=emilio.
This commit is contained in:
parent
61fac2c10d
commit
e7e03fac7b
2 changed files with 3 additions and 2 deletions
|
@ -27,7 +27,7 @@ pub trait FallibleVec<T> {
|
|||
// Vec
|
||||
|
||||
impl<T> FallibleVec<T> for Vec<T> {
|
||||
#[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<T>(vec: &mut Vec<T>) -> Result<(), FailedAllocationError> {
|
|||
// SmallVec
|
||||
|
||||
impl<T: Array> FallibleVec<T::Item> for SmallVec<T> {
|
||||
#[inline]
|
||||
#[inline(always)]
|
||||
fn try_push(&mut self, val: T::Item) -> Result<(), FailedAllocationError> {
|
||||
#[cfg(feature = "known_system_malloc")]
|
||||
{
|
||||
|
|
|
@ -1002,6 +1002,7 @@ impl<K, V, S> HashMap<K, V, S>
|
|||
self.try_entry(key).unwrap()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn try_entry(&mut self, key: K) -> Result<Entry<K, V>, FailedAllocationError> {
|
||||
// Gotta resize now.
|
||||
self.try_reserve(1)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue