Chromium Code Reviews| Index: src/spaces.h |
| =================================================================== |
| --- src/spaces.h (revision 10059) |
| +++ src/spaces.h (working copy) |
| @@ -1557,6 +1557,7 @@ |
| } |
| void SetPagesToSweep(Page* first) { |
| + if (first == &anchor_) first = NULL; |
| first_unswept_page_ = first; |
| } |
| @@ -1569,7 +1570,7 @@ |
| Page* FirstPage() { return anchor_.next_page(); } |
| Page* LastPage() { return anchor_.prev_page(); } |
| - bool IsFragmented(Page* p) { |
| + int Fragmentation(Page* p) { |
|
Michael Starzinger
2011/11/24 14:43:49
A one-liner comment about the possible range of re
Erik Corry
2011/11/24 17:02:30
Done.
|
| FreeList::SizeStats sizes; |
| free_list_.CountFreeListItems(p, &sizes); |
| @@ -1604,8 +1605,12 @@ |
| (ratio > ratio_threshold) ? "[fragmented]" : ""); |
| } |
| - return (ratio > ratio_threshold) || |
| - (FLAG_always_compact && sizes.Total() != Page::kObjectAreaSize); |
| + if (FLAG_always_compact && sizes.Total() != Page::kObjectAreaSize) { |
| + return 1; |
| + } |
| + if (ratio <= ratio_threshold) return 0; // Not fragmented. |
| + |
| + return static_cast<int>(ratio - ratio_threshold); |
| } |
| void EvictEvacuationCandidatesFromFreeLists(); |