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

Unified Diff: src/handles.h

Issue 15691017: Make assertion scopes thread safe. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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
« src/api.cc ('K') | « src/frames.cc ('k') | src/handles.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/handles.h
diff --git a/src/handles.h b/src/handles.h
index 29ece281e0984d3fe9224860b3aa2703911cddd1..46dd1fd2514ad33886a0b73d6ea785272bec37c5 100644
--- a/src/handles.h
+++ b/src/handles.h
@@ -85,7 +85,7 @@ class Handle {
inline Handle<T> EscapeFrom(v8::HandleScope* scope);
#ifdef DEBUG
- bool IsDereferenceAllowed(bool allow_deferred) const;
+ bool IsDereferenceAllowed(bool explicitly_allow_deferred) const;
#endif // DEBUG
private:
@@ -330,14 +330,17 @@ Handle<ObjectHashTable> PutIntoObjectHashTable(Handle<ObjectHashTable> table,
Handle<Object> key,
Handle<Object> value);
-class NoHandleAllocation BASE_EMBEDDED {
+
+// Seal off the current HandleScope so that new handles can only be created
+// if a new HandleScope is entered.
+class SealHandleScope BASE_EMBEDDED {
public:
#ifndef DEBUG
- explicit NoHandleAllocation(Isolate* isolate) {}
- ~NoHandleAllocation() {}
+ explicit SealHandleScope(Isolate* isolate) {}
+ ~SealHandleScope() {}
#else
- explicit inline NoHandleAllocation(Isolate* isolate);
- inline ~NoHandleAllocation();
+ explicit inline SealHandleScope(Isolate* isolate);
+ inline ~SealHandleScope();
private:
Isolate* isolate_;
Object** limit_;
@@ -346,30 +349,6 @@ class NoHandleAllocation BASE_EMBEDDED {
#endif
};
-
-class HandleDereferenceGuard BASE_EMBEDDED {
- public:
- enum State { ALLOW, DISALLOW, DISALLOW_DEFERRED };
-#ifndef DEBUG
- HandleDereferenceGuard(Isolate* isolate, State state) { }
- ~HandleDereferenceGuard() { }
-#else
- inline HandleDereferenceGuard(Isolate* isolate, State state);
- inline ~HandleDereferenceGuard();
- private:
- Isolate* isolate_;
- 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_
« src/api.cc ('K') | « src/frames.cc ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698