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

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 ASSERT(prev_limit == NULL || !blocks_.is_empty());
6461
6460 ASSERT(!blocks_.is_empty() && prev_limit != NULL); 6462 ASSERT(!blocks_.is_empty() && prev_limit != NULL);
6461 deferred_handles_head_ = deferred; 6463 deferred_handles_head_ = deferred;
6462 ASSERT(last_handle_before_deferred_block_ != NULL); 6464 ASSERT(last_handle_before_deferred_block_ != NULL);
6463 last_handle_before_deferred_block_ = NULL; 6465 last_handle_before_deferred_block_ = NULL;
6464 return deferred; 6466 return deferred;
6465 } 6467 }
6466 6468
6467 6469
6468 void HandleScopeImplementer::DestroyDeferredHandles(DeferredHandles* deferred) { 6470 void HandleScopeImplementer::DestroyDeferredHandles(DeferredHandles* deferred) {
6471 #ifdef DEBUG
6472 DeferredHandles* deferred_iterator = deferred;
6473 while (deferred_iterator->previous_ != NULL)
6474 deferred_iterator = deferred_iterator->previous_;
Jakob Kummerow 2012/07/06 13:30:32 nit: {} please
sanjoy 2012/07/06 13:56:57 Done.
6475 ASSERT(deferred_handles_head_ == deferred_iterator);
6476 #endif
6469 if (deferred_handles_head_ == deferred) { 6477 if (deferred_handles_head_ == deferred) {
6470 deferred_handles_head_ = deferred_handles_head_->next_; 6478 deferred_handles_head_ = deferred_handles_head_->next_;
6471 } 6479 }
6472 if (deferred->next_ != NULL) { 6480 if (deferred->next_ != NULL) {
6473 deferred->next_->previous_ = deferred->previous_; 6481 deferred->next_->previous_ = deferred->previous_;
6474 } 6482 }
6475 if (deferred->previous_ != NULL) { 6483 if (deferred->previous_ != NULL) {
6476 deferred->previous_->next_ = deferred->next_; 6484 deferred->previous_->next_ = deferred->next_;
6477 } 6485 }
6478 for (int i = 0; i < deferred->blocks_.length(); i++) { 6486 for (int i = 0; i < deferred->blocks_.length(); i++) {
(...skipping 14 matching lines...) Expand all
6493 6501
6494 6502
6495 DeferredHandles::~DeferredHandles() { 6503 DeferredHandles::~DeferredHandles() {
6496 impl_->DestroyDeferredHandles(this); 6504 impl_->DestroyDeferredHandles(this);
6497 } 6505 }
6498 6506
6499 6507
6500 void DeferredHandles::Iterate(ObjectVisitor* v) { 6508 void DeferredHandles::Iterate(ObjectVisitor* v) {
6501 ASSERT(!blocks_.is_empty()); 6509 ASSERT(!blocks_.is_empty());
6502 6510
6503 for (int i = 0; i < (blocks_.length() - 1); i++) { 6511 ASSERT((last_block_limit_ >= blocks_.first()) &&
Jakob Kummerow 2012/07/06 13:30:32 last_block_limit_ should probably be renamed to fi
sanjoy 2012/07/06 13:56:57 Done.
6512 (last_block_limit_ < &(blocks_.first())[kHandleBlockSize]));
6513
6514 v->VisitPointers(blocks_.first(), last_block_limit_);
6515
6516 for (int i = 1; i < (blocks_.length() - 1); i++) {
Jakob Kummerow 2012/07/06 13:30:32 This skips over the last block.
sanjoy 2012/07/06 13:56:57 Done.
6504 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]); 6517 v->VisitPointers(blocks_[i], &blocks_[i][kHandleBlockSize]);
6505 } 6518 }
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 } 6519 }
6512 6520
6513 6521
6514 } } // namespace v8::internal 6522 } } // 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