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

Unified Diff: src/api.cc

Issue 10778036: The deferred handes list belongs to the Isolate and not to the (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review. Created 8 years, 5 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
« no previous file with comments | « src/api.h ('k') | src/handles.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 8218ad43c3a6c7dcfeb8b448a0d4b15aaaf0ccf1..e1d57e3cb2e0397dae0854cbf4ddbbe61f03acd5 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6422,12 +6422,6 @@ void HandleScopeImplementer::IterateThis(ObjectVisitor* v) {
Object** start = reinterpret_cast<Object**>(&saved_contexts_.first());
v->VisitPointers(start, start + saved_contexts_.length());
}
-
- for (DeferredHandles* deferred = deferred_handles_head_;
- deferred != NULL;
- deferred = deferred->next_) {
- deferred->Iterate(v);
- }
}
@@ -6448,8 +6442,8 @@ char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
DeferredHandles* HandleScopeImplementer::Detach(Object** prev_limit) {
- DeferredHandles* deferred = new DeferredHandles(
- deferred_handles_head_, isolate()->handle_scope_data()->next, this);
+ DeferredHandles* deferred =
+ new DeferredHandles(isolate()->handle_scope_data()->next, isolate());
while (!blocks_.is_empty()) {
Object** block_start = blocks_.last();
@@ -6470,41 +6464,12 @@ DeferredHandles* HandleScopeImplementer::Detach(Object** prev_limit) {
ASSERT(prev_limit == NULL || !blocks_.is_empty());
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) {
-#ifdef DEBUG
- DeferredHandles* deferred_iterator = deferred;
- while (deferred_iterator->previous_ != NULL) {
- deferred_iterator = deferred_iterator->previous_;
- }
- ASSERT(deferred_handles_head_ == deferred_iterator);
-#endif
- 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;
@@ -6512,7 +6477,14 @@ void HandleScopeImplementer::BeginDeferredScope() {
DeferredHandles::~DeferredHandles() {
- impl_->DestroyDeferredHandles(this);
+ isolate_->UnlinkDeferredHandles(this);
+
+ for (int i = 0; i < blocks_.length(); i++) {
+#ifdef DEBUG
+ HandleScope::ZapRange(blocks_[i], &blocks_[i][kHandleBlockSize]);
+#endif
+ isolate_->handle_scope_implementer()->ReturnBlock(blocks_[i]);
+ }
}
« no previous file with comments | « src/api.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698