From d9d76b7a5c68100427eea5d4b52fe73b73ba4f08 Mon Sep 17 00:00:00 2001 From: "sanjoy@chromium.org" Date: Thu, 28 Jun 2012 12:34:51 +0000 Subject: [PATCH] Revert 11939 'Add a CompilationHandleScope' since it breaks array-sort.js in Win32 Release. BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10698031 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11943 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/api.cc | 95 +------------------------------------------------ src/api.h | 36 +------------------ src/compiler.cc | 14 ++------ src/compiler.h | 26 -------------- src/handles.cc | 41 --------------------- src/handles.h | 30 ---------------- src/hydrogen.cc | 1 - 7 files changed, 5 insertions(+), 238 deletions(-) diff --git a/src/api.cc b/src/api.cc index dda482ceef..0d88047aa2 100644 --- a/src/api.cc +++ b/src/api.cc @@ -6374,28 +6374,12 @@ char* HandleScopeImplementer::RestoreThread(char* storage) { void HandleScopeImplementer::IterateThis(ObjectVisitor* v) { -#ifdef DEBUG - bool found_block_before_deferred = false; -#endif // Iterate over all handles in the blocks except for the last. for (int i = blocks()->length() - 2; i >= 0; --i) { Object** block = blocks()->at(i); - if (last_handle_before_deferred_block_ != NULL && - (last_handle_before_deferred_block_ < &block[kHandleBlockSize]) && - (last_handle_before_deferred_block_ >= block)) { - v->VisitPointers(block, last_handle_before_deferred_block_); - ASSERT(!found_block_before_deferred); -#ifdef DEBUG - found_block_before_deferred = true; -#endif - } else { - v->VisitPointers(block, &block[kHandleBlockSize]); - } + v->VisitPointers(block, &block[kHandleBlockSize]); } - ASSERT(last_handle_before_deferred_block_ == NULL || - found_block_before_deferred); - // Iterate over live handles in the last block (if any). if (!blocks()->is_empty()) { v->VisitPointers(blocks()->last(), handle_scope_data_.next); @@ -6405,12 +6389,6 @@ void HandleScopeImplementer::IterateThis(ObjectVisitor* v) { Object** start = reinterpret_cast(&saved_contexts_.first()); v->VisitPointers(start, start + saved_contexts_.length()); } - - for (DeferredHandles* deferred = deferred_handles_head_; - deferred != NULL; - deferred = deferred->next_) { - deferred->Iterate(v); - } } @@ -6429,75 +6407,4 @@ char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { return storage + ArchiveSpacePerThread(); } - -DeferredHandles* HandleScopeImplementer::Detach(Object** prev_limit) { - DeferredHandles* deferred = new DeferredHandles( - deferred_handles_head_, isolate()->handle_scope_data()->next, this); - - while (!blocks_.is_empty()) { - Object** block_start = blocks_.last(); - Object** block_limit = &block_start[kHandleBlockSize]; - // We should not need to check for NoHandleAllocation here. Assert - // this. - ASSERT(prev_limit == block_limit || - !(block_start <= prev_limit && prev_limit <= block_limit)); - if (prev_limit == block_limit) break; - deferred->blocks_.Add(blocks_.last()); - blocks_.RemoveLast(); - } - - ASSERT(!blocks_.is_empty() && prev_limit != NULL); - deferred_handles_head_ = deferred; - ASSERT(last_handle_before_deferred_block_ != NULL); - last_handle_before_deferred_block_ = NULL; - return deferred; -} - - -void HandleScopeImplementer::DestroyDeferredHandles(DeferredHandles* deferred) { - if (deferred_handles_head_ == deferred) { - deferred_handles_head_ = deferred_handles_head_->next_; - } - if (deferred->next_ != NULL) { - deferred->next_->previous_ = deferred->previous_; - } - if (deferred->previous_ != NULL) { - deferred->previous_->next_ = deferred->next_; - } - for (int i = 0; i < deferred->blocks_.length(); i++) { -#ifdef DEBUG - HandleScope::ZapRange(deferred->blocks_[i], - &deferred->blocks_[i][kHandleBlockSize]); -#endif - if (spare_ != NULL) DeleteArray(spare_); - spare_ = deferred->blocks_[i]; - } -} - - -void HandleScopeImplementer::BeginDeferredScope() { - ASSERT(last_handle_before_deferred_block_ == NULL); - last_handle_before_deferred_block_ = isolate()->handle_scope_data()->next; -} - - -DeferredHandles::~DeferredHandles() { - impl_->DestroyDeferredHandles(this); -} - - -void DeferredHandles::Iterate(ObjectVisitor* v) { - ASSERT(!blocks_.is_empty()); - - for (int i = 0; i < (blocks_.length() - 1); i++) { - v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); - } - - ASSERT((last_block_limit_ >= blocks_.last()) && - (last_block_limit_ < &(blocks_.last())[kHandleBlockSize])); - - v->VisitPointers(blocks_.last(), last_block_limit_); -} - - } } // namespace v8::internal diff --git a/src/api.h b/src/api.h index cd6c3da078..58e6a6e410 100644 --- a/src/api.h +++ b/src/api.h @@ -392,28 +392,6 @@ 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 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 @@ -431,9 +409,7 @@ class HandleScopeImplementer { entered_contexts_(0), saved_contexts_(0), spare_(NULL), - call_depth_(0), - last_handle_before_deferred_block_(NULL), - deferred_handles_head_(NULL) { } + call_depth_(0) { } ~HandleScopeImplementer() { DeleteArray(spare_); @@ -469,7 +445,6 @@ class HandleScopeImplementer { inline bool HasSavedContexts(); inline List* blocks() { return &blocks_; } - Isolate* isolate() const { return isolate_; } private: void ResetAfterArchive() { @@ -494,10 +469,6 @@ class HandleScopeImplementer { ASSERT(call_depth_ == 0); } - void BeginDeferredScope(); - DeferredHandles* Detach(Object** prev_limit); - void DestroyDeferredHandles(DeferredHandles* handles); - Isolate* isolate_; List blocks_; // Used as a stack to keep track of entered contexts. @@ -506,8 +477,6 @@ class HandleScopeImplementer { List 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_; @@ -515,9 +484,6 @@ class HandleScopeImplementer { char* RestoreThreadHelper(char* from); char* ArchiveThreadHelper(char* to); - friend class DeferredHandles; - friend class DeferredHandleScope; - DISALLOW_COPY_AND_ASSIGN(HandleScopeImplementer); }; diff --git a/src/compiler.cc b/src/compiler.cc index 06a056a917..d35532f045 100644 --- a/src/compiler.cc +++ b/src/compiler.cc @@ -61,8 +61,7 @@ CompilationInfo::CompilationInfo(Handle