Chromium Code Reviews| Index: src/api.h |
| diff --git a/src/api.h b/src/api.h |
| index 58e6a6e410380bf96e6eafb94dba5ff1a7ba5f38..ee22eee51243adf12e13e78da2a940891d1ab04d 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_block_before_compilation_(NULL), |
| + last_valid_handle_before_compilation_(NULL), |
| + hidden_extensions_head_(NULL) { } |
|
Erik Corry
2012/06/22 11:08:36
Instead of 'hidden' may I suggest 'persistent'. T
sanjoy
2012/06/22 20:08:10
Done.
|
| ~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 HiddenExtensions { |
| + List<Object**> blocks; |
| + Object** last_block_end; |
| + HiddenExtensions* previous; |
| + HiddenExtensions* next; |
| + }; |
| inline internal::Object** GetSpareOrNewBlock(); |
| inline void DeleteExtensions(internal::Object** prev_limit); |
| + // HideExtensions must be called _before_ the next field in |
| + // HandleScopeData is reverted. |
| + HiddenExtensions* HideExtensions(internal::Object** prev_limit); |
| + void DeleteHiddenExtensions(HiddenExtensions* extension); |
| + |
| 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 set_last_block_before_compilation() { |
| + // We only track one such special block. |
| + ASSERT(!last_block_before_compilation_); |
| + last_block_before_compilation_ = blocks_.last(); |
| + last_valid_handle_before_compilation_ = isolate_->handle_scope_data()->next; |
| + } |
| + |
| + void unset_last_block_before_compilation() { |
| + ASSERT(last_block_before_compilation_); |
| + last_block_before_compilation_ = NULL; |
| + last_valid_handle_before_compilation_ = NULL; |
| + } |
| + |
| private: |
| void ResetAfterArchive() { |
| blocks_.Initialize(0); |
| @@ -479,7 +506,11 @@ class HandleScopeImplementer { |
| int call_depth_; |
| // This is only used for threading support. |
| v8::ImplementationUtilities::HandleScopeData handle_scope_data_; |
| + Object** last_block_before_compilation_; |
| + Object** last_valid_handle_before_compilation_; |
| + HiddenExtensions* hidden_extensions_head_; |
| + template<bool HasCompilationBlock> |
| void IterateThis(ObjectVisitor* v); |
| char* RestoreThreadHelper(char* from); |
| char* ArchiveThreadHelper(char* to); |