Bug 1477626 - Use mozilla::HashTable instead of js::HashTable in Bench.cpp. r=froydnj
MozReview-Commit-ID: 4P5L9Kdkiuu
--- 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);