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

Unified Diff: src/api.cc

Issue 10696125: Fix bug in compilation-handlescope. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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.cc » ('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 376b29616b8b59fa02d391e153c680ed618ed062..4b1a3a1618228faa480cb0cd686042e359e85472 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -6457,6 +6457,12 @@ DeferredHandles* HandleScopeImplementer::Detach(Object** prev_limit) {
blocks_.RemoveLast();
}
+ // deferred->blocks_ now contains the blocks installed on the
+ // HandleScope stack since BeginDeferredScope was called, but in
+ // reverse order.
+
+ 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);
@@ -6466,6 +6472,13 @@ DeferredHandles* HandleScopeImplementer::Detach(Object** prev_limit) {
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_;
}
@@ -6500,14 +6513,14 @@ DeferredHandles::~DeferredHandles() {
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((first_block_limit_ >= blocks_.first()) &&
+ (first_block_limit_ < &(blocks_.first())[kHandleBlockSize]));
- ASSERT((last_block_limit_ >= blocks_.last()) &&
- (last_block_limit_ < &(blocks_.last())[kHandleBlockSize]));
+ v->VisitPointers(blocks_.first(), first_block_limit_);
- v->VisitPointers(blocks_.last(), last_block_limit_);
+ for (int i = 1; i < blocks_.length(); i++) {
+ v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
+ }
}
« no previous file with comments | « src/api.h ('k') | src/handles.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698