Chromium Code Reviews| Index: src/api.h |
| diff --git a/src/api.h b/src/api.h |
| index 58e6a6e410380bf96e6eafb94dba5ff1a7ba5f38..7c4b3dbb592554c905d65f0833fb309cb7895d9d 100644 |
| --- a/src/api.h |
| +++ b/src/api.h |
| @@ -409,7 +409,10 @@ class HandleScopeImplementer { |
| entered_contexts_(0), |
| saved_contexts_(0), |
| spare_(NULL), |
| - call_depth_(0) { } |
| + call_depth_(0), |
| + last_non_persistent_block_(NULL), |
| + last_non_persistent_handle_(NULL), |
| + persistent_extensions_head_(NULL) { } |
| ~HandleScopeImplementer() { |
| DeleteArray(spare_); |
| @@ -425,10 +428,21 @@ class HandleScopeImplementer { |
| void Iterate(v8::internal::ObjectVisitor* v); |
| static char* Iterate(v8::internal::ObjectVisitor* v, char* data); |
| + struct PersistentExtensions { |
|
danno
2012/06/24 11:07:03
Perhaps DeferredReleaseHandleScope?
|
| + List<Object**> blocks; |
| + Object** last_block_end; |
| + PersistentExtensions* previous; |
| + PersistentExtensions* next; |
| + }; |
| inline internal::Object** GetSpareOrNewBlock(); |
| inline void DeleteExtensions(internal::Object** prev_limit); |
| + // HideExtensions must be called _before_ the next field in |
| + // HandleScopeData is reverted. |
| + PersistentExtensions* PersistExtensions(internal::Object** prev_limit); |
|
danno
2012/06/24 11:07:03
BeginDeferredHandleScope?
|
| + void ReleaseExtensions(PersistentExtensions* extension); |
|
danno
2012/06/24 11:07:03
Should be a private method only called by the Defe
|
| + |
| inline void IncrementCallDepth() {call_depth_++;} |
| inline void DecrementCallDepth() {call_depth_--;} |
| inline bool CallDepthIsZero() { return call_depth_ == 0; } |
| @@ -446,6 +460,19 @@ class HandleScopeImplementer { |
| inline List<internal::Object**>* blocks() { return &blocks_; } |
| + void begin_persistence() { |
|
danno
2012/06/24 11:07:03
I think you can merge this with PersistExtensions
|
| + // We only track one such special block. |
| + ASSERT(!last_non_persistent_block_); |
| + last_non_persistent_block_ = blocks_.last(); |
| + last_non_persistent_handle_ = isolate_->handle_scope_data()->next; |
| + } |
| + |
| + void end_persistence() { |
|
danno
2012/06/24 11:07:03
This should by a private method called "DeferHandl
|
| + ASSERT(last_non_persistent_block_); |
| + last_non_persistent_block_ = NULL; |
| + last_non_persistent_handle_ = NULL; |
| + } |
| + |
| private: |
| void ResetAfterArchive() { |
| blocks_.Initialize(0); |
| @@ -479,6 +506,9 @@ class HandleScopeImplementer { |
| int call_depth_; |
| // This is only used for threading support. |
| v8::ImplementationUtilities::HandleScopeData handle_scope_data_; |
| + Object** last_non_persistent_block_; |
| + Object** last_non_persistent_handle_; |
| + PersistentExtensions* persistent_extensions_head_; |
| void IterateThis(ObjectVisitor* v); |
| char* RestoreThreadHelper(char* from); |