| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
| 6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 2487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2498 int counter_; | 2498 int counter_; |
| 2499 }; | 2499 }; |
| 2500 | 2500 |
| 2501 | 2501 |
| 2502 // Space iterator for iterating over all spaces of the heap. | 2502 // Space iterator for iterating over all spaces of the heap. |
| 2503 // For each space an object iterator is provided. The deallocation of the | 2503 // For each space an object iterator is provided. The deallocation of the |
| 2504 // returned object iterators is handled by the space iterator. | 2504 // returned object iterators is handled by the space iterator. |
| 2505 class SpaceIterator : public Malloced { | 2505 class SpaceIterator : public Malloced { |
| 2506 public: | 2506 public: |
| 2507 explicit SpaceIterator(Heap* heap); | 2507 explicit SpaceIterator(Heap* heap); |
| 2508 SpaceIterator(Heap* heap, HeapObjectCallback size_func); | |
| 2509 virtual ~SpaceIterator(); | 2508 virtual ~SpaceIterator(); |
| 2510 | 2509 |
| 2511 bool has_next(); | 2510 bool has_next(); |
| 2512 ObjectIterator* next(); | 2511 ObjectIterator* next(); |
| 2513 | 2512 |
| 2514 private: | 2513 private: |
| 2515 ObjectIterator* CreateIterator(); | 2514 ObjectIterator* CreateIterator(); |
| 2516 | 2515 |
| 2517 Heap* heap_; | 2516 Heap* heap_; |
| 2518 int current_space_; // from enum AllocationSpace. | 2517 int current_space_; // from enum AllocationSpace. |
| 2519 ObjectIterator* iterator_; // object iterator for the current space. | 2518 ObjectIterator* iterator_; // object iterator for the current space. |
| 2520 HeapObjectCallback size_func_; | |
| 2521 }; | 2519 }; |
| 2522 | 2520 |
| 2523 | 2521 |
| 2524 // A HeapIterator provides iteration over the whole heap. It | 2522 // A HeapIterator provides iteration over the whole heap. It |
| 2525 // aggregates the specific iterators for the different spaces as | 2523 // aggregates the specific iterators for the different spaces as |
| 2526 // these can only iterate over one space only. | 2524 // these can only iterate over one space only. |
| 2527 // | 2525 // |
| 2528 // HeapIterator ensures there is no allocation during its lifetime | 2526 // HeapIterator ensures there is no allocation during its lifetime |
| 2529 // (using an embedded DisallowHeapAllocation instance). | 2527 // (using an embedded DisallowHeapAllocation instance). |
| 2530 // | 2528 // |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2786 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2784 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2787 | 2785 |
| 2788 private: | 2786 private: |
| 2789 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2787 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2790 }; | 2788 }; |
| 2791 #endif // DEBUG | 2789 #endif // DEBUG |
| 2792 } | 2790 } |
| 2793 } // namespace v8::internal | 2791 } // namespace v8::internal |
| 2794 | 2792 |
| 2795 #endif // V8_HEAP_HEAP_H_ | 2793 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |