Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_GC_SWEEPER_H_ | 5 #ifndef VM_GC_SWEEPER_H_ |
| 6 #define VM_GC_SWEEPER_H_ | 6 #define VM_GC_SWEEPER_H_ |
| 7 | 7 |
| 8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 // Forward declarations. | 12 // Forward declarations. |
| 13 class FreeList; | 13 class FreeList; |
| 14 class Heap; | 14 class Heap; |
| 15 class HeapPage; | 15 class HeapPage; |
| 16 class Isolate; | |
| 17 class PageSpace; | |
| 16 | 18 |
| 17 // The class GCSweeper is used to visit the heap after marking to reclaim unused | 19 // The class GCSweeper is used to visit the heap after marking to reclaim unused |
| 18 // memory. | 20 // memory. |
| 19 class GCSweeper { | 21 class GCSweeper { |
| 20 public: | 22 public: |
| 21 explicit GCSweeper(Heap* heap) : heap_(heap) {} | 23 explicit GCSweeper(Heap* heap) : heap_(heap) {} |
| 22 ~GCSweeper() {} | 24 ~GCSweeper() {} |
| 23 | 25 |
| 24 // Sweep the memory area for the page while clearing the mark bits and adding | 26 // Sweep the memory area for the page while clearing the mark bits and adding |
| 25 // all the unmarked objects to the pre-locked freelist. | 27 // all the unmarked objects to the pre-locked freelist. |
| 26 // Returns true if the page is in use. | 28 // Returns true if the page is in use. |
| 27 bool SweepPage(HeapPage* page, FreeList* freelist); | 29 bool SweepPage(HeapPage* page, FreeList* freelist); |
| 28 | 30 |
| 29 // Returns the number of words from page->object_start() to the end of the | 31 // Returns the number of words from page->object_start() to the end of the |
| 30 // last marked object. | 32 // last marked object. |
| 31 intptr_t SweepLargePage(HeapPage* page); | 33 intptr_t SweepLargePage(HeapPage* page); |
| 32 | 34 |
| 35 static void SweepConcurrent(Isolate* isolate, | |
|
koda
2014/08/26 23:34:48
Comment on:
* whether 'last' is exclusive
* lockin
Ivan Posva
2014/08/27 01:00:21
Done.
| |
| 36 PageSpace* old_space, | |
| 37 HeapPage* first, | |
| 38 HeapPage* last, | |
| 39 FreeList* freelist); | |
| 40 | |
| 33 private: | 41 private: |
| 34 Heap* heap_; | 42 Heap* heap_; |
| 35 | 43 |
| 36 DISALLOW_IMPLICIT_CONSTRUCTORS(GCSweeper); | 44 DISALLOW_IMPLICIT_CONSTRUCTORS(GCSweeper); |
| 37 }; | 45 }; |
| 38 | 46 |
| 39 } // namespace dart | 47 } // namespace dart |
| 40 | 48 |
| 41 #endif // VM_GC_SWEEPER_H_ | 49 #endif // VM_GC_SWEEPER_H_ |
| OLD | NEW |