Index: src/handles.h |
diff --git a/src/handles.h b/src/handles.h |
index 1f97d6ff7e6d95c76b521baf45938e5f1c5f8243..ab8ed0920a4c637b6c0bc67775c801ee287f2ec1 100644 |
--- a/src/handles.h |
+++ b/src/handles.h |
@@ -43,6 +43,10 @@ class HandleBase { |
V8_INLINE bool is_null() const { return location_ == nullptr; } |
+ // Returns the raw address where this handle is stored. This should only be |
+ // used for hashing handles; do not ever try to dereference it. |
+ V8_INLINE Address address() const { return bit_cast<Address>(location_); } |
+ |
protected: |
// Provides the C++ dereference operator. |
V8_INLINE Object* operator*() const { |
@@ -132,14 +136,14 @@ class Handle final : public HandleBase { |
// 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(); |
+ return lhs.address() == rhs.address(); |
} |
}; |
// 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()); |
+ return base::hash<void*>()(handle.address()); |
} |
}; |