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/lockers.h" | 10 #include "vm/lockers.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 | 75 |
76 intptr_t GCSweeper::SweepLargePage(HeapPage* page) { | 76 intptr_t GCSweeper::SweepLargePage(HeapPage* page) { |
77 intptr_t words_to_end = 0; | 77 intptr_t words_to_end = 0; |
78 RawObject* raw_obj = RawObject::FromAddr(page->object_start()); | 78 RawObject* raw_obj = RawObject::FromAddr(page->object_start()); |
79 if (raw_obj->IsMarked()) { | 79 if (raw_obj->IsMarked()) { |
80 raw_obj->ClearMarkBit(); | 80 raw_obj->ClearMarkBit(); |
81 words_to_end = (raw_obj->Size() >> kWordSizeLog2); | 81 words_to_end = (raw_obj->Size() >> kWordSizeLog2); |
82 } | 82 } |
83 #ifdef DEBUG | 83 #ifdef DEBUG |
84 // String::MakeExternal and Array::MakeArray create trailing filler objects, | 84 // String::MakeExternal and Array::MakeFixedLength create trailing filler |
85 // but they are always unreachable. Verify that they are not marked. | 85 // objects, but they are always unreachable. Verify that they are not marked. |
86 uword current = RawObject::ToAddr(raw_obj) + raw_obj->Size(); | 86 uword current = RawObject::ToAddr(raw_obj) + raw_obj->Size(); |
87 uword end = page->object_end(); | 87 uword end = page->object_end(); |
88 while (current < end) { | 88 while (current < end) { |
89 RawObject* cur_obj = RawObject::FromAddr(current); | 89 RawObject* cur_obj = RawObject::FromAddr(current); |
90 ASSERT(!cur_obj->IsMarked()); | 90 ASSERT(!cur_obj->IsMarked()); |
91 intptr_t obj_size = cur_obj->Size(); | 91 intptr_t obj_size = cur_obj->Size(); |
92 memset(reinterpret_cast<void*>(current), Heap::kZapByte, obj_size); | 92 memset(reinterpret_cast<void*>(current), Heap::kZapByte, obj_size); |
93 current += obj_size; | 93 current += obj_size; |
94 } | 94 } |
95 #endif // DEBUG | 95 #endif // DEBUG |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 HeapPage* first, | 173 HeapPage* first, |
174 HeapPage* last, | 174 HeapPage* last, |
175 FreeList* freelist) { | 175 FreeList* freelist) { |
176 SweeperTask* task = new SweeperTask(isolate, isolate->heap()->old_space(), | 176 SweeperTask* task = new SweeperTask(isolate, isolate->heap()->old_space(), |
177 first, last, freelist); | 177 first, last, freelist); |
178 ThreadPool* pool = Dart::thread_pool(); | 178 ThreadPool* pool = Dart::thread_pool(); |
179 pool->Run(task); | 179 pool->Run(task); |
180 } | 180 } |
181 | 181 |
182 } // namespace dart | 182 } // namespace dart |
OLD | NEW |