OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_SPACES_H_ | 5 #ifndef V8_HEAP_SPACES_H_ |
6 #define V8_HEAP_SPACES_H_ | 6 #define V8_HEAP_SPACES_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2267 }; | 2267 }; |
2268 | 2268 |
2269 | 2269 |
2270 // A SemiSpaceIterator is an ObjectIterator that iterates over the active | 2270 // A SemiSpaceIterator is an ObjectIterator that iterates over the active |
2271 // semispace of the heap's new space. It iterates over the objects in the | 2271 // semispace of the heap's new space. It iterates over the objects in the |
2272 // semispace from a given start address (defaulting to the bottom of the | 2272 // semispace from a given start address (defaulting to the bottom of the |
2273 // semispace) to the top of the semispace. New objects allocated after the | 2273 // semispace) to the top of the semispace. New objects allocated after the |
2274 // iterator is created are not iterated. | 2274 // iterator is created are not iterated. |
2275 class SemiSpaceIterator : public ObjectIterator { | 2275 class SemiSpaceIterator : public ObjectIterator { |
2276 public: | 2276 public: |
2277 // Create an iterator over the objects in the given space. If no start | 2277 // Create an iterator over the allocated objects in the given to-space. |
2278 // address is given, the iterator starts from the bottom of the space. | |
2279 | |
2280 // Iterate over all of allocated to-space. | |
2281 explicit SemiSpaceIterator(NewSpace* space); | 2278 explicit SemiSpaceIterator(NewSpace* space); |
2282 // Iterate over part of allocated to-space, from start to the end | |
2283 // of allocation. | |
2284 SemiSpaceIterator(NewSpace* space, Address start); | |
2285 // Iterate from one address to another in the same semi-space. | |
2286 SemiSpaceIterator(Address from, Address to); | |
2287 | 2279 |
2288 HeapObject* Next() { | 2280 HeapObject* Next() { |
2289 if (current_ == limit_) return NULL; | 2281 if (current_ == limit_) return NULL; |
2290 if (NewSpacePage::IsAtEnd(current_)) { | 2282 if (NewSpacePage::IsAtEnd(current_)) { |
2291 NewSpacePage* page = NewSpacePage::FromLimit(current_); | 2283 NewSpacePage* page = NewSpacePage::FromLimit(current_); |
2292 page = page->next_page(); | 2284 page = page->next_page(); |
2293 DCHECK(!page->is_anchor()); | 2285 DCHECK(!page->is_anchor()); |
2294 current_ = page->area_start(); | 2286 current_ = page->area_start(); |
2295 if (current_ == limit_) return NULL; | 2287 if (current_ == limit_) return NULL; |
2296 } | 2288 } |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2887 count = 0; | 2879 count = 0; |
2888 } | 2880 } |
2889 // Must be small, since an iteration is used for lookup. | 2881 // Must be small, since an iteration is used for lookup. |
2890 static const int kMaxComments = 64; | 2882 static const int kMaxComments = 64; |
2891 }; | 2883 }; |
2892 #endif | 2884 #endif |
2893 } | 2885 } |
2894 } // namespace v8::internal | 2886 } // namespace v8::internal |
2895 | 2887 |
2896 #endif // V8_HEAP_SPACES_H_ | 2888 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |