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

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: Fixed config.gni. Minor cleanups. 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
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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698