Index: src/handles.h |
diff --git a/src/handles.h b/src/handles.h |
index 684f4ca38e758110b73eb07eabc0b497613bb024..7efb252e52f84c2394f28a37c836b6395d96ac11 100644 |
--- a/src/handles.h |
+++ b/src/handles.h |
@@ -58,25 +58,21 @@ class Handle { |
a = b; // Fake assignment to enforce type checks. |
USE(a); |
#endif |
- location_ = reinterpret_cast<T**>(handle.location()); |
+ location_ = reinterpret_cast<T**>(handle.location_); |
} |
INLINE(T* operator ->() const) { return operator*(); } |
// Check if this handle refers to the exact same object as the other handle. |
bool is_identical_to(const Handle<T> other) const { |
- return operator*() == *other; |
+ return *location_ == *other.location_; |
} |
// Provides the C++ dereference operator. |
INLINE(T* operator*() const); |
// Returns the address to where the raw pointer is stored. |
- T** location() const { |
- ASSERT(location_ == NULL || |
- reinterpret_cast<Address>(*location_) != kZapValue); |
- return location_; |
- } |
+ INLINE(T** location() const); |
template <class S> static Handle<T> cast(Handle<S> that) { |
T::cast(*that); |
@@ -92,6 +88,9 @@ class Handle { |
private: |
T** location_; |
+ |
+ // Handles of different classes are allowed to access each other's location_. |
+ template<class S> friend class Handle; |
}; |
@@ -339,6 +338,34 @@ class NoHandleAllocation BASE_EMBEDDED { |
#endif |
}; |
+ |
+class NoHandleDereference BASE_EMBEDDED { |
+ public: |
+#ifndef DEBUG |
+ NoHandleDereference() {} |
+ ~NoHandleDereference() {} |
+#else |
+ inline NoHandleDereference(); |
+ inline ~NoHandleDereference(); |
+ private: |
+ bool old_state_; |
+#endif |
+}; |
+ |
+ |
+class AllowHandleDereference BASE_EMBEDDED { |
+ public: |
+#ifndef DEBUG |
+ AllowHandleDereference() {} |
+ ~AllowHandleDereference() {} |
+#else |
+ inline AllowHandleDereference(); |
+ inline ~AllowHandleDereference(); |
+ private: |
+ bool old_state_; |
+#endif |
+}; |
+ |
} } // namespace v8::internal |
#endif // V8_HANDLES_H_ |