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

Side by Side Diff: src/spaces.h

Issue 398333002: Concurrent/parallel precise sweeping. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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/mark-compact.cc ('k') | src/spaces.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_SPACES_H_ 5 #ifndef V8_SPACES_H_
6 #define V8_SPACES_H_ 6 #define V8_SPACES_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/base/atomicops.h" 9 #include "src/base/atomicops.h"
10 #include "src/base/platform/mutex.h" 10 #include "src/base/platform/mutex.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 // are set to the value in "flags", the rest retain the current value 443 // are set to the value in "flags", the rest retain the current value
444 // in flags_. 444 // in flags_.
445 void SetFlags(intptr_t flags, intptr_t mask) { 445 void SetFlags(intptr_t flags, intptr_t mask) {
446 flags_ = (flags_ & ~mask) | (flags & mask); 446 flags_ = (flags_ & ~mask) | (flags & mask);
447 } 447 }
448 448
449 // Return all current flags. 449 // Return all current flags.
450 intptr_t GetFlags() { return flags_; } 450 intptr_t GetFlags() { return flags_; }
451 451
452 452
453 // PARALLEL_SWEEPING_DONE - The page state when sweeping is complete or 453 // SWEEPING_DONE - The page state when sweeping is complete or sweeping must
454 // sweeping must not be performed on that page. 454 // not be performed on that page.
455 // PARALLEL_SWEEPING_FINALIZE - A sweeper thread is done sweeping this 455 // SWEEPING_FINALIZE - A sweeper thread is done sweeping this page and will
456 // page and will not touch the page memory anymore. 456 // not touch the page memory anymore.
457 // PARALLEL_SWEEPING_IN_PROGRESS - This page is currently swept by a 457 // SWEEPING_IN_PROGRESS - This page is currently swept by a sweeper thread.
458 // sweeper thread. 458 // SWEEPING_PENDING - This page is ready for parallel sweeping.
459 // PARALLEL_SWEEPING_PENDING - This page is ready for parallel sweeping.
460 enum ParallelSweepingState { 459 enum ParallelSweepingState {
461 PARALLEL_SWEEPING_DONE, 460 SWEEPING_DONE,
462 PARALLEL_SWEEPING_FINALIZE, 461 SWEEPING_FINALIZE,
463 PARALLEL_SWEEPING_IN_PROGRESS, 462 SWEEPING_IN_PROGRESS,
464 PARALLEL_SWEEPING_PENDING 463 SWEEPING_PENDING
465 }; 464 };
466 465
467 ParallelSweepingState parallel_sweeping() { 466 ParallelSweepingState parallel_sweeping() {
468 return static_cast<ParallelSweepingState>( 467 return static_cast<ParallelSweepingState>(
469 base::Acquire_Load(&parallel_sweeping_)); 468 base::Acquire_Load(&parallel_sweeping_));
470 } 469 }
471 470
472 void set_parallel_sweeping(ParallelSweepingState state) { 471 void set_parallel_sweeping(ParallelSweepingState state) {
473 base::Release_Store(&parallel_sweeping_, state); 472 base::Release_Store(&parallel_sweeping_, state);
474 } 473 }
475 474
476 bool TryParallelSweeping() { 475 bool TryParallelSweeping() {
477 return base::Acquire_CompareAndSwap( 476 return base::Acquire_CompareAndSwap(
478 &parallel_sweeping_, PARALLEL_SWEEPING_PENDING, 477 &parallel_sweeping_, SWEEPING_PENDING, SWEEPING_IN_PROGRESS) ==
479 PARALLEL_SWEEPING_IN_PROGRESS) == PARALLEL_SWEEPING_PENDING; 478 SWEEPING_PENDING;
480 } 479 }
481 480
482 // Manage live byte count (count of bytes known to be live, 481 // Manage live byte count (count of bytes known to be live,
483 // because they are marked black). 482 // because they are marked black).
484 void ResetLiveBytes() { 483 void ResetLiveBytes() {
485 if (FLAG_gc_verbose) { 484 if (FLAG_gc_verbose) {
486 PrintF("ResetLiveBytes:%p:%x->0\n", 485 PrintF("ResetLiveBytes:%p:%x->0\n",
487 static_cast<void*>(this), live_byte_count_); 486 static_cast<void*>(this), live_byte_count_);
488 } 487 }
489 live_byte_count_ = 0; 488 live_byte_count_ = 0;
(...skipping 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 1909
1911 // Reports statistics for the space 1910 // Reports statistics for the space
1912 void ReportStatistics(); 1911 void ReportStatistics();
1913 1912
1914 // Report code object related statistics 1913 // Report code object related statistics
1915 void CollectCodeStatistics(); 1914 void CollectCodeStatistics();
1916 static void ReportCodeStatistics(Isolate* isolate); 1915 static void ReportCodeStatistics(Isolate* isolate);
1917 static void ResetCodeStatistics(Isolate* isolate); 1916 static void ResetCodeStatistics(Isolate* isolate);
1918 #endif 1917 #endif
1919 1918
1920 bool is_iterable() { return is_iterable_; } 1919 bool swept_precisely() { return swept_precisely_; }
1921 void set_is_iterable(bool b) { is_iterable_ = b; } 1920 void set_swept_precisely(bool b) { swept_precisely_ = b; }
1922 1921
1923 // Evacuation candidates are swept by evacuator. Needs to return a valid 1922 // Evacuation candidates are swept by evacuator. Needs to return a valid
1924 // result before _and_ after evacuation has finished. 1923 // result before _and_ after evacuation has finished.
1925 static bool ShouldBeSweptBySweeperThreads(Page* p) { 1924 static bool ShouldBeSweptBySweeperThreads(Page* p) {
1926 return !p->IsEvacuationCandidate() && 1925 return !p->IsEvacuationCandidate() &&
1927 !p->IsFlagSet(Page::RESCAN_ON_EVACUATION) && 1926 !p->IsFlagSet(Page::RESCAN_ON_EVACUATION) &&
1928 !p->WasSweptPrecisely(); 1927 !p->WasSweptPrecisely();
1929 } 1928 }
1930 1929
1931 void IncrementUnsweptFreeBytes(intptr_t by) { 1930 void IncrementUnsweptFreeBytes(intptr_t by) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1995 // The dummy page that anchors the double linked list of pages. 1994 // The dummy page that anchors the double linked list of pages.
1996 Page anchor_; 1995 Page anchor_;
1997 1996
1998 // The space's free list. 1997 // The space's free list.
1999 FreeList free_list_; 1998 FreeList free_list_;
2000 1999
2001 // Normal allocation information. 2000 // Normal allocation information.
2002 AllocationInfo allocation_info_; 2001 AllocationInfo allocation_info_;
2003 2002
2004 // This space was swept precisely, hence it is iterable. 2003 // This space was swept precisely, hence it is iterable.
2005 bool is_iterable_; 2004 bool swept_precisely_;
2006 2005
2007 // The number of free bytes which could be reclaimed by advancing the 2006 // The number of free bytes which could be reclaimed by advancing the
2008 // concurrent sweeper threads. This is only an estimation because concurrent 2007 // concurrent sweeper threads. This is only an estimation because concurrent
2009 // sweeping is done conservatively. 2008 // sweeping is done conservatively.
2010 intptr_t unswept_free_bytes_; 2009 intptr_t unswept_free_bytes_;
2011 2010
2012 // The sweeper threads iterate over the list of pointer and data space pages 2011 // The sweeper threads iterate over the list of pointer and data space pages
2013 // and sweep these pages concurrently. They will stop sweeping after the 2012 // and sweep these pages concurrently. They will stop sweeping after the
2014 // end_of_unswept_pages_ page. 2013 // end_of_unswept_pages_ page.
2015 Page* end_of_unswept_pages_; 2014 Page* end_of_unswept_pages_;
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 } 3025 }
3027 // Must be small, since an iteration is used for lookup. 3026 // Must be small, since an iteration is used for lookup.
3028 static const int kMaxComments = 64; 3027 static const int kMaxComments = 64;
3029 }; 3028 };
3030 #endif 3029 #endif
3031 3030
3032 3031
3033 } } // namespace v8::internal 3032 } } // namespace v8::internal
3034 3033
3035 #endif // V8_SPACES_H_ 3034 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698