Bug 1477626 - Use mozilla::HashTable instead of js::HashTable in Bench.cpp. r=froydnj draft
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 26 Jul 2018 20:16:00 +1000
changeset 822913 94c8766601b3afae1c6b648410ac35872a6106b9
parent 822912 635daf9bd3b3e5fb27367e59782e4eac3b36e965
push id117517
push usernnethercote@mozilla.com
push dateThu, 26 Jul 2018 10:24:07 +0000
reviewersfroydnj
bugs1477626
milestone63.0a1
Bug 1477626 - Use mozilla::HashTable instead of js::HashTable in Bench.cpp. r=froydnj MozReview-Commit-ID: 4P5L9Kdkiuu
xpcom/rust/gtest/bench-collections/Bench.cpp
--- a/xpcom/rust/gtest/bench-collections/Bench.cpp
+++ b/xpcom/rust/gtest/bench-collections/Bench.cpp
@@ -33,28 +33,28 @@
 // Callgrind, do something like this:
 //
 //   MOZ_RUN_GTEST=1 GTEST_FILTER='*BenchCollections*$IMPL*'
 //       valgrind --tool=callgrind --callgrind-out-file=clgout
 //       $OBJDIR/dist/bin/firefox -unittest
 //   callgrind_annotate --auto=yes clgout > clgann
 //
 // where $IMPL is part of an implementation name in a test (e.g. "PLDHash",
-// "JSHash") and $OBJDIR is an objdir containing a --enable-release build.
+// "MozHash") and $OBJDIR is an objdir containing a --enable-release build.
 //
 // Note that multiple processes are spawned, so `clgout` gets overwritten
 // multiple times, but the last process to write its profiling data to file is
 // the one of interest. (Alternatively, use --callgrind-out-file=clgout.%p to
 // get separate output files for each process, with a PID suffix.)
 
 #include "gtest/gtest.h"
 #include "gtest/MozGTestBench.h" // For MOZ_GTEST_BENCH
-#include "js/HashTable.h"
 #include "mozilla/AllocPolicy.h"
 #include "mozilla/HashFunctions.h"
+#include "mozilla/HashTable.h"
 #include "mozilla/StaticMutex.h"
 #include "mozilla/TimeStamp.h"
 #include "PLDHashTable.h"
 #include <unordered_set>
 
 using namespace mozilla;
 
 // This function gives a pseudo-random sequence with the following properties:
@@ -166,19 +166,19 @@ Bench_Cpp_PLDHashTable(const Params* aPa
     MOZ_RELEASE_ASSERT(hs.EntryCount() == 0);
   } else {
     MOZ_RELEASE_ASSERT(hs.EntryCount() == aParams->mNumInserts);
   }
 }
 
 // Keep this in sync with all the other Bench_*() functions.
 void
-Bench_Cpp_JSHashSet(const Params* aParams, void** aVals, size_t aLen)
+Bench_Cpp_MozHashSet(const Params* aParams, void** aVals, size_t aLen)
 {
-  js::HashSet<void*, js::DefaultHasher<void*>, MallocAllocPolicy> hs;
+  mozilla::HashSet<void*, mozilla::DefaultHasher<void*>, MallocAllocPolicy> hs;
   MOZ_RELEASE_ASSERT(hs.init());
 
   for (size_t j = 0; j < aParams->mNumInserts; j++) {
     auto p = hs.lookupForAdd(aVals[j]);
     MOZ_RELEASE_ASSERT(!p);
     MOZ_RELEASE_ASSERT(hs.add(p, aVals[j]));
   }
 
@@ -290,18 +290,18 @@ StaticMutex BenchCollections::sValsMutex
 MOZ_GTEST_BENCH_F(BenchCollections, unordered_set, [this] {
   BenchImpl(Bench_Cpp_unordered_set);
 });
 
 MOZ_GTEST_BENCH_F(BenchCollections, PLDHash, [this] {
   BenchImpl(Bench_Cpp_PLDHashTable);
 });
 
-MOZ_GTEST_BENCH_F(BenchCollections, JSHash, [this] {
-  BenchImpl(Bench_Cpp_JSHashSet);
+MOZ_GTEST_BENCH_F(BenchCollections, MozHash, [this] {
+  BenchImpl(Bench_Cpp_MozHashSet);
 });
 
 MOZ_GTEST_BENCH_F(BenchCollections, RustHash, [this] {
   BenchImpl(Bench_Rust_HashSet);
 });
 
 MOZ_GTEST_BENCH_F(BenchCollections, RustFnvHash, [this] {
   BenchImpl(Bench_Rust_FnvHashSet);