Index: src/spaces.h |
=================================================================== |
--- src/spaces.h (revision 1910) |
+++ src/spaces.h (working copy) |
@@ -511,22 +511,11 @@ |
// |
// A HeapObjectIterator iterates objects from a given address to the |
// top of a space. The given address must be below the current |
-// allocation pointer (space top). There are some caveats. |
-// |
-// (1) If the space top changes upward during iteration (because of |
-// allocating new objects), the iterator does not iterate objects |
-// above the original space top. The caller must create a new |
-// iterator starting from the old top in order to visit these new |
-// objects. |
-// |
-// (2) If new objects are allocated below the original allocation top |
-// (e.g., free-list allocation in paged spaces), the new objects |
-// may or may not be iterated depending on their position with |
-// respect to the current point of iteration. |
-// |
-// (3) The space top should not change downward during iteration, |
-// otherwise the iterator will return not-necessarily-valid |
-// objects. |
+// allocation pointer (space top). If the space top changes during |
+// iteration (because of allocating new objects), the iterator does |
+// not iterate new objects. The caller function must create a new |
+// iterator starting from the old top in order to visit these new |
+// objects. Heap::Scavenage() is such an example. |
class HeapObjectIterator: public ObjectIterator { |
public: |
@@ -570,35 +559,17 @@ |
// ----------------------------------------------------------------------------- |
-// A PageIterator iterates the pages in a paged space. |
+// A PageIterator iterates pages in a space. |
// |
// The PageIterator class provides three modes for iterating pages in a space: |
-// PAGES_IN_USE iterates pages containing allocated objects. |
-// PAGES_USED_BY_MC iterates pages that hold relocated objects during a |
-// mark-compact collection. |
+// PAGES_IN_USE iterates pages that are in use by the allocator; |
+// PAGES_USED_BY_GC iterates pages that hold relocated objects during a |
+// mark-compact collection; |
// ALL_PAGES iterates all pages in the space. |
-// |
-// There are some caveats. |
-// |
-// (1) If the space expands during iteration, new pages will not be |
-// returned by the iterator in any mode. |
-// |
-// (2) If new objects are allocated during iteration, they will appear |
-// in pages returned by the iterator. Allocation may cause the |
-// allocation pointer or MC allocation pointer in the last page to |
-// change between constructing the iterator and iterating the last |
-// page. |
-// |
-// (3) The space should not shrink during iteration, otherwise the |
-// iterator will return deallocated pages. |
class PageIterator BASE_EMBEDDED { |
public: |
- enum Mode { |
- PAGES_IN_USE, |
- PAGES_USED_BY_MC, |
- ALL_PAGES |
- }; |
+ enum Mode {PAGES_IN_USE, PAGES_USED_BY_MC, ALL_PAGES}; |
PageIterator(PagedSpace* space, Mode mode); |
@@ -606,9 +577,8 @@ |
inline Page* next(); |
private: |
- PagedSpace* space_; |
- Page* prev_page_; // Previous page returned. |
- Page* stop_page_; // Page to stop at (last page returned by the iterator). |
+ Page* cur_page_; // next page to return |
+ Page* stop_page_; // page where to stop |
}; |
@@ -839,10 +809,6 @@ |
// The first page in this space. |
Page* first_page_; |
- // The last page in this space. Initially set in Setup, updated in |
- // Expand and Shrink. |
- Page* last_page_; |
- |
// Normal allocation information. |
AllocationInfo allocation_info_; |