| 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 void takeSnapshot(const String& dumpBaseName); |
| 659 #if ENABLE(GC_PROFILING) | 660 #if ENABLE(GC_PROFILING) |
| 660 struct PerBucketFreeListStats { | 661 struct PerBucketFreeListStats { |
| 661 size_t entryCount; | 662 size_t entryCount; |
| 662 size_t freeSize; | 663 size_t freeSize; |
| 663 | 664 |
| 664 PerBucketFreeListStats() : entryCount(0), freeSize(0) { } | 665 PerBucketFreeListStats() : entryCount(0), freeSize(0) { } |
| 665 }; | 666 }; |
| 666 | 667 |
| 667 void getFreeSizeStats(PerBucketFreeListStats bucketStats[], size_t& totalSiz
e) const; | 668 void getFreeSizeStats(PerBucketFreeListStats bucketStats[], size_t& totalSiz
e) const; |
| 668 #endif | 669 #endif |
| (...skipping 17 matching lines...) Expand all Loading... |
| 686 class PLATFORM_EXPORT BaseHeap { | 687 class PLATFORM_EXPORT BaseHeap { |
| 687 public: | 688 public: |
| 688 BaseHeap(ThreadState*, int); | 689 BaseHeap(ThreadState*, int); |
| 689 virtual ~BaseHeap(); | 690 virtual ~BaseHeap(); |
| 690 void cleanupPages(); | 691 void cleanupPages(); |
| 691 | 692 |
| 692 void takeSnapshot(const String& dumpBaseName); | 693 void takeSnapshot(const String& dumpBaseName); |
| 693 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) | 694 #if ENABLE(ASSERT) || ENABLE(GC_PROFILING) |
| 694 BasePage* findPageFromAddress(Address); | 695 BasePage* findPageFromAddress(Address); |
| 695 #endif | 696 #endif |
| 697 virtual void takeFreelistSnapshot(const String& dumpBaseName) { }; |
| 696 #if ENABLE(GC_PROFILING) | 698 #if ENABLE(GC_PROFILING) |
| 697 void snapshot(TracedValue*, ThreadState::SnapshotInfo*); | 699 void snapshot(TracedValue*, ThreadState::SnapshotInfo*); |
| 698 virtual void snapshotFreeList(TracedValue&) { }; | 700 virtual void snapshotFreeList(TracedValue&) { }; |
| 699 | 701 |
| 700 void countMarkedObjects(ClassAgeCountsMap&) const; | 702 void countMarkedObjects(ClassAgeCountsMap&) const; |
| 701 void countObjectsToSweep(ClassAgeCountsMap&) const; | 703 void countObjectsToSweep(ClassAgeCountsMap&) const; |
| 702 void incrementMarkedObjectsAge(); | 704 void incrementMarkedObjectsAge(); |
| 703 #endif | 705 #endif |
| 704 | 706 |
| 705 virtual void clearFreeLists() { } | 707 virtual void clearFreeLists() { } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 { | 747 { |
| 746 ASSERT(findPageFromAddress(address)); | 748 ASSERT(findPageFromAddress(address)); |
| 747 ASSERT(findPageFromAddress(address + size - 1)); | 749 ASSERT(findPageFromAddress(address + size - 1)); |
| 748 m_freeList.addToFreeList(address, size); | 750 m_freeList.addToFreeList(address, size); |
| 749 } | 751 } |
| 750 virtual void clearFreeLists() override; | 752 virtual void clearFreeLists() override; |
| 751 #if ENABLE(ASSERT) | 753 #if ENABLE(ASSERT) |
| 752 virtual bool isConsistentForGC() override; | 754 virtual bool isConsistentForGC() override; |
| 753 bool pagesToBeSweptContains(Address); | 755 bool pagesToBeSweptContains(Address); |
| 754 #endif | 756 #endif |
| 757 void takeFreelistSnapshot(const String& dumpBaseName) override; |
| 755 #if ENABLE(GC_PROFILING) | 758 #if ENABLE(GC_PROFILING) |
| 756 void snapshotFreeList(TracedValue&) override; | 759 void snapshotFreeList(TracedValue&) override; |
| 757 #endif | 760 #endif |
| 758 | 761 |
| 759 Address allocateObject(size_t allocationSize, size_t gcInfoIndex); | 762 Address allocateObject(size_t allocationSize, size_t gcInfoIndex); |
| 760 | 763 |
| 761 void freePage(NormalPage*); | 764 void freePage(NormalPage*); |
| 762 | 765 |
| 763 bool coalesce(); | 766 bool coalesce(); |
| 764 void promptlyFreeObject(HeapObjectHeader*); | 767 void promptlyFreeObject(HeapObjectHeader*); |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1389 size_t copySize = previousHeader->payloadSize(); | 1392 size_t copySize = previousHeader->payloadSize(); |
| 1390 if (copySize > size) | 1393 if (copySize > size) |
| 1391 copySize = size; | 1394 copySize = size; |
| 1392 memcpy(address, previous, copySize); | 1395 memcpy(address, previous, copySize); |
| 1393 return address; | 1396 return address; |
| 1394 } | 1397 } |
| 1395 | 1398 |
| 1396 } // namespace blink | 1399 } // namespace blink |
| 1397 | 1400 |
| 1398 #endif // Heap_h | 1401 #endif // Heap_h |
| OLD | NEW |