OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 | 1578 |
1579 // A HeapIterator provides iteration over the whole heap. It | 1579 // A HeapIterator provides iteration over the whole heap. It |
1580 // aggregates the specific iterators for the different spaces as | 1580 // aggregates the specific iterators for the different spaces as |
1581 // these can only iterate over one space only. | 1581 // these can only iterate over one space only. |
1582 // | 1582 // |
1583 // HeapIterator can skip free list nodes (that is, de-allocated heap | 1583 // HeapIterator can skip free list nodes (that is, de-allocated heap |
1584 // objects that still remain in the heap). As implementation of free | 1584 // objects that still remain in the heap). As implementation of free |
1585 // nodes filtering uses GC marks, it can't be used during MS/MC GC | 1585 // nodes filtering uses GC marks, it can't be used during MS/MC GC |
1586 // phases. Also, it is forbidden to interrupt iteration in this mode, | 1586 // phases. Also, it is forbidden to interrupt iteration in this mode, |
1587 // as this will leave heap objects marked (and thus, unusable). | 1587 // as this will leave heap objects marked (and thus, unusable). |
1588 class FreeListNodesFilter; | 1588 class HeapObjectsFilter; |
1589 | 1589 |
1590 class HeapIterator BASE_EMBEDDED { | 1590 class HeapIterator BASE_EMBEDDED { |
1591 public: | 1591 public: |
1592 enum FreeListNodesFiltering { | 1592 enum HeapObjectsFiltering { |
1593 kNoFiltering, | 1593 kNoFiltering, |
1594 kPreciseFiltering | 1594 kFilterFreeListNodes, |
| 1595 kFilterUnreachable |
1595 }; | 1596 }; |
1596 | 1597 |
1597 HeapIterator(); | 1598 HeapIterator(); |
1598 explicit HeapIterator(FreeListNodesFiltering filtering); | 1599 explicit HeapIterator(HeapObjectsFiltering filtering); |
1599 ~HeapIterator(); | 1600 ~HeapIterator(); |
1600 | 1601 |
1601 HeapObject* next(); | 1602 HeapObject* next(); |
1602 void reset(); | 1603 void reset(); |
1603 | 1604 |
1604 private: | 1605 private: |
1605 // Perform the initialization. | 1606 // Perform the initialization. |
1606 void Init(); | 1607 void Init(); |
1607 // Perform all necessary shutdown (destruction) work. | 1608 // Perform all necessary shutdown (destruction) work. |
1608 void Shutdown(); | 1609 void Shutdown(); |
1609 HeapObject* NextObject(); | 1610 HeapObject* NextObject(); |
1610 | 1611 |
1611 FreeListNodesFiltering filtering_; | 1612 HeapObjectsFiltering filtering_; |
1612 FreeListNodesFilter* filter_; | 1613 HeapObjectsFilter* filter_; |
1613 // Space iterator for iterating all the spaces. | 1614 // Space iterator for iterating all the spaces. |
1614 SpaceIterator* space_iterator_; | 1615 SpaceIterator* space_iterator_; |
1615 // Object iterator for the space currently being iterated. | 1616 // Object iterator for the space currently being iterated. |
1616 ObjectIterator* object_iterator_; | 1617 ObjectIterator* object_iterator_; |
1617 }; | 1618 }; |
1618 | 1619 |
1619 | 1620 |
1620 // Cache for mapping (map, property name) into field offset. | 1621 // Cache for mapping (map, property name) into field offset. |
1621 // Cleared at startup and prior to mark sweep collection. | 1622 // Cleared at startup and prior to mark sweep collection. |
1622 class KeyedLookupCache { | 1623 class KeyedLookupCache { |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2106 // Return whether this object should be retained. If NULL is returned the | 2107 // Return whether this object should be retained. If NULL is returned the |
2107 // object has no references. Otherwise the address of the retained object | 2108 // object has no references. Otherwise the address of the retained object |
2108 // should be returned as in some GC situations the object has been moved. | 2109 // should be returned as in some GC situations the object has been moved. |
2109 virtual Object* RetainAs(Object* object) = 0; | 2110 virtual Object* RetainAs(Object* object) = 0; |
2110 }; | 2111 }; |
2111 | 2112 |
2112 | 2113 |
2113 } } // namespace v8::internal | 2114 } } // namespace v8::internal |
2114 | 2115 |
2115 #endif // V8_HEAP_H_ | 2116 #endif // V8_HEAP_H_ |
OLD | NEW |