Bug 1462544 - Various readability and IWYU fixes to ds/Bitmap.h. r=jandem
authorJeff Walden <jwalden@mit.edu>
Fri, 18 May 2018 11:44:28 -0700
changeset 418923 63d37d73f5ae
parent 418922 7491ab23247f
child 418924 562e5ddb5332
push id103419
push userjwalden@mit.edu
push dateFri, 18 May 2018 19:33:51 +0000
treeherdermozilla-inbound@7658d2d1e0d7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1462544
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 1462544 - Various readability and IWYU fixes to ds/Bitmap.h. r=jandem
js/src/ds/Bitmap.h
--- a/js/src/ds/Bitmap.h
+++ b/js/src/ds/Bitmap.h
@@ -2,17 +2,25 @@
  * vim: set ts=8 sts=4 et sw=4 tw=99:
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef ds_Bitmap_h
 #define ds_Bitmap_h
 
+#include "mozilla/Array.h"
+#include "mozilla/Assertions.h"
+#include "mozilla/Attributes.h"
+#include "mozilla/MemoryChecking.h"
+#include "mozilla/PodOperations.h"
+
 #include <algorithm>
+#include <stddef.h>
+#include <stdint.h>
 
 #include "js/AllocPolicy.h"
 #include "js/HashTable.h"
 #include "js/Vector.h"
 
 // This file provides two classes for representing bitmaps.
 //
 // DenseBitmap is an array of words of bits, with size linear in the maximum
@@ -21,17 +29,18 @@
 // SparseBitmap provides a reasonably simple, reasonably efficient (in time and
 // space) implementation of a sparse bitmap. The basic representation is a hash
 // table whose entries are fixed length malloc'ed blocks of bits.
 
 namespace js {
 
 class DenseBitmap
 {
-    typedef Vector<uintptr_t, 0, SystemAllocPolicy> Data;
+    using Data = Vector<uintptr_t, 0, SystemAllocPolicy>;
+
     Data data;
 
   public:
     size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) {
         return data.sizeOfExcludingThis(mallocSizeOf);
     }
 
     bool ensureSpace(size_t numWords) {
@@ -57,18 +66,19 @@ class DenseBitmap
 class SparseBitmap
 {
     // The number of words of bits to use for each block mainly affects the
     // memory usage of the bitmap. To minimize overhead, bitmaps which are
     // expected to be fairly dense should have a large block size, and bitmaps
     // which are expected to be very sparse should have a small block size.
     static const size_t WordsInBlock = 4096 / sizeof(uintptr_t);
 
-    typedef mozilla::Array<uintptr_t, WordsInBlock> BitBlock;
-    typedef HashMap<size_t, BitBlock*, DefaultHasher<size_t>, SystemAllocPolicy> Data;
+    using BitBlock = mozilla::Array<uintptr_t, WordsInBlock>;
+    using Data = HashMap<size_t, BitBlock*, DefaultHasher<size_t>, SystemAllocPolicy>;
+
     Data data;
 
     static size_t blockStartWord(size_t word) {
         return word & ~(WordsInBlock - 1);
     }
 
     // Return the number of words in a BitBlock starting at |blockWord| which
     // are in |other|.