| Index: src/compiler/node-cache.h
|
| diff --git a/src/compiler/node-cache.h b/src/compiler/node-cache.h
|
| index 35352ea1eb1e19e93eabe1393a9eedefcb36c803..7741e1ef36a747e90ffca2721958c6edbd977ae9 100644
|
| --- a/src/compiler/node-cache.h
|
| +++ b/src/compiler/node-cache.h
|
| @@ -5,20 +5,30 @@
|
| #ifndef V8_COMPILER_NODE_CACHE_H_
|
| #define V8_COMPILER_NODE_CACHE_H_
|
|
|
| -#include "src/v8.h"
|
| -
|
| -#include "src/compiler/node.h"
|
| +#include "src/base/functional.h"
|
| +#include "src/base/macros.h"
|
|
|
| namespace v8 {
|
| namespace internal {
|
| +
|
| +// Forward declarations.
|
| +class Zone;
|
| +
|
| +
|
| namespace compiler {
|
|
|
| +// Forward declarations.
|
| +class Node;
|
| +
|
| +
|
| // A cache for nodes based on a key. Useful for implementing canonicalization of
|
| // nodes such as constants, parameters, etc.
|
| -template <typename Key>
|
| -class NodeCache {
|
| +template <typename Key, typename Hash = base::hash<Key>,
|
| + typename Pred = std::equal_to<Key> >
|
| +class NodeCache FINAL {
|
| public:
|
| - explicit NodeCache(int max = 256) : entries_(NULL), size_(0), max_(max) {}
|
| + explicit NodeCache(size_t max = 256)
|
| + : entries_(nullptr), size_(0), max_(max) {}
|
|
|
| // Search for node associated with {key} and return a pointer to a memory
|
| // location in this cache that stores an entry for the key. If the location
|
| @@ -30,14 +40,15 @@ class NodeCache {
|
| Node** Find(Zone* zone, Key key);
|
|
|
| private:
|
| - struct Entry {
|
| - Key key_;
|
| - Node* value_;
|
| - };
|
| + enum { kInitialSize = 16u, kLinearProbe = 5u };
|
| +
|
| + struct Entry;
|
|
|
| Entry* entries_; // lazily-allocated hash entries.
|
| - int32_t size_;
|
| - int32_t max_;
|
| + size_t size_;
|
| + size_t max_;
|
| + Hash hash_;
|
| + Pred pred_;
|
|
|
| bool Resize(Zone* zone);
|
| };
|
| @@ -46,8 +57,9 @@ class NodeCache {
|
| typedef NodeCache<int64_t> Int64NodeCache;
|
| typedef NodeCache<int32_t> Int32NodeCache;
|
| typedef NodeCache<void*> PtrNodeCache;
|
| -}
|
| -}
|
| -} // namespace v8::internal::compiler
|
| +
|
| +} // namespace compiler
|
| +} // namespace internal
|
| +} // namespace v8
|
|
|
| #endif // V8_COMPILER_NODE_CACHE_H_
|
|
|