OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_HEAP_MARK_COMPACT_H_ | 5 #ifndef V8_HEAP_MARK_COMPACT_H_ |
6 #define V8_HEAP_MARK_COMPACT_H_ | 6 #define V8_HEAP_MARK_COMPACT_H_ |
7 | 7 |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
10 | 10 |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 // to a value larger than 0, then sweeping returns after a block of at least | 450 // to a value larger than 0, then sweeping returns after a block of at least |
451 // required_freed_bytes was freed. If required_freed_bytes was set to zero | 451 // required_freed_bytes was freed. If required_freed_bytes was set to zero |
452 // then the whole given space is swept. It returns the size of the maximum | 452 // then the whole given space is swept. It returns the size of the maximum |
453 // continuous freed memory chunk. | 453 // continuous freed memory chunk. |
454 int SweepInParallel(PagedSpace* space, int required_freed_bytes); | 454 int SweepInParallel(PagedSpace* space, int required_freed_bytes); |
455 | 455 |
456 // Sweeps a given page concurrently to the sweeper threads. It returns the | 456 // Sweeps a given page concurrently to the sweeper threads. It returns the |
457 // size of the maximum continuous freed memory chunk. | 457 // size of the maximum continuous freed memory chunk. |
458 int SweepInParallel(Page* page, PagedSpace* space); | 458 int SweepInParallel(Page* page, PagedSpace* space); |
459 | 459 |
| 460 // Ensures that sweeping is finished. |
| 461 // |
| 462 // Note: Can only be called safely from main thread. |
460 void EnsureSweepingCompleted(); | 463 void EnsureSweepingCompleted(); |
461 | 464 |
462 void SweepOrWaitUntilSweepingCompleted(Page* page); | 465 void SweepOrWaitUntilSweepingCompleted(Page* page); |
463 | 466 |
| 467 // Help out in sweeping the corresponding space and refill memory that has |
| 468 // been regained. |
| 469 // |
| 470 // Note: Thread-safe. |
| 471 void SweepAndRefill(CompactionSpace* space); |
| 472 |
464 // If sweeper threads are not active this method will return true. If | 473 // If sweeper threads are not active this method will return true. If |
465 // this is a latency issue we should be smarter here. Otherwise, it will | 474 // this is a latency issue we should be smarter here. Otherwise, it will |
466 // return true if the sweeper threads are done processing the pages. | 475 // return true if the sweeper threads are done processing the pages. |
467 bool IsSweepingCompleted(); | 476 bool IsSweepingCompleted(); |
468 | 477 |
469 // Checks if sweeping is in progress right now on any space. | 478 // Checks if sweeping is in progress right now on any space. |
470 bool sweeping_in_progress() { return sweeping_in_progress_; } | 479 bool sweeping_in_progress() { return sweeping_in_progress_; } |
471 | 480 |
472 void set_evacuation(bool evacuation) { evacuation_ = evacuation; } | 481 void set_evacuation(bool evacuation) { evacuation_ = evacuation; } |
473 | 482 |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 private: | 868 private: |
860 MarkCompactCollector* collector_; | 869 MarkCompactCollector* collector_; |
861 }; | 870 }; |
862 | 871 |
863 | 872 |
864 const char* AllocationSpaceName(AllocationSpace space); | 873 const char* AllocationSpaceName(AllocationSpace space); |
865 } // namespace internal | 874 } // namespace internal |
866 } // namespace v8 | 875 } // namespace v8 |
867 | 876 |
868 #endif // V8_HEAP_MARK_COMPACT_H_ | 877 #endif // V8_HEAP_MARK_COMPACT_H_ |
OLD | NEW |