| 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 ClassTable; |  | 
|  14 class FreeList; |  13 class FreeList; | 
|  15 class Heap; |  14 class Heap; | 
|  16 class HeapPage; |  15 class HeapPage; | 
|  17 class Isolate; |  16 class Isolate; | 
|  18 class PageSpace; |  17 class PageSpace; | 
|  19  |  18  | 
|  20 // 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 | 
|  21 // memory. |  20 // memory. | 
|  22 class GCSweeper { |  21 class GCSweeper { | 
|  23  public: |  22  public: | 
|  24   explicit GCSweeper(const ClassTable* class_table) |  23   GCSweeper() {} | 
|  25       : class_table_(class_table) {} |  | 
|  26   ~GCSweeper() {} |  24   ~GCSweeper() {} | 
|  27  |  25  | 
|  28   // 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 | 
|  29   // all the unmarked objects to the freelist. Whether the freelist is |  27   // all the unmarked objects to the freelist. Whether the freelist is | 
|  30   // pre-locked is indicated by the locked parameter. |  28   // pre-locked is indicated by the locked parameter. | 
|  31   // Returns true if the page is in use. Freelist is untouched if page is not |  29   // Returns true if the page is in use. Freelist is untouched if page is not | 
|  32   // in use. |  30   // in use. | 
|  33   bool SweepPage(HeapPage* page, FreeList* freelist, bool locked); |  31   bool SweepPage(HeapPage* page, FreeList* freelist, bool locked); | 
|  34  |  32  | 
|  35   // Returns the number of words from page->object_start() to the end of the |  33   // Returns the number of words from page->object_start() to the end of the | 
|  36   // last marked object. |  34   // last marked object. | 
|  37   intptr_t SweepLargePage(HeapPage* page); |  35   intptr_t SweepLargePage(HeapPage* page); | 
|  38  |  36  | 
|  39   // Sweep the regular sized data pages between first and last inclusive. |  37   // Sweep the regular sized data pages between first and last inclusive. | 
|  40   static void SweepConcurrent(Isolate* isolate, |  38   static void SweepConcurrent(Isolate* isolate, | 
|  41                               HeapPage* first, |  39                               HeapPage* first, | 
|  42                               HeapPage* last, |  40                               HeapPage* last, | 
|  43                               FreeList* freelist); |  41                               FreeList* freelist); | 
|  44  |  | 
|  45  private: |  | 
|  46   const ClassTable* class_table_; |  | 
|  47 }; |  42 }; | 
|  48  |  43  | 
|  49 }  // namespace dart |  44 }  // namespace dart | 
|  50  |  45  | 
|  51 #endif  // VM_GC_SWEEPER_H_ |  46 #endif  // VM_GC_SWEEPER_H_ | 
| OLD | NEW |