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

Side by Side Diff: src/mark-compact.cc

Issue 138903009: Enable concurrent sweeping. Added some extra debugging checks for concurrent sweeping. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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/flag-definitions.h ('k') | src/spaces.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 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 MarkBit mark_bit = Marking::MarkBitFrom(obj); 563 MarkBit mark_bit = Marking::MarkBitFrom(obj);
564 mark_bit.Clear(); 564 mark_bit.Clear();
565 mark_bit.Next().Clear(); 565 mark_bit.Next().Clear();
566 Page::FromAddress(obj->address())->ResetProgressBar(); 566 Page::FromAddress(obj->address())->ResetProgressBar();
567 Page::FromAddress(obj->address())->ResetLiveBytes(); 567 Page::FromAddress(obj->address())->ResetLiveBytes();
568 } 568 }
569 } 569 }
570 570
571 571
572 void MarkCompactCollector::StartSweeperThreads() { 572 void MarkCompactCollector::StartSweeperThreads() {
573 // TODO(hpayer): This check is just used for debugging purpose and
574 // should be removed or turned into an assert after investigating the
575 // crash in concurrent sweeping.
576 CHECK(free_list_old_pointer_space_.get()->IsEmpty());
577 CHECK(free_list_old_data_space_.get()->IsEmpty());
573 sweeping_pending_ = true; 578 sweeping_pending_ = true;
574 for (int i = 0; i < isolate()->num_sweeper_threads(); i++) { 579 for (int i = 0; i < isolate()->num_sweeper_threads(); i++) {
575 isolate()->sweeper_threads()[i]->StartSweeping(); 580 isolate()->sweeper_threads()[i]->StartSweeping();
576 } 581 }
577 } 582 }
578 583
579 584
580 void MarkCompactCollector::WaitUntilSweepingCompleted() { 585 void MarkCompactCollector::WaitUntilSweepingCompleted() {
581 ASSERT(sweeping_pending_ == true); 586 ASSERT(sweeping_pending_ == true);
582 for (int i = 0; i < isolate()->num_sweeper_threads(); i++) { 587 for (int i = 0; i < isolate()->num_sweeper_threads(); i++) {
(...skipping 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after
3061 *cell = 0; 3066 *cell = 0;
3062 } 3067 }
3063 p->ResetLiveBytes(); 3068 p->ResetLiveBytes();
3064 } 3069 }
3065 3070
3066 3071
3067 void MarkCompactCollector::EvacuatePages() { 3072 void MarkCompactCollector::EvacuatePages() {
3068 int npages = evacuation_candidates_.length(); 3073 int npages = evacuation_candidates_.length();
3069 for (int i = 0; i < npages; i++) { 3074 for (int i = 0; i < npages; i++) {
3070 Page* p = evacuation_candidates_[i]; 3075 Page* p = evacuation_candidates_[i];
3071 ASSERT(p->IsEvacuationCandidate() || 3076 // TODO(hpayer): This check is just used for debugging purpose and
3072 p->IsFlagSet(Page::RESCAN_ON_EVACUATION)); 3077 // should be removed or turned into an assert after investigating the
3078 // crash in concurrent sweeping.
3079 CHECK(p->IsEvacuationCandidate() ||
3080 p->IsFlagSet(Page::RESCAN_ON_EVACUATION));
3081 CHECK_EQ(p->parallel_sweeping(), 0);
3073 if (p->IsEvacuationCandidate()) { 3082 if (p->IsEvacuationCandidate()) {
3074 // During compaction we might have to request a new page. 3083 // During compaction we might have to request a new page.
3075 // Check that space still have room for that. 3084 // Check that space still have room for that.
3076 if (static_cast<PagedSpace*>(p->owner())->CanExpand()) { 3085 if (static_cast<PagedSpace*>(p->owner())->CanExpand()) {
3077 EvacuateLiveObjectsFromPage(p); 3086 EvacuateLiveObjectsFromPage(p);
3078 } else { 3087 } else {
3079 // Without room for expansion evacuation is not guaranteed to succeed. 3088 // Without room for expansion evacuation is not guaranteed to succeed.
3080 // Pessimistically abandon unevacuated pages. 3089 // Pessimistically abandon unevacuated pages.
3081 for (int j = i; j < npages; j++) { 3090 for (int j = i; j < npages; j++) {
3082 Page* page = evacuation_candidates_[j]; 3091 Page* page = evacuation_candidates_[j];
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
3893 // spaces have been put on the free list and the smaller ones have been 3902 // spaces have been put on the free list and the smaller ones have been
3894 // ignored and left untouched. A free space is always either ignored or put 3903 // ignored and left untouched. A free space is always either ignored or put
3895 // on the free list, never split up into two parts. This is important 3904 // on the free list, never split up into two parts. This is important
3896 // because it means that any FreeSpace maps left actually describe a region of 3905 // because it means that any FreeSpace maps left actually describe a region of
3897 // memory that can be ignored when scanning. Dead objects other than free 3906 // memory that can be ignored when scanning. Dead objects other than free
3898 // spaces will not contain the free space map. 3907 // spaces will not contain the free space map.
3899 template<MarkCompactCollector::SweepingParallelism mode> 3908 template<MarkCompactCollector::SweepingParallelism mode>
3900 intptr_t MarkCompactCollector::SweepConservatively(PagedSpace* space, 3909 intptr_t MarkCompactCollector::SweepConservatively(PagedSpace* space,
3901 FreeList* free_list, 3910 FreeList* free_list,
3902 Page* p) { 3911 Page* p) {
3903 ASSERT(!p->IsEvacuationCandidate() && !p->WasSwept()); 3912 // TODO(hpayer): This check is just used for debugging purpose and
3913 // should be removed or turned into an assert after investigating the
3914 // crash in concurrent sweeping.
3915 CHECK(!p->IsEvacuationCandidate() && !p->WasSwept());
3904 ASSERT((mode == MarkCompactCollector::SWEEP_IN_PARALLEL && 3916 ASSERT((mode == MarkCompactCollector::SWEEP_IN_PARALLEL &&
3905 free_list != NULL) || 3917 free_list != NULL) ||
3906 (mode == MarkCompactCollector::SWEEP_SEQUENTIALLY && 3918 (mode == MarkCompactCollector::SWEEP_SEQUENTIALLY &&
3907 free_list == NULL)); 3919 free_list == NULL));
3908 3920
3909 p->MarkSweptConservatively(); 3921 p->MarkSweptConservatively();
3910 3922
3911 intptr_t freed_bytes = 0; 3923 intptr_t freed_bytes = 0;
3912 size_t size = 0; 3924 size_t size = 0;
3913 3925
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
4384 while (buffer != NULL) { 4396 while (buffer != NULL) {
4385 SlotsBuffer* next_buffer = buffer->next(); 4397 SlotsBuffer* next_buffer = buffer->next();
4386 DeallocateBuffer(buffer); 4398 DeallocateBuffer(buffer);
4387 buffer = next_buffer; 4399 buffer = next_buffer;
4388 } 4400 }
4389 *buffer_address = NULL; 4401 *buffer_address = NULL;
4390 } 4402 }
4391 4403
4392 4404
4393 } } // namespace v8::internal 4405 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698