Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: src/handles.h

Issue 1314473007: [turbofan] Remove usage of Unique<T> from graph. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/handles.h
diff --git a/src/handles.h b/src/handles.h
index 2db18307dacad563b89a5ba3eea179eb43b9b85e..133dbb586fa60cd94d06297ab6ad5666a29c3c83 100644
--- a/src/handles.h
+++ b/src/handles.h
@@ -6,6 +6,7 @@
#define V8_HANDLES_H_
#include "include/v8.h"
+#include "src/base/functional.h"
#include "src/base/macros.h"
#include "src/checks.h"
#include "src/globals.h"
@@ -118,6 +119,20 @@ class Handle final : public HandleBase {
// MaybeHandle to force validation before being used as handles.
static const Handle<T> null() { return Handle<T>(); }
+ // Provide function object for location equality comparison.
+ struct equal_to : public std::binary_function<Handle<T>, Handle<T>, bool> {
+ V8_INLINE bool operator()(Handle<T> lhs, Handle<T> rhs) const {
+ return lhs.location() == rhs.location();
+ }
+ };
+
+ // Provide function object for location hashing.
+ struct hash : public std::unary_function<Handle<T>, size_t> {
+ V8_INLINE size_t operator()(Handle<T> const& handle) const {
+ return base::hash<void*>()(handle.location());
+ }
+ };
+
private:
// Handles of different classes are allowed to access each other's location_.
template <typename>

Powered by Google App Engine
This is Rietveld 408576698