OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 } while (cell_index < last_cell_index && cells[cell_index] == 0); | 202 } while (cell_index < last_cell_index && cells[cell_index] == 0); |
203 | 203 |
204 // If we reached last_cell return limit | 204 // If we reached last_cell return limit |
205 // not the start of the last_cell because | 205 // not the start of the last_cell because |
206 // limit can be in the middle of the previous cell. | 206 // limit can be in the middle of the previous cell. |
207 if (cell_index == last_cell_index) return limit; | 207 if (cell_index == last_cell_index) return limit; |
208 | 208 |
209 return FirstMarkedObject(page, cell_index, cells[cell_index]); | 209 return FirstMarkedObject(page, cell_index, cells[cell_index]); |
210 } | 210 } |
211 | 211 |
212 static inline void TransferMark(Address old_start, | 212 static void TransferMark(Address old_start, Address new_start); |
213 Address new_start) { | |
214 if (Heap::InNewSpace(old_start) || | |
215 Page::FromAddress(old_start)->IsFlagSet(Page::IS_CONTINUOUS) || | |
216 !IsMarked(old_start)) { | |
217 return; | |
218 } | |
219 | |
220 SetMark(new_start); | |
221 } | |
222 | 213 |
223 static bool Setup(); | 214 static bool Setup(); |
224 | 215 |
225 static void TearDown(); | 216 static void TearDown(); |
226 | 217 |
227 private: | 218 private: |
228 class BitmapStorageDescriptor { | 219 class BitmapStorageDescriptor { |
229 public: | 220 public: |
230 INLINE(static int CellsCount(Address addr)) { | 221 INLINE(static int CellsCount(Address addr)) { |
231 return HeaderOf(addr)->cells_count_; | 222 return HeaderOf(addr)->cells_count_; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 friend class MarkingVisitor; | 387 friend class MarkingVisitor; |
397 friend class StaticMarkingVisitor; | 388 friend class StaticMarkingVisitor; |
398 friend class CodeMarkingVisitor; | 389 friend class CodeMarkingVisitor; |
399 friend class SharedFunctionInfoMarkingVisitor; | 390 friend class SharedFunctionInfoMarkingVisitor; |
400 | 391 |
401 static void PrepareForCodeFlushing(); | 392 static void PrepareForCodeFlushing(); |
402 | 393 |
403 // Marking operations for objects reachable from roots. | 394 // Marking operations for objects reachable from roots. |
404 static void MarkLiveObjects(); | 395 static void MarkLiveObjects(); |
405 | 396 |
| 397 static void AfterMarking(); |
| 398 |
| 399 |
406 INLINE(static void MarkObject(HeapObject* obj)) { | 400 INLINE(static void MarkObject(HeapObject* obj)) { |
407 if (!Marking::TestAndMark(obj->address())) { | 401 if (!Marking::TestAndMark(obj->address())) { |
408 tracer_->increment_marked_count(); | 402 tracer_->increment_marked_count(); |
409 #ifdef DEBUG | 403 #ifdef DEBUG |
410 UpdateLiveObjectCount(obj); | 404 UpdateLiveObjectCount(obj); |
411 #endif | 405 #endif |
412 ProcessNewlyMarkedObject(obj); | 406 ProcessNewlyMarkedObject(obj); |
413 } | 407 } |
414 } | 408 } |
415 | 409 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 | 542 |
549 friend class UnmarkObjectVisitor; | 543 friend class UnmarkObjectVisitor; |
550 static void UnmarkObject(HeapObject* obj); | 544 static void UnmarkObject(HeapObject* obj); |
551 #endif | 545 #endif |
552 }; | 546 }; |
553 | 547 |
554 | 548 |
555 } } // namespace v8::internal | 549 } } // namespace v8::internal |
556 | 550 |
557 #endif // V8_MARK_COMPACT_H_ | 551 #endif // V8_MARK_COMPACT_H_ |
OLD | NEW |