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 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1394 | 1394 |
1395 private: | 1395 private: |
1396 class PretenuringScope; | 1396 class PretenuringScope; |
1397 class UnmapFreeMemoryTask; | 1397 class UnmapFreeMemoryTask; |
1398 | 1398 |
1399 // External strings table is a place where all external strings are | 1399 // External strings table is a place where all external strings are |
1400 // registered. We need to keep track of such strings to properly | 1400 // registered. We need to keep track of such strings to properly |
1401 // finalize them. | 1401 // finalize them. |
1402 class ExternalStringTable { | 1402 class ExternalStringTable { |
1403 public: | 1403 public: |
| 1404 enum CleanupMode { kFull, kPromoteOnly }; |
| 1405 |
1404 // Registers an external string. | 1406 // Registers an external string. |
1405 inline void AddString(String* string); | 1407 inline void AddString(String* string); |
1406 | 1408 |
1407 inline void Iterate(ObjectVisitor* v); | 1409 inline void Iterate(ObjectVisitor* v); |
1408 | 1410 |
1409 // Restores internal invariant and gets rid of collected strings. | 1411 // Restores internal invariant and gets rid of collected strings. |
1410 // Must be called after each Iterate() that modified the strings. | 1412 // Must be called after each Iterate() that modified the strings. |
| 1413 template <CleanupMode mode = kFull> |
1411 void CleanUp(); | 1414 void CleanUp(); |
1412 | 1415 |
1413 // Destroys all allocated memory. | 1416 // Destroys all allocated memory. |
1414 void TearDown(); | 1417 void TearDown(); |
1415 | 1418 |
1416 private: | 1419 private: |
1417 explicit ExternalStringTable(Heap* heap) : heap_(heap) {} | 1420 explicit ExternalStringTable(Heap* heap) : heap_(heap) {} |
1418 | 1421 |
1419 inline void Verify(); | 1422 inline void Verify(); |
1420 | 1423 |
(...skipping 1232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2653 friend class LargeObjectSpace; | 2656 friend class LargeObjectSpace; |
2654 friend class NewSpace; | 2657 friend class NewSpace; |
2655 friend class PagedSpace; | 2658 friend class PagedSpace; |
2656 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2659 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2657 }; | 2660 }; |
2658 | 2661 |
2659 } // namespace internal | 2662 } // namespace internal |
2660 } // namespace v8 | 2663 } // namespace v8 |
2661 | 2664 |
2662 #endif // V8_HEAP_HEAP_H_ | 2665 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |