Index: src/api.h |
diff --git a/src/api.h b/src/api.h |
index 58e6a6e410380bf96e6eafb94dba5ff1a7ba5f38..cd6c3da078af24b0a83bf640e950ca33c60ec884 100644 |
--- a/src/api.h |
+++ b/src/api.h |
@@ -392,6 +392,28 @@ class StringTracker { |
}; |
+class DeferredHandles { |
+ public: |
+ ~DeferredHandles(); |
+ |
+ private: |
+ DeferredHandles(DeferredHandles* next, Object** last_block_limit, |
+ HandleScopeImplementer* impl) |
+ : next_(next), previous_(NULL), last_block_limit_(last_block_limit), |
+ impl_(impl) {} |
+ |
+ void Iterate(ObjectVisitor* v); |
+ |
+ List<Object**> blocks_; |
+ DeferredHandles* next_; |
+ DeferredHandles* previous_; |
+ Object** last_block_limit_; |
+ HandleScopeImplementer* impl_; |
+ |
+ friend class HandleScopeImplementer; |
+}; |
+ |
+ |
// This class is here in order to be able to declare it a friend of |
// HandleScope. Moving these methods to be members of HandleScope would be |
// neat in some ways, but it would expose internal implementation details in |
@@ -409,7 +431,9 @@ class HandleScopeImplementer { |
entered_contexts_(0), |
saved_contexts_(0), |
spare_(NULL), |
- call_depth_(0) { } |
+ call_depth_(0), |
+ last_handle_before_deferred_block_(NULL), |
+ deferred_handles_head_(NULL) { } |
~HandleScopeImplementer() { |
DeleteArray(spare_); |
@@ -445,6 +469,7 @@ class HandleScopeImplementer { |
inline bool HasSavedContexts(); |
inline List<internal::Object**>* blocks() { return &blocks_; } |
+ Isolate* isolate() const { return isolate_; } |
private: |
void ResetAfterArchive() { |
@@ -469,6 +494,10 @@ class HandleScopeImplementer { |
ASSERT(call_depth_ == 0); |
} |
+ void BeginDeferredScope(); |
+ DeferredHandles* Detach(Object** prev_limit); |
+ void DestroyDeferredHandles(DeferredHandles* handles); |
+ |
Isolate* isolate_; |
List<internal::Object**> blocks_; |
// Used as a stack to keep track of entered contexts. |
@@ -477,6 +506,8 @@ class HandleScopeImplementer { |
List<Context*> saved_contexts_; |
Object** spare_; |
int call_depth_; |
+ Object** last_handle_before_deferred_block_; |
+ DeferredHandles* deferred_handles_head_; |
// This is only used for threading support. |
v8::ImplementationUtilities::HandleScopeData handle_scope_data_; |
@@ -484,6 +515,9 @@ class HandleScopeImplementer { |
char* RestoreThreadHelper(char* from); |
char* ArchiveThreadHelper(char* to); |
+ friend class DeferredHandles; |
+ friend class DeferredHandleScope; |
+ |
DISALLOW_COPY_AND_ASSIGN(HandleScopeImplementer); |
}; |