| 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 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 entry = new (NotNull, address) FreeListEntry(size); | 838 entry = new (NotNull, address) FreeListEntry(size); |
| 839 #if defined(ADDRESS_SANITIZER) | 839 #if defined(ADDRESS_SANITIZER) |
| 840 // For ASan we don't add the entry to the free lists until the asanDeferMemo
ryReuseCount | 840 // For ASan we don't add the entry to the free lists until the asanDeferMemo
ryReuseCount |
| 841 // reaches zero. However we always add entire pages to ensure that adding a
new page will | 841 // reaches zero. However we always add entire pages to ensure that adding a
new page will |
| 842 // increase the allocation space. | 842 // increase the allocation space. |
| 843 if (HeapPage<Header>::payloadSize() != size && !entry->shouldAddToFreeList()
) | 843 if (HeapPage<Header>::payloadSize() != size && !entry->shouldAddToFreeList()
) |
| 844 return; | 844 return; |
| 845 #endif | 845 #endif |
| 846 int index = bucketIndexForSize(size); | 846 int index = bucketIndexForSize(size); |
| 847 entry->link(&m_freeLists[index]); | 847 entry->link(&m_freeLists[index]); |
| 848 if (!m_lastFreeListEntries[index]) | |
| 849 m_lastFreeListEntries[index] = entry; | |
| 850 if (index > m_biggestFreeListIndex) | 848 if (index > m_biggestFreeListIndex) |
| 851 m_biggestFreeListIndex = index; | 849 m_biggestFreeListIndex = index; |
| 852 } | 850 } |
| 853 | 851 |
| 854 template<typename Header> | 852 template<typename Header> |
| 855 bool ThreadHeap<Header>::expandObject(Header* header, size_t newSize) | 853 bool ThreadHeap<Header>::expandObject(Header* header, size_t newSize) |
| 856 { | 854 { |
| 857 ASSERT(header->payloadSize() < newSize); | 855 ASSERT(header->payloadSize() < newSize); |
| 858 size_t allocationSize = allocationSizeFromSize(newSize); | 856 size_t allocationSize = allocationSizeFromSize(newSize); |
| 859 ASSERT(allocationSize > header->size()); | 857 ASSERT(allocationSize > header->size()); |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1513 void ThreadHeap<Header>::clearFreeLists() | 1511 void ThreadHeap<Header>::clearFreeLists() |
| 1514 { | 1512 { |
| 1515 m_promptlyFreedCount = 0; | 1513 m_promptlyFreedCount = 0; |
| 1516 m_freeList.clear(); | 1514 m_freeList.clear(); |
| 1517 } | 1515 } |
| 1518 | 1516 |
| 1519 template<typename Header> | 1517 template<typename Header> |
| 1520 void FreeList<Header>::clear() | 1518 void FreeList<Header>::clear() |
| 1521 { | 1519 { |
| 1522 m_biggestFreeListIndex = 0; | 1520 m_biggestFreeListIndex = 0; |
| 1523 for (size_t i = 0; i < blinkPageSizeLog2; i++) { | 1521 for (size_t i = 0; i < blinkPageSizeLog2; i++) |
| 1524 m_freeLists[i] = 0; | 1522 m_freeLists[i] = 0; |
| 1525 m_lastFreeListEntries[i] = 0; | |
| 1526 } | |
| 1527 } | 1523 } |
| 1528 | 1524 |
| 1529 template<typename Header> | 1525 template<typename Header> |
| 1530 int FreeList<Header>::bucketIndexForSize(size_t size) | 1526 int FreeList<Header>::bucketIndexForSize(size_t size) |
| 1531 { | 1527 { |
| 1532 ASSERT(size > 0); | 1528 ASSERT(size > 0); |
| 1533 int index = -1; | 1529 int index = -1; |
| 1534 while (size) { | 1530 while (size) { |
| 1535 size >>= 1; | 1531 size >>= 1; |
| 1536 index++; | 1532 index++; |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2828 bool Heap::s_lastGCWasConservative = false; | 2824 bool Heap::s_lastGCWasConservative = false; |
| 2829 bool Heap::s_inGC = false; | 2825 bool Heap::s_inGC = false; |
| 2830 FreePagePool* Heap::s_freePagePool; | 2826 FreePagePool* Heap::s_freePagePool; |
| 2831 OrphanedPagePool* Heap::s_orphanedPagePool; | 2827 OrphanedPagePool* Heap::s_orphanedPagePool; |
| 2832 Heap::RegionTree* Heap::s_regionTree = 0; | 2828 Heap::RegionTree* Heap::s_regionTree = 0; |
| 2833 size_t Heap::s_allocatedObjectSize = 0; | 2829 size_t Heap::s_allocatedObjectSize = 0; |
| 2834 size_t Heap::s_allocatedSpace = 0; | 2830 size_t Heap::s_allocatedSpace = 0; |
| 2835 size_t Heap::s_markedObjectSize = 0; | 2831 size_t Heap::s_markedObjectSize = 0; |
| 2836 | 2832 |
| 2837 } // namespace blink | 2833 } // namespace blink |
| OLD | NEW |