| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 public: | 649 public: |
| 650 FreeList(); | 650 FreeList(); |
| 651 | 651 |
| 652 void addToFreeList(Address, size_t); | 652 void addToFreeList(Address, size_t); |
| 653 void clear(); | 653 void clear(); |
| 654 | 654 |
| 655 // Returns a bucket number for inserting a FreeListEntry of a given size. | 655 // Returns a bucket number for inserting a FreeListEntry of a given size. |
| 656 // All FreeListEntries in the given bucket, n, have size >= 2^n. | 656 // All FreeListEntries in the given bucket, n, have size >= 2^n. |
| 657 static int bucketIndexForSize(size_t); | 657 static int bucketIndexForSize(size_t); |
| 658 | 658 |
| 659 // Returns true if the freelist snapshot is captured. |
| 660 bool takeSnapshot(const String& dumpBaseName); |
| 661 |
| 659 #if ENABLE(GC_PROFILING) | 662 #if ENABLE(GC_PROFILING) |
| 660 struct PerBucketFreeListStats { | 663 struct PerBucketFreeListStats { |
| 661 size_t entryCount; | 664 size_t entryCount; |
| 662 size_t freeSize; | 665 size_t freeSize; |
| 663 | 666 |
| 664 PerBucketFreeListStats() : entryCount(0), freeSize(0) { } | 667 PerBucketFreeListStats() : entryCount(0), freeSize(0) { } |
| 665 }; | 668 }; |
| 666 | 669 |
| 667 void getFreeSizeStats(PerBucketFreeListStats bucketStats[], size_t& totalSiz
e) const; | 670 void getFreeSizeStats(PerBucketFreeListStats bucketStats[], size_t& totalSiz
e) const; |
| 668 #endif | 671 #endif |
| (...skipping 17 matching lines...) Expand all Loading... |
| 686 class PLATFORM_EXPORT BaseHeap { | 689 class PLATFORM_EXPORT BaseHeap { |
| 687 public: | 690 public: |
| 688 BaseHeap(ThreadState*, int); | 691 BaseHeap(ThreadState*, int); |
| 689 virtual ~BaseHeap(); | 692 virtual ~BaseHeap(); |
| 690 void cleanupPages(); | 693 void cleanupPages(); |
| 691 | 694 |
| 692 void takeSnapshot(const String& dumpBaseName); | 695 void takeSnapshot(const String& dumpBaseName); |
| 693 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 696 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| 694 BasePage* findPageFromAddress(Address); | 697 BasePage* findPageFromAddress(Address); |
| 695 #endif | 698 #endif |
| 699 virtual void takeFreelistSnapshot(const String& dumpBaseName) { }; |
| 696 #if ENABLE(GC_PROFILING) | 700 #if ENABLE(GC_PROFILING) |
| 697 void snapshot(TracedValue*, ThreadState::SnapshotInfo*); | 701 void snapshot(TracedValue*, ThreadState::SnapshotInfo*); |
| 698 virtual void snapshotFreeList(TracedValue&) { }; | 702 virtual void snapshotFreeList(TracedValue&) { }; |
| 699 | 703 |
| 700 void countMarkedObjects(ClassAgeCountsMap&) const; | 704 void countMarkedObjects(ClassAgeCountsMap&) const; |
| 701 void countObjectsToSweep(ClassAgeCountsMap&) const; | 705 void countObjectsToSweep(ClassAgeCountsMap&) const; |
| 702 void incrementMarkedObjectsAge(); | 706 void incrementMarkedObjectsAge(); |
| 703 #endif | 707 #endif |
| 704 | 708 |
| 705 virtual void clearFreeLists() { } | 709 virtual void clearFreeLists() { } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 { | 749 { |
| 746 ASSERT(findPageFromAddress(address)); | 750 ASSERT(findPageFromAddress(address)); |
| 747 ASSERT(findPageFromAddress(address + size - 1)); | 751 ASSERT(findPageFromAddress(address + size - 1)); |
| 748 m_freeList.addToFreeList(address, size); | 752 m_freeList.addToFreeList(address, size); |
| 749 } | 753 } |
| 750 virtual void clearFreeLists() override; | 754 virtual void clearFreeLists() override; |
| 751 #if ENABLE(ASSERT) | 755 #if ENABLE(ASSERT) |
| 752 virtual bool isConsistentForGC() override; | 756 virtual bool isConsistentForGC() override; |
| 753 bool pagesToBeSweptContains(Address); | 757 bool pagesToBeSweptContains(Address); |
| 754 #endif | 758 #endif |
| 759 void takeFreelistSnapshot(const String& dumpBaseName) override; |
| 755 #if ENABLE(GC_PROFILING) | 760 #if ENABLE(GC_PROFILING) |
| 756 void snapshotFreeList(TracedValue&) override; | 761 void snapshotFreeList(TracedValue&) override; |
| 757 #endif | 762 #endif |
| 758 | 763 |
| 759 Address allocateObject(size_t allocationSize, size_t gcInfoIndex); | 764 Address allocateObject(size_t allocationSize, size_t gcInfoIndex); |
| 760 | 765 |
| 761 void freePage(NormalPage*); | 766 void freePage(NormalPage*); |
| 762 | 767 |
| 763 bool coalesce(); | 768 bool coalesce(); |
| 764 void promptlyFreeObject(HeapObjectHeader*); | 769 void promptlyFreeObject(HeapObjectHeader*); |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 size_t copySize = previousHeader->payloadSize(); | 1394 size_t copySize = previousHeader->payloadSize(); |
| 1390 if (copySize > size) | 1395 if (copySize > size) |
| 1391 copySize = size; | 1396 copySize = size; |
| 1392 memcpy(address, previous, copySize); | 1397 memcpy(address, previous, copySize); |
| 1393 return address; | 1398 return address; |
| 1394 } | 1399 } |
| 1395 | 1400 |
| 1396 } // namespace blink | 1401 } // namespace blink |
| 1397 | 1402 |
| 1398 #endif // Heap_h | 1403 #endif // Heap_h |
| OLD | NEW |