| 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 // before the next GC arrived. | 700 // before the next GC arrived. |
| 701 if (sweepRequested()) | 701 if (sweepRequested()) |
| 702 heap->clearMarks(); | 702 heap->clearMarks(); |
| 703 } | 703 } |
| 704 setSweepRequested(); | 704 setSweepRequested(); |
| 705 } | 705 } |
| 706 | 706 |
| 707 BaseHeapPage* ThreadState::heapPageFromAddress(Address address) | 707 BaseHeapPage* ThreadState::heapPageFromAddress(Address address) |
| 708 { | 708 { |
| 709 BaseHeapPage* cachedPage = heapContainsCache()->lookup(address); | 709 BaseHeapPage* cachedPage = heapContainsCache()->lookup(address); |
| 710 #ifdef NDEBUG | 710 #if !ENABLE(ASSERT) |
| 711 if (cachedPage) | 711 if (cachedPage) |
| 712 return cachedPage; | 712 return cachedPage; |
| 713 #endif | 713 #endif |
| 714 | 714 |
| 715 for (int i = 0; i < NumberOfHeaps; i++) { | 715 for (int i = 0; i < NumberOfHeaps; i++) { |
| 716 BaseHeapPage* page = m_heaps[i]->heapPageFromAddress(address); | 716 BaseHeapPage* page = m_heaps[i]->heapPageFromAddress(address); |
| 717 if (page) { | 717 if (page) { |
| 718 // Asserts that make sure heapPageFromAddress takes addresses from | 718 // Asserts that make sure heapPageFromAddress takes addresses from |
| 719 // the whole aligned blinkPageSize memory area. This is necessary | 719 // the whole aligned blinkPageSize memory area. This is necessary |
| 720 // for the negative cache to work. | 720 // for the negative cache to work. |
| 721 ASSERT(page->isLargeObject() || page == m_heaps[i]->heapPageFromAddr
ess(roundToBlinkPageStart(address))); | 721 ASSERT(page->isLargeObject() || page == m_heaps[i]->heapPageFromAddr
ess(roundToBlinkPageStart(address))); |
| 722 if (roundToBlinkPageStart(address) != roundToBlinkPageEnd(address)) | 722 if (roundToBlinkPageStart(address) != roundToBlinkPageEnd(address)) |
| 723 ASSERT(page->isLargeObject() || page == m_heaps[i]->heapPageFrom
Address(roundToBlinkPageEnd(address) - 1)); | 723 ASSERT(page->isLargeObject() || page == m_heaps[i]->heapPageFrom
Address(roundToBlinkPageEnd(address) - 1)); |
| 724 ASSERT(!cachedPage || page == cachedPage); | 724 ASSERT(!cachedPage || page == cachedPage); |
| 725 if (!cachedPage) | 725 if (!cachedPage) |
| 726 heapContainsCache()->addEntry(address, page); | 726 heapContainsCache()->addEntry(address, page); |
| 727 return page; | 727 return page; |
| 728 } | 728 } |
| 729 } | 729 } |
| 730 ASSERT(!cachedPage); | 730 ASSERT(!cachedPage); |
| 731 return 0; | 731 return 0; |
| 732 } | 732 } |
| 733 | 733 |
| 734 void ThreadState::getStats(HeapStats& stats) | 734 void ThreadState::getStats(HeapStats& stats) |
| 735 { | 735 { |
| 736 stats = m_stats; | 736 stats = m_stats; |
| 737 #ifndef NDEBUG | 737 #if ENABLE(ASSERT) |
| 738 if (isConsistentForGC()) { | 738 if (isConsistentForGC()) { |
| 739 HeapStats scannedStats; | 739 HeapStats scannedStats; |
| 740 scannedStats.clear(); | 740 scannedStats.clear(); |
| 741 for (int i = 0; i < NumberOfHeaps; i++) | 741 for (int i = 0; i < NumberOfHeaps; i++) |
| 742 m_heaps[i]->getScannedStats(scannedStats); | 742 m_heaps[i]->getScannedStats(scannedStats); |
| 743 ASSERT(scannedStats == stats); | 743 ASSERT(scannedStats == stats); |
| 744 } | 744 } |
| 745 #endif | 745 #endif |
| 746 } | 746 } |
| 747 | 747 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 threadAttachMutex().unlock(); | 925 threadAttachMutex().unlock(); |
| 926 return gcInfo; | 926 return gcInfo; |
| 927 } | 927 } |
| 928 } | 928 } |
| 929 if (needLockForIteration) | 929 if (needLockForIteration) |
| 930 threadAttachMutex().unlock(); | 930 threadAttachMutex().unlock(); |
| 931 return 0; | 931 return 0; |
| 932 } | 932 } |
| 933 #endif | 933 #endif |
| 934 } | 934 } |
| OLD | NEW |