gecko-dev/js/public/HashTable.h
Nicholas Nethercote b85493f609 Bug 1477626 - Move js::Hash{Set,Map} into MFBT. r=Waldo
The main change is that the patch copies js/public/HashTable.h to
mfbt/HashTable.h, and then changes it as follows.

- Changes `js` namespaces to `mozilla` (and removes some now-unnecessary
  `mozilla::` qualifiers).

- Changes the default AllocPolicy from the SpiderMonkey-specific
  `TempAllocPolicy` to the generic `MallocAllocPolicy`.

- Adds `#include "AllocPolicy.h"` (like mfbt/Vector.h).

- Changes `JS_DEBUG` use to `DEBUG`.

- Minor comment updates, as necessary.

js/public/HashTable.h is now tiny, holding just a few renamings of things from
the `mozilla` namespace into the `js` namespace to minimize churn elsewhere.
(Those renamings keep `TempAllocPolicy` as the default AllocPolicy for
js::Hash{Set,Map}.)

Also, various template specializations had to be moved from the `js` namespace
to the `mozilla` namespace to avoid compile errors.

MozReview-Commit-ID: GS9Qn9YeYDA

--HG--
rename : js/public/HashTable.h => mfbt/HashTable.h
2018-07-26 20:15:49 +10:00

39 lines
1.1 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* 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 js_HashTable_h
#define js_HashTable_h
#include "mozilla/HashTable.h"
namespace js {
using HashNumber = mozilla::HashNumber;
static const uint32_t kHashNumberBits = mozilla::kHashNumberBits;
class TempAllocPolicy;
template <class T>
using DefaultHasher = mozilla::DefaultHasher<T>;
template <typename Key>
using PointerHasher = mozilla::PointerHasher<Key>;
template <typename T,
class HashPolicy = mozilla::DefaultHasher<T>,
class AllocPolicy = TempAllocPolicy>
using HashSet = mozilla::HashSet<T, HashPolicy, AllocPolicy>;
template <typename Key,
typename Value,
class HashPolicy = mozilla::DefaultHasher<Key>,
class AllocPolicy = TempAllocPolicy>
using HashMap = mozilla::HashMap<Key, Value, HashPolicy, AllocPolicy>;
}
#endif /* js_HashTable_h */