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

Side by Side Diff: src/spaces.cc

Issue 113262: Revert r1900, r1897 and r1895 which are all gc changes. The changes... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 7 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/spaces.h ('k') | src/spaces-inl.h » ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 Page* p = Page::FromAllocationTop(cur_addr_); 104 Page* p = Page::FromAllocationTop(cur_addr_);
105 ASSERT(p == Page::FromAllocationTop(cur_limit_)); 105 ASSERT(p == Page::FromAllocationTop(cur_limit_));
106 ASSERT(p->Offset(cur_addr_) <= p->Offset(cur_limit_)); 106 ASSERT(p->Offset(cur_addr_) <= p->Offset(cur_limit_));
107 } 107 }
108 #endif 108 #endif
109 109
110 110
111 // ----------------------------------------------------------------------------- 111 // -----------------------------------------------------------------------------
112 // PageIterator 112 // PageIterator
113 113
114 PageIterator::PageIterator(PagedSpace* space, Mode mode) : space_(space) { 114 PageIterator::PageIterator(PagedSpace* space, Mode mode) {
115 prev_page_ = NULL; 115 cur_page_ = space->first_page_;
116 switch (mode) { 116 switch (mode) {
117 case PAGES_IN_USE: 117 case PAGES_IN_USE:
118 stop_page_ = space->AllocationTopPage(); 118 stop_page_ = space->AllocationTopPage()->next_page();
119 break; 119 break;
120 case PAGES_USED_BY_MC: 120 case PAGES_USED_BY_MC:
121 stop_page_ = space->MCRelocationTopPage(); 121 stop_page_ = space->MCRelocationTopPage()->next_page();
122 break; 122 break;
123 case ALL_PAGES: 123 case ALL_PAGES:
124 stop_page_ = space->last_page_; 124 stop_page_ = Page::FromAddress(NULL);
125 break; 125 break;
126 default: 126 default:
127 UNREACHABLE(); 127 UNREACHABLE();
128 } 128 }
129 } 129 }
130 130
131 131
132 // ----------------------------------------------------------------------------- 132 // -----------------------------------------------------------------------------
133 // Page 133 // Page
134 134
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 if (!first_page_->is_valid()) return false; 489 if (!first_page_->is_valid()) return false;
490 } 490 }
491 491
492 // We are sure that the first page is valid and that we have at least one 492 // We are sure that the first page is valid and that we have at least one
493 // page. 493 // page.
494 ASSERT(first_page_->is_valid()); 494 ASSERT(first_page_->is_valid());
495 ASSERT(num_pages > 0); 495 ASSERT(num_pages > 0);
496 accounting_stats_.ExpandSpace(num_pages * Page::kObjectAreaSize); 496 accounting_stats_.ExpandSpace(num_pages * Page::kObjectAreaSize);
497 ASSERT(Capacity() <= max_capacity_); 497 ASSERT(Capacity() <= max_capacity_);
498 498
499 // Sequentially initialize remembered sets in the newly allocated
500 // pages and cache the current last page in the space.
501 for (Page* p = first_page_; p->is_valid(); p = p->next_page()) { 499 for (Page* p = first_page_; p->is_valid(); p = p->next_page()) {
502 p->ClearRSet(); 500 p->ClearRSet();
503 last_page_ = p;
504 } 501 }
505 502
506 // Use first_page_ for allocation. 503 // Use first_page_ for allocation.
507 SetAllocationInfo(&allocation_info_, first_page_); 504 SetAllocationInfo(&allocation_info_, first_page_);
508 505
509 return true; 506 return true;
510 } 507 }
511 508
512 509
513 bool PagedSpace::HasBeenSetup() { 510 bool PagedSpace::HasBeenSetup() {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 669
673 int desired_pages = Min(available_pages, MemoryAllocator::kPagesPerChunk); 670 int desired_pages = Min(available_pages, MemoryAllocator::kPagesPerChunk);
674 Page* p = MemoryAllocator::AllocatePages(desired_pages, &desired_pages, this); 671 Page* p = MemoryAllocator::AllocatePages(desired_pages, &desired_pages, this);
675 if (!p->is_valid()) return false; 672 if (!p->is_valid()) return false;
676 673
677 accounting_stats_.ExpandSpace(desired_pages * Page::kObjectAreaSize); 674 accounting_stats_.ExpandSpace(desired_pages * Page::kObjectAreaSize);
678 ASSERT(Capacity() <= max_capacity_); 675 ASSERT(Capacity() <= max_capacity_);
679 676
680 MemoryAllocator::SetNextPage(last_page, p); 677 MemoryAllocator::SetNextPage(last_page, p);
681 678
682 // Sequentially clear remembered set of new pages and and cache the 679 // Clear remembered set of new pages.
683 // new last page in the space.
684 while (p->is_valid()) { 680 while (p->is_valid()) {
685 p->ClearRSet(); 681 p->ClearRSet();
686 last_page_ = p;
687 p = p->next_page(); 682 p = p->next_page();
688 } 683 }
689 684
690 return true; 685 return true;
691 } 686 }
692 687
693 688
694 #ifdef DEBUG 689 #ifdef DEBUG
695 int PagedSpace::CountTotalPages() { 690 int PagedSpace::CountTotalPages() {
696 int count = 0; 691 int count = 0;
(...skipping 24 matching lines...) Expand all
721 last_page_to_keep = last_page_to_keep->next_page(); 716 last_page_to_keep = last_page_to_keep->next_page();
722 } 717 }
723 free_pages++; 718 free_pages++;
724 current_page = current_page->next_page(); 719 current_page = current_page->next_page();
725 } 720 }
726 721
727 // Free pages after last_page_to_keep, and adjust the next_page link. 722 // Free pages after last_page_to_keep, and adjust the next_page link.
728 Page* p = MemoryAllocator::FreePages(last_page_to_keep->next_page()); 723 Page* p = MemoryAllocator::FreePages(last_page_to_keep->next_page());
729 MemoryAllocator::SetNextPage(last_page_to_keep, p); 724 MemoryAllocator::SetNextPage(last_page_to_keep, p);
730 725
731 // Since pages are only freed in whole chunks, we may have kept more 726 // Since pages are only freed in whole chunks, we may have kept more than
732 // than pages_to_keep. Count the extra pages and cache the new last 727 // pages_to_keep.
733 // page in the space.
734 while (p->is_valid()) { 728 while (p->is_valid()) {
735 pages_to_keep++; 729 pages_to_keep++;
736 last_page_ = p;
737 p = p->next_page(); 730 p = p->next_page();
738 } 731 }
739 732
740 // The difference between free_pages and pages_to_keep is the number of 733 // The difference between free_pages and pages_to_keep is the number of
741 // pages actually freed. 734 // pages actually freed.
742 ASSERT(pages_to_keep <= free_pages); 735 ASSERT(pages_to_keep <= free_pages);
743 int bytes_freed = (free_pages - pages_to_keep) * Page::kObjectAreaSize; 736 int bytes_freed = (free_pages - pages_to_keep) * Page::kObjectAreaSize;
744 accounting_stats_.ShrinkSpace(bytes_freed); 737 accounting_stats_.ShrinkSpace(bytes_freed);
745 738
746 ASSERT(Capacity() == CountTotalPages() * Page::kObjectAreaSize); 739 ASSERT(Capacity() == CountTotalPages() * Page::kObjectAreaSize);
(...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after
2597 reinterpret_cast<Object**>(object->address() 2590 reinterpret_cast<Object**>(object->address()
2598 + Page::kObjectAreaSize), 2591 + Page::kObjectAreaSize),
2599 allocation_top); 2592 allocation_top);
2600 PrintF("\n"); 2593 PrintF("\n");
2601 } 2594 }
2602 } 2595 }
2603 } 2596 }
2604 #endif // DEBUG 2597 #endif // DEBUG
2605 2598
2606 } } // namespace v8::internal 2599 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/spaces.h ('k') | src/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698