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 #include "vm/gc_sweeper.h" | 5 #include "vm/gc_sweeper.h" |
6 | 6 |
7 #include "vm/freelist.h" | 7 #include "vm/freelist.h" |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
10 #include "vm/pages.h" | 10 #include "vm/pages.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 } | 49 } |
50 } | 50 } |
51 current += obj_size; | 51 current += obj_size; |
52 } | 52 } |
53 ASSERT(current == end); | 53 ASSERT(current == end); |
54 | 54 |
55 return in_use; | 55 return in_use; |
56 } | 56 } |
57 | 57 |
58 | 58 |
59 bool GCSweeper::SweepLargePage(HeapPage* page) { | 59 intptr_t GCSweeper::SweepLargePage(HeapPage* page) { |
60 bool in_use = false; | 60 intptr_t bytes_to_end = 0; |
61 RawObject* raw_obj = RawObject::FromAddr(page->object_start()); | 61 RawObject* raw_obj = RawObject::FromAddr(page->object_start()); |
62 if (raw_obj->IsMarked()) { | 62 if (raw_obj->IsMarked()) { |
63 raw_obj->ClearMarkBit(); | 63 raw_obj->ClearMarkBit(); |
64 in_use = true; | 64 bytes_to_end += raw_obj->Size(); |
Ivan Posva
2014/06/30 05:51:05
+= -> =
koda
2014/06/30 22:57:48
Done.
| |
65 } | 65 } |
66 #ifdef DEBUG | 66 #ifdef DEBUG |
67 // String::MakeExternal and Array::MakeArray create trailing filler objects, | 67 // String::MakeExternal and Array::MakeArray create trailing filler objects, |
68 // but they are always unreachable. Verify that they are not marked. | 68 // but they are always unreachable. Verify that they are not marked. |
69 uword current = RawObject::ToAddr(raw_obj) + raw_obj->Size(); | 69 uword current = RawObject::ToAddr(raw_obj) + raw_obj->Size(); |
70 uword end = page->object_end(); | 70 uword end = page->object_end(); |
71 while (current < end) { | 71 while (current < end) { |
72 RawObject* cur_obj = RawObject::FromAddr(current); | 72 RawObject* cur_obj = RawObject::FromAddr(current); |
73 ASSERT(!cur_obj->IsMarked()); | 73 ASSERT(!cur_obj->IsMarked()); |
74 current += cur_obj->Size(); | 74 current += cur_obj->Size(); |
75 } | 75 } |
76 #endif // DEBUG | 76 #endif // DEBUG |
77 return in_use; | 77 return bytes_to_end; |
78 } | 78 } |
79 | 79 |
80 } // namespace dart | 80 } // namespace dart |
OLD | NEW |