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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/api.h ('k') | src/handles.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 6439 matching lines...) Expand 10 before | Expand all | Expand 10 after
6450 Object** block_limit = &block_start[kHandleBlockSize]; 6450 Object** block_limit = &block_start[kHandleBlockSize];
6451 // We should not need to check for NoHandleAllocation here. Assert 6451 // We should not need to check for NoHandleAllocation here. Assert
6452 // this. 6452 // this.
6453 ASSERT(prev_limit == block_limit || 6453 ASSERT(prev_limit == block_limit ||
6454 !(block_start <= prev_limit && prev_limit <= block_limit)); 6454 !(block_start <= prev_limit && prev_limit <= block_limit));
6455 if (prev_limit == block_limit) break; 6455 if (prev_limit == block_limit) break;
6456 deferred->blocks_.Add(blocks_.last()); 6456 deferred->blocks_.Add(blocks_.last());
6457 blocks_.RemoveLast(); 6457 blocks_.RemoveLast();
6458 } 6458 }
6459 6459
6460 // deferred->blocks_ now contains the blocks installed on the
6461 // HandleScope stack since BeginDeferredScope was called, but in
6462 // reverse order.
6463
6464 ASSERT(prev_limit == NULL || !blocks_.is_empty());
6465
6460 ASSERT(!blocks_.is_empty() && prev_limit != NULL); 6466 ASSERT(!blocks_.is_empty() && prev_limit != NULL);
6461 deferred_handles_head_ = deferred; 6467 deferred_handles_head_ = deferred;
6462 ASSERT(last_handle_before_deferred_block_ != NULL); 6468 ASSERT(last_handle_before_deferred_block_ != NULL);
6463 last_handle_before_deferred_block_ = NULL; 6469 last_handle_before_deferred_block_ = NULL;
6464 return deferred; 6470 return deferred;
6465 } 6471 }
6466 6472
6467 6473
6468 void HandleScopeImplementer::DestroyDeferredHandles(DeferredHandles* deferred) { 6474 void HandleScopeImplementer::DestroyDeferredHandles(DeferredHandles* deferred) {
6475 #ifdef DEBUG
6476 DeferredHandles* deferred_iterator = deferred;
6477 while (deferred_iterator->previous_ != NULL) {
6478 deferred_iterator = deferred_iterator->previous_;
6479 }
6480 ASSERT(deferred_handles_head_ == deferred_iterator);
6481 #endif
6469 if (deferred_handles_head_ == deferred) { 6482 if (deferred_handles_head_ == deferred) {
6470 deferred_handles_head_ = deferred_handles_head_->next_; 6483 deferred_handles_head_ = deferred_handles_head_->next_;
6471 } 6484 }
6472 if (deferred->next_ != NULL) { 6485 if (deferred->next_ != NULL) {
6473 deferred->next_->previous_ = deferred->previous_; 6486 deferred->next_->previous_ = deferred->previous_;
6474 } 6487 }
6475 if (deferred->previous_ != NULL) { 6488 if (deferred->previous_ != NULL) {
6476 deferred->previous_->next_ = deferred->next_; 6489 deferred->previous_->next_ = deferred->next_;
6477 } 6490 }
6478 for (int i = 0; i < deferred->blocks_.length(); i++) { 6491 for (int i = 0; i < deferred->blocks_.length(); i++) {
(...skipping 14 matching lines...) Expand all
6493 6506
6494 6507
6495 DeferredHandles::~DeferredHandles() { 6508 DeferredHandles::~DeferredHandles() {
6496 impl_->DestroyDeferredHandles(this); 6509 impl_->DestroyDeferredHandles(this);
6497 } 6510 }
6498 6511
6499 6512
6500 void DeferredHandles::Iterate(ObjectVisitor* v) { 6513 void DeferredHandles::Iterate(ObjectVisitor* v) {
6501 ASSERT(!blocks_.is_empty()); 6514 ASSERT(!blocks_.is_empty());
6502 6515
6503 for (int i = 0; i < (blocks_.length() - 1); i++) { 6516 ASSERT((first_block_limit_ >= blocks_.first()) &&
6517 (first_block_limit_ < &(blocks_.first())[kHandleBlockSize]));
6518
6519 v->VisitPointers(blocks_.first(), first_block_limit_);
6520
6521 for (int i = 1; i < blocks_.length(); i++) {
6504 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6522 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6505 } 6523 }
6506
6507 ASSERT((last_block_limit_ >= blocks_.last()) &&
6508 (last_block_limit_ < &(blocks_.last())[kHandleBlockSize]));
6509
6510 v->VisitPointers(blocks_.last(), last_block_limit_);
6511 } 6524 }
6512 6525
6513 6526
6514 } } // namespace v8::internal 6527 } } // namespace v8::internal
OLDNEW
« 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