Index: src/handles.h |
diff --git a/src/handles.h b/src/handles.h |
index 8e9404cb9d105024578fa92b18e140a2a15d0dc0..938d43b8a4e8ba418f85b7eb5ccd2a5ccfb6aad3 100644 |
--- a/src/handles.h |
+++ b/src/handles.h |
@@ -73,8 +73,8 @@ class Handle { |
INLINE(T** location() const); |
template <class S> static Handle<T> cast(Handle<S> that) { |
- T::cast(*that); |
- return Handle<T>(reinterpret_cast<T**>(that.location())); |
+ T::cast(*reinterpret_cast<T**>(that.location_)); |
+ return Handle<T>(reinterpret_cast<T**>(that.location_)); |
} |
static Handle<T> null() { return Handle<T>(); } |
@@ -84,6 +84,10 @@ class Handle { |
// implementation in api.h. |
inline Handle<T> EscapeFrom(v8::HandleScope* scope); |
+#ifdef DEBUG |
+ bool IsDereferenceAllowed(bool allow_deferred) const; |
+#endif // DEBUG |
+ |
private: |
T** location_; |
@@ -341,7 +345,7 @@ class NoHandleAllocation BASE_EMBEDDED { |
class HandleDereferenceGuard BASE_EMBEDDED { |
public: |
- enum State { ALLOW, DISALLOW }; |
+ enum State { ALLOW, DISALLOW, DISALLOW_DEFERRED }; |
#ifndef DEBUG |
HandleDereferenceGuard(Isolate* isolate, State state) { } |
~HandleDereferenceGuard() { } |
@@ -350,10 +354,18 @@ class HandleDereferenceGuard BASE_EMBEDDED { |
inline ~HandleDereferenceGuard(); |
private: |
Isolate* isolate_; |
- bool old_state_; |
+ State old_state_; |
#endif |
}; |
+#ifdef DEBUG |
+#define ALLOW_HANDLE_DEREF(isolate, why_this_is_safe) \ |
+ HandleDereferenceGuard allow_deref(isolate, \ |
+ HandleDereferenceGuard::ALLOW); |
+#else |
+#define ALLOW_HANDLE_DEREF(isolate, why_this_is_safe) |
+#endif // DEBUG |
+ |
} } // namespace v8::internal |
#endif // V8_HANDLES_H_ |