| 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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 | 745 |
| 746 void ThreadState::setupHeapsForTermination() | 746 void ThreadState::setupHeapsForTermination() |
| 747 { | 747 { |
| 748 for (int i = 0; i < NumberOfHeaps; i++) | 748 for (int i = 0; i < NumberOfHeaps; i++) |
| 749 m_heaps[i]->prepareHeapForTermination(); | 749 m_heaps[i]->prepareHeapForTermination(); |
| 750 } | 750 } |
| 751 | 751 |
| 752 BaseHeapPage* ThreadState::heapPageFromAddress(Address address) | 752 BaseHeapPage* ThreadState::heapPageFromAddress(Address address) |
| 753 { | 753 { |
| 754 BaseHeapPage* cachedPage = heapContainsCache()->lookup(address); | 754 BaseHeapPage* cachedPage = heapContainsCache()->lookup(address); |
| 755 #ifdef NDEBUG | 755 #if !ENABLE(ASSERT) |
| 756 if (cachedPage) | 756 if (cachedPage) |
| 757 return cachedPage; | 757 return cachedPage; |
| 758 #endif | 758 #endif |
| 759 | 759 |
| 760 for (int i = 0; i < NumberOfHeaps; i++) { | 760 for (int i = 0; i < NumberOfHeaps; i++) { |
| 761 BaseHeapPage* page = m_heaps[i]->heapPageFromAddress(address); | 761 BaseHeapPage* page = m_heaps[i]->heapPageFromAddress(address); |
| 762 if (page) { | 762 if (page) { |
| 763 // Asserts that make sure heapPageFromAddress takes addresses from | 763 // Asserts that make sure heapPageFromAddress takes addresses from |
| 764 // the whole aligned blinkPageSize memory area. This is necessary | 764 // the whole aligned blinkPageSize memory area. This is necessary |
| 765 // for the negative cache to work. | 765 // for the negative cache to work. |
| 766 ASSERT(page->isLargeObject() || page == m_heaps[i]->heapPageFromAddr
ess(roundToBlinkPageStart(address))); | 766 ASSERT(page->isLargeObject() || page == m_heaps[i]->heapPageFromAddr
ess(roundToBlinkPageStart(address))); |
| 767 if (roundToBlinkPageStart(address) != roundToBlinkPageEnd(address)) | 767 if (roundToBlinkPageStart(address) != roundToBlinkPageEnd(address)) |
| 768 ASSERT(page->isLargeObject() || page == m_heaps[i]->heapPageFrom
Address(roundToBlinkPageEnd(address) - 1)); | 768 ASSERT(page->isLargeObject() || page == m_heaps[i]->heapPageFrom
Address(roundToBlinkPageEnd(address) - 1)); |
| 769 ASSERT(!cachedPage || page == cachedPage); | 769 ASSERT(!cachedPage || page == cachedPage); |
| 770 if (!cachedPage) | 770 if (!cachedPage) |
| 771 heapContainsCache()->addEntry(address, page); | 771 heapContainsCache()->addEntry(address, page); |
| 772 return page; | 772 return page; |
| 773 } | 773 } |
| 774 } | 774 } |
| 775 ASSERT(!cachedPage); | 775 ASSERT(!cachedPage); |
| 776 return 0; | 776 return 0; |
| 777 } | 777 } |
| 778 | 778 |
| 779 void ThreadState::getStats(HeapStats& stats) | 779 void ThreadState::getStats(HeapStats& stats) |
| 780 { | 780 { |
| 781 stats = m_stats; | 781 stats = m_stats; |
| 782 #ifndef NDEBUG | 782 #if ENABLE(ASSERT) |
| 783 if (isConsistentForGC()) { | 783 if (isConsistentForGC()) { |
| 784 HeapStats scannedStats; | 784 HeapStats scannedStats; |
| 785 scannedStats.clear(); | 785 scannedStats.clear(); |
| 786 for (int i = 0; i < NumberOfHeaps; i++) | 786 for (int i = 0; i < NumberOfHeaps; i++) |
| 787 m_heaps[i]->getScannedStats(scannedStats); | 787 m_heaps[i]->getScannedStats(scannedStats); |
| 788 ASSERT(scannedStats == stats); | 788 ASSERT(scannedStats == stats); |
| 789 } | 789 } |
| 790 #endif | 790 #endif |
| 791 } | 791 } |
| 792 | 792 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 threadAttachMutex().unlock(); | 970 threadAttachMutex().unlock(); |
| 971 return gcInfo; | 971 return gcInfo; |
| 972 } | 972 } |
| 973 } | 973 } |
| 974 if (needLockForIteration) | 974 if (needLockForIteration) |
| 975 threadAttachMutex().unlock(); | 975 threadAttachMutex().unlock(); |
| 976 return 0; | 976 return 0; |
| 977 } | 977 } |
| 978 #endif | 978 #endif |
| 979 } | 979 } |
| OLD | NEW |