Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: Source/platform/heap/ThreadState.cpp

Issue 397733004: Allow assertions to be enabled in Blink Release builds. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/platform/heap/Visitor.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « Source/platform/heap/HeapTest.cpp ('k') | Source/platform/heap/Visitor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698