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 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 | 1401 |
1402 private: | 1402 private: |
1403 class PretenuringScope; | 1403 class PretenuringScope; |
1404 class UnmapFreeMemoryTask; | 1404 class UnmapFreeMemoryTask; |
1405 | 1405 |
1406 // External strings table is a place where all external strings are | 1406 // External strings table is a place where all external strings are |
1407 // registered. We need to keep track of such strings to properly | 1407 // registered. We need to keep track of such strings to properly |
1408 // finalize them. | 1408 // finalize them. |
1409 class ExternalStringTable { | 1409 class ExternalStringTable { |
1410 public: | 1410 public: |
| 1411 enum CleanupMode { kFull, kPromoteOnly }; |
| 1412 |
1411 // Registers an external string. | 1413 // Registers an external string. |
1412 inline void AddString(String* string); | 1414 inline void AddString(String* string); |
1413 | 1415 |
1414 inline void Iterate(ObjectVisitor* v); | 1416 inline void Iterate(ObjectVisitor* v); |
1415 | 1417 |
1416 // Restores internal invariant and gets rid of collected strings. | 1418 // Restores internal invariant and gets rid of collected strings. |
1417 // Must be called after each Iterate() that modified the strings. | 1419 // Must be called after each Iterate() that modified the strings. |
| 1420 template <CleanupMode mode = kFull> |
1418 void CleanUp(); | 1421 void CleanUp(); |
1419 | 1422 |
1420 // Destroys all allocated memory. | 1423 // Destroys all allocated memory. |
1421 void TearDown(); | 1424 void TearDown(); |
1422 | 1425 |
1423 private: | 1426 private: |
1424 explicit ExternalStringTable(Heap* heap) : heap_(heap) {} | 1427 explicit ExternalStringTable(Heap* heap) : heap_(heap) {} |
1425 | 1428 |
1426 inline void Verify(); | 1429 inline void Verify(); |
1427 | 1430 |
(...skipping 1233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2661 friend class LargeObjectSpace; | 2664 friend class LargeObjectSpace; |
2662 friend class NewSpace; | 2665 friend class NewSpace; |
2663 friend class PagedSpace; | 2666 friend class PagedSpace; |
2664 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2667 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2665 }; | 2668 }; |
2666 | 2669 |
2667 } // namespace internal | 2670 } // namespace internal |
2668 } // namespace v8 | 2671 } // namespace v8 |
2669 | 2672 |
2670 #endif // V8_HEAP_HEAP_H_ | 2673 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |