Bug 1466647: Update smallbitvec to v2.1.1. r=me
authorEmilio Cobos Álvarez <emilio@crisal.io>
Mon, 04 Jun 2018 21:40:07 +0200
changeset 477969 103325ca22ce29ec9f493b88b59484589f9252b2
parent 477968 4174465473fcdd99c17b2fea0793f2e45ca070dc
child 477970 d1ff77f492c46d64ab3e6fe73a87646c329cf6a9
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1466647
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1466647: Update smallbitvec to v2.1.1. r=me Actual code changes reviewed upstream in: https://github.com/servo/smallbitvec/pull/12 MozReview-Commit-ID: 3vKVPMovBj
Cargo.lock
servo/components/style/Cargo.toml
third_party/rust/smallbitvec/.cargo-checksum.json
third_party/rust/smallbitvec/Cargo.toml
third_party/rust/smallbitvec/src/lib.rs
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1134,17 +1134,17 @@ name = "malloc_size_of"
 version = "0.0.1"
 dependencies = [
  "app_units 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "cssparser 0.23.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "euclid 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "hashglobe 0.1.0",
  "selectors 0.19.0",
  "servo_arc 0.1.1",
- "smallbitvec 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "smallbitvec 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "malloc_size_of_derive"
 version = "0.0.1"
 dependencies = [
@@ -1844,17 +1844,17 @@ version = "0.0.1"
 
 [[package]]
 name = "slab"
 version = "0.3.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "smallbitvec"
-version = "2.1.0"
+version = "2.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "smallvec"
 version = "0.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -1929,17 +1929,17 @@ dependencies = [
  "ordered-float 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
  "parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "rayon 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "regex 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "selectors 0.19.0",
  "servo_arc 0.1.1",
- "smallbitvec 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "smallbitvec 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "style_derive 0.0.1",
  "style_traits 0.0.1",
  "time 0.1.38 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  "uluru 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "unicode-segmentation 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2673,17 +2673,17 @@ dependencies = [
 "checksum semver 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a3186ec9e65071a2095434b1f5bb24838d4e8e130f584c790f6033c79943537"
 "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
 "checksum serde 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)" = "34e9df8efbe7a2c12ceec1fc8744d56ae3374d8ae325f4a0028949d16433d554"
 "checksum serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)" = "adb6e51a6b3696b301bc221d785f898b4457c619b51d7ce195a6d20baecb37b3"
 "checksum serde_derive 1.0.58 (git+https://github.com/servo/serde?branch=deserialize_from_enums7)" = "<none>"
 "checksum simd 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3dd0805c7363ab51a829a1511ad24b6ed0349feaa756c4bc2f977f9f496e6673"
 "checksum siphasher 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ffc669b726f2bc9a3bcff66e5e23b56ba6bf70e22a34c3d7b6d0b3450b65b84"
 "checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
-"checksum smallbitvec 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "665fbc8384f961eb55c548daa2a4b1efff1f9d03b7a10f162ac6ad6a781ca966"
+"checksum smallbitvec 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c63726029f0069f88467873e47f392575f28f9f16b72ac65465263db4b3a13c"
 "checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9"
 "checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b"
 "checksum string_cache 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39cb4173bcbd1319da31faa5468a7e3870683d7a237150b0b0aaafd546f6ad12"
 "checksum string_cache_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "479cde50c3539481f33906a387f2bd17c8e87cb848c35b6021d41fb81ff9b4d7"
 "checksum string_cache_shared 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1884d1bc09741d466d9b14e6d37ac89d6909cbcac41dd9ae982d4d063bbedfc"
 "checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694"
 "checksum syn 0.12.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9e1c669ed757c0ebd04337f6a5bb972d05e0c08fe2540dd3ee3dd9e4daf1604c"
 "checksum syn 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "91b52877572087400e83d24b9178488541e3d535259e04ff17a63df1e5ceff59"
--- a/servo/components/style/Cargo.toml
+++ b/servo/components/style/Cargo.toml
@@ -55,17 +55,17 @@ owning_ref = "0.3.3"
 parking_lot = "0.5"
 precomputed-hash = "0.1.1"
 rayon = "1"
 selectors = { path = "../selectors" }
 serde = {version = "1.0", optional = true, features = ["derive"]}
 servo_arc = { path = "../servo_arc" }
 servo_atoms = {path = "../atoms", optional = true}
 servo_config = {path = "../config", optional = true}
-smallbitvec = "2.1.0"
+smallbitvec = "2.1.1"
 smallvec = "0.6"
 string_cache = { version = "0.7", optional = true }
 style_derive = {path = "../style_derive"}
 style_traits = {path = "../style_traits"}
 servo_url = {path = "../url", optional = true}
 time = "0.1"
 uluru = "0.2"
 unicode-bidi = "0.3"
--- a/third_party/rust/smallbitvec/.cargo-checksum.json
+++ b/third_party/rust/smallbitvec/.cargo-checksum.json
@@ -1,1 +1,1 @@
-{"files":{".travis.yml":"91edce5ea2a1956399db4b17f580c8b7995af3aa9801c4314865f560c55d6d09","Cargo.toml":"b916f68b32a3896fd51b5e792b6fbefb22c45e4061f646ef38c0bd5d9f3ccc4d","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"daa94322de7eab889e055932396160395bd8e3af82f56ae8c419d3049111da72","README.md":"4ac9c9b88726f6bcc3b454d61ce75a8224bd430584b765e304be9aa21815c327","benches/bench.rs":"9691c531845f2741bcb6485641ee3fd3e39980925ec6e5f716464e94fd5adfd0","src/lib.rs":"49c8ea8ce266cbbe5fe4e32e063067f334764bf55ec957f0c56c04ffa9360b51","src/tests.rs":"1d92b1cf9660293664bcee3be22c40859603dece4502cedcf53e0b0301683d7e"},"package":"665fbc8384f961eb55c548daa2a4b1efff1f9d03b7a10f162ac6ad6a781ca966"}
\ No newline at end of file
+{"files":{".travis.yml":"91edce5ea2a1956399db4b17f580c8b7995af3aa9801c4314865f560c55d6d09","Cargo.toml":"0923f01dc65f779c739001ea75778f7883ab6eea3a8082cb969a5d0e70304ed6","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"daa94322de7eab889e055932396160395bd8e3af82f56ae8c419d3049111da72","README.md":"4ac9c9b88726f6bcc3b454d61ce75a8224bd430584b765e304be9aa21815c327","benches/bench.rs":"9691c531845f2741bcb6485641ee3fd3e39980925ec6e5f716464e94fd5adfd0","src/lib.rs":"f892034f32f48e60f0e22fad45faa7a230b0f119ef78f68b6ba3cdb525ea649b","src/tests.rs":"1d92b1cf9660293664bcee3be22c40859603dece4502cedcf53e0b0301683d7e"},"package":"5c63726029f0069f88467873e47f392575f28f9f16b72ac65465263db4b3a13c"}
\ No newline at end of file
--- a/third_party/rust/smallbitvec/Cargo.toml
+++ b/third_party/rust/smallbitvec/Cargo.toml
@@ -7,17 +7,17 @@
 #
 # If you believe there's an error in this file please file an
 # issue against the rust-lang/cargo repository. If you're
 # editing this file be aware that the upstream Cargo.toml
 # will likely look very different (and much more reasonable)
 
 [package]
 name = "smallbitvec"
-version = "2.1.0"
+version = "2.1.1"
 authors = ["Matt Brubeck <mbrubeck@limpet.net>"]
 description = "A bit vector optimized for size and inline storage"
 documentation = "https://docs.rs/smallbitvec"
 readme = "README.md"
 keywords = ["bitvec", "bitmap", "vec", "data-structures"]
 categories = ["data-structures"]
 license = "MIT / Apache-2.0"
 repository = "https://github.com/servo/smallbitvec"
--- a/third_party/rust/smallbitvec/src/lib.rs
+++ b/third_party/rust/smallbitvec/src/lib.rs
@@ -9,16 +9,29 @@
 
 //! [`SmallBitVec`] is a bit vector, a vector of single-bit values stored compactly in memory.
 //!
 //! SmallBitVec grows dynamically, like the standard `Vec<T>` type.  It can hold up to about one
 //! word of bits inline (without a separate heap allocation).  If the number of bits exceeds this
 //! inline capacity, it will allocate a buffer on the heap.
 //!
 //! [`SmallBitVec`]: struct.SmallBitVec.html
+//!
+//! # Example
+//!
+//! ```
+//! use smallbitvec::SmallBitVec;
+//!
+//! let mut v = SmallBitVec::new();
+//! v.push(true);
+//! v.push(false);
+//!
+//! assert_eq!(v[0], true);
+//! assert_eq!(v[1], false);
+//! ```
 
 use std::cmp::max;
 use std::fmt;
 use std::hash;
 use std::iter::{DoubleEndedIterator, ExactSizeIterator, FromIterator};
 use std::mem::{forget, replace, size_of};
 use std::ops::{Index, Range};
 use std::slice;
@@ -72,41 +85,46 @@ mod tests;
 ///
 /// `SmallBitVec` is exactly one word wide. Depending on the required capacity, this word
 /// either stores the bits inline, or it stores a pointer to a separate buffer on the heap.
 pub struct SmallBitVec {
     data: usize,
 }
 
 /// Total number of bits per word.
+#[inline(always)]
 fn inline_bits() -> usize {
     size_of::<usize>() * 8
 }
 
 /// For an inline vector, all bits except two can be used as storage capacity:
 ///
 /// - The rightmost bit is set to zero to signal an inline vector.
 /// - The position of the rightmost nonzero bit encodes the length.
+#[inline(always)]
 fn inline_capacity() -> usize {
     inline_bits() - 2
 }
 
 /// Left shift amount to access the nth bit
+#[inline(always)]
 fn inline_shift(n: usize) -> usize {
     debug_assert!(n <= inline_capacity());
     // The storage starts at the leftmost bit.
     inline_bits() - 1 - n
 }
 
 /// An inline vector with the nth bit set.
+#[inline(always)]
 fn inline_index(n: usize) -> usize {
     1 << inline_shift(n)
 }
 
 /// An inline vector with the leftmost `n` bits set.
+#[inline(always)]
 fn inline_ones(n: usize) -> usize {
     if n == 0 {
         0
     } else {
         !0 << (inline_bits() - n)
     }
 }
 
@@ -152,35 +170,38 @@ impl Header {
             (*header_ptr).len = len;
             (*header_ptr).buffer_len = buffer_len;
         }
         header_ptr
     }
 }
 
 /// The number of `Storage` elements to allocate to hold a header.
+#[inline(always)]
 fn header_len() -> usize {
     size_of::<Header>() / size_of::<Storage>()
 }
 
 /// The minimum number of `Storage` elements to hold at least `cap` bits.
+#[inline(always)]
 fn buffer_len(cap: usize) -> usize {
     (cap + bits_per_storage() - 1) / bits_per_storage()
 }
 
 impl SmallBitVec {
     /// Create an empty vector.
     #[inline]
     pub fn new() -> SmallBitVec {
         SmallBitVec {
             data: inline_index(0),
         }
     }
 
     /// Create a vector containing `len` bits, each set to `val`.
+    #[inline]
     pub fn from_elem(len: usize, val: bool) -> SmallBitVec {
         if len <= inline_capacity() {
             return SmallBitVec {
                 data: if val {
                     inline_ones(len + 1)
                 } else {
                     inline_index(len)
                 },
@@ -189,16 +210,17 @@ impl SmallBitVec {
         let header_ptr = Header::new(len, len, val);
         SmallBitVec {
             data: (header_ptr as usize) | HEAP_FLAG,
         }
     }
 
     /// Create an empty vector with enough storage pre-allocated to store at least `cap` bits
     /// without resizing.
+    #[inline]
     pub fn with_capacity(cap: usize) -> SmallBitVec {
         // Use inline storage if possible.
         if cap <= inline_capacity() {
             return SmallBitVec::new();
         }
 
         // Otherwise, allocate on the heap.
         let header_ptr = Header::new(cap, 0, false);
@@ -241,36 +263,39 @@ impl SmallBitVec {
         if n < self.len() {
             Some(unsafe { self.get_unchecked(n) })
         } else {
             None
         }
     }
 
     /// Get the nth bit in this bit vector, without bounds checks.
+    #[inline]
     pub unsafe fn get_unchecked(&self, n: usize) -> bool {
         if self.is_inline() {
             self.data & inline_index(n) != 0
         } else {
             let buffer = self.buffer();
             let i = n / bits_per_storage();
             let offset = n % bits_per_storage();
             *buffer.get_unchecked(i) & (1 << offset) != 0
         }
     }
 
     /// Set the nth bit in this bit vector to `val`.  Panics if the index is out of bounds.
+    #[inline]
     pub fn set(&mut self, n: usize, val: bool) {
         assert!(n < self.len(), "Index {} out of bounds", n);
         unsafe {
             self.set_unchecked(n, val);
         }
     }
 
     /// Set the nth bit in this bit vector to `val`, without bounds checks.
+    #[inline]
     pub unsafe fn set_unchecked(&mut self, n: usize, val: bool) {
         if self.is_inline() {
             if val {
                 self.data |= inline_index(n);
             } else {
                 self.data &= !inline_index(n);
             }
         } else {
@@ -313,31 +338,33 @@ impl SmallBitVec {
     /// use smallbitvec::SmallBitVec;
     /// let mut v = SmallBitVec::new();
     /// v.push(false);
     ///
     /// assert_eq!(v.pop(), Some(false));
     /// assert_eq!(v.len(), 0);
     /// assert_eq!(v.pop(), None);
     /// ```
+    #[inline]
     pub fn pop(&mut self) -> Option<bool> {
         let old_len = self.len();
         if old_len == 0 {
             return None;
         }
         unsafe {
             let val = self.get_unchecked(old_len - 1);
             self.set_len(old_len - 1);
             Some(val)
         }
     }
 
     /// Remove and return the bit at index `idx`, shifting all later bits toward the front.
     ///
     /// Panics if the index is out of bounds.
+    #[inline]
     pub fn remove(&mut self, idx: usize) -> bool {
         let len = self.len();
         let val = self[idx];
 
         if self.is_inline() {
             // Shift later bits, including the length bit, toward the front.
             let mask = !inline_ones(idx);
             let new_vals = (self.data & mask) << 1;
@@ -368,29 +395,31 @@ impl SmallBitVec {
             unsafe {
                 self.set_len(len - 1);
             }
         }
         val
     }
 
     /// Remove all elements from the vector, without deallocating its buffer.
+    #[inline]
     pub fn clear(&mut self) {
         unsafe {
             self.set_len(0);
         }
     }
 
     /// Reserve capacity for at least `additional` more elements to be inserted.
     ///
     /// May reserve more space than requested, to avoid frequent reallocations.
     ///
     /// Panics if the new capacity overflows `usize`.
     ///
     /// Re-allocates only if `self.capacity() < self.len() + additional`.
+    #[inline]
     pub fn reserve(&mut self, additional: usize) {
         let old_cap = self.capacity();
         let new_cap = self.len()
             .checked_add(additional)
             .expect("capacity overflow");
         if new_cap <= old_cap {
             return;
         }
@@ -398,49 +427,53 @@ impl SmallBitVec {
         let double_cap = old_cap.saturating_mul(2);
         self.reallocate(max(new_cap, double_cap));
     }
 
     /// Set the length of the vector. The length must not exceed the capacity.
     ///
     /// If this makes the vector longer, then the values of its new elements
     /// are not specified.
+    #[inline]
     unsafe fn set_len(&mut self, len: usize) {
         debug_assert!(len <= self.capacity());
         if self.is_inline() {
             let sentinel = inline_index(len);
             let mask = !(sentinel - 1);
             self.data |= sentinel;
             self.data &= mask;
         } else {
             self.header_mut().len = len;
         }
     }
 
     /// Returns an iterator that yields the bits of the vector in order, as `bool` values.
+    #[inline]
     pub fn iter(&self) -> Iter {
         Iter {
             vec: self,
             range: 0..self.len(),
         }
     }
 
     /// Returns an immutable view of a range of bits from this vec.
     /// ```
     /// #[macro_use] extern crate smallbitvec;
     /// let v = sbvec![true, false, true];
     /// let r = v.range(1..3);
     /// assert_eq!(r[1], true);
     /// ```
+    #[inline]
     pub fn range(&self, range: Range<usize>) -> VecRange {
         assert!(range.end <= self.len(), "range out of bounds");
         VecRange { vec: &self, range }
     }
 
     /// Returns true if all the bits in the vec are set to zero/false.
+    #[inline]
     pub fn all_false(&self) -> bool {
         let mut len = self.len();
         if len == 0 {
             return true;
         }
 
         if self.is_inline() {
             let mask = inline_ones(len);
@@ -460,16 +493,17 @@ impl SmallBitVec {
                     break;
                 }
             }
             true
         }
     }
 
     /// Returns true if all the bits in the vec are set to one/true.
+    #[inline]
     pub fn all_true(&self) -> bool {
         let mut len = self.len();
         if len == 0 {
             return true;
         }
 
         if self.is_inline() {
             let mask = inline_ones(len);
@@ -527,63 +561,72 @@ impl SmallBitVec {
                 }
             }
         }
     }
 
     /// If the vector owns a heap allocation, returns a pointer to the start of the allocation.
     ///
     /// The layout of the data at this allocation is a private implementation detail.
+    #[inline]
     pub fn heap_ptr(&self) -> Option<*const usize> {
         if self.is_heap() {
             Some((self.data & !HEAP_FLAG) as *const Storage)
         } else {
             None
         }
     }
 
     /// If the rightmost bit is set, then we treat it as inline storage.
+    #[inline]
     fn is_inline(&self) -> bool {
         self.data & HEAP_FLAG == 0
     }
 
     /// Otherwise, `data` is a pointer to a heap allocation.
+    #[inline]
     fn is_heap(&self) -> bool {
         !self.is_inline()
     }
 
     /// Get the header of a heap-allocated vector.
+    #[inline]
     fn header_raw(&self) -> *mut Header {
         assert!(self.is_heap());
         (self.data & !HEAP_FLAG) as *mut Header
     }
 
+    #[inline]
     fn header_mut(&mut self) -> &mut Header {
         unsafe { &mut *self.header_raw() }
     }
 
+    #[inline]
     fn header(&self) -> &Header {
         unsafe { &*self.header_raw() }
     }
 
     /// Get the buffer of a heap-allocated vector.
+    #[inline]
     fn buffer_raw(&self) -> *mut [Storage] {
         unsafe {
             let header_ptr = self.header_raw();
             let buffer_len = (*header_ptr).buffer_len;
             let buffer_ptr = (header_ptr as *mut Storage)
                 .offset((size_of::<Header>() / size_of::<Storage>()) as isize);
             slice::from_raw_parts_mut(buffer_ptr, buffer_len)
         }
     }
 
+    #[inline]
     fn buffer_mut(&mut self) -> &mut [Storage] {
         unsafe { &mut *self.buffer_raw() }
     }
 
+    #[inline]
     fn buffer(&self) -> &[Storage] {
         unsafe { &*self.buffer_raw() }
     }
 }
 
 // Trait implementations:
 
 impl fmt::Debug for SmallBitVec {
@@ -672,17 +715,17 @@ impl Clone for SmallBitVec {
             data: (header_ptr as usize) | HEAP_FLAG,
         }
     }
 }
 
 impl Index<usize> for SmallBitVec {
     type Output = bool;
 
-    #[inline]
+    #[inline(always)]
     fn index(&self, i: usize) -> &bool {
         assert!(i < self.len(), "index out of range");
         if self.get(i).unwrap() {
             &true
         } else {
             &false
         }
     }
@@ -826,16 +869,17 @@ impl<'a> ExactSizeIterator for Iter<'a> 
 /// [1]: struct.SmallBitVec.html#method.range
 #[derive(Debug, Clone)]
 pub struct VecRange<'a> {
     vec: &'a SmallBitVec,
     range: Range<usize>,
 }
 
 impl<'a> VecRange<'a> {
+    #[inline]
     pub fn iter(&self) -> Iter<'a> {
         Iter {
             vec: self.vec,
             range: self.range.clone(),
         }
     }
 }