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

Side by Side Diff: third_party/WebKit/Source/platform/heap/HeapPage.cpp

Issue 2871123005: Fix compilation of heap compaction debug diagnostics code. (Closed)
Patch Set: revert debug settings back to disabled Created 3 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapCompact.cpp ('k') | no next file » | 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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 payload + allocation_point, freed_size); 525 payload + allocation_point, freed_size);
526 } 526 }
527 } 527 }
528 528
529 // Return available pages to the free page pool, decommitting them from 529 // Return available pages to the free page pool, decommitting them from
530 // the pagefile. 530 // the pagefile.
531 BasePage* available_pages = context.available_pages_; 531 BasePage* available_pages = context.available_pages_;
532 while (available_pages) { 532 while (available_pages) {
533 size_t page_size = available_pages->size(); 533 size_t page_size = available_pages->size();
534 #if DEBUG_HEAP_COMPACTION 534 #if DEBUG_HEAP_COMPACTION
535 if (!freedPageCount) 535 if (!freed_page_count)
536 LOG_HEAP_COMPACTION("Releasing:"); 536 LOG_HEAP_COMPACTION("Releasing:");
537 LOG_HEAP_COMPACTION(" [%p, %p]", availablePages, availablePages + pageSize); 537 LOG_HEAP_COMPACTION(" [%p, %p]", available_pages,
538 available_pages + page_size);
538 #endif 539 #endif
539 freed_size += page_size; 540 freed_size += page_size;
540 freed_page_count++; 541 freed_page_count++;
541 BasePage* next_page; 542 BasePage* next_page;
542 available_pages->Unlink(&next_page); 543 available_pages->Unlink(&next_page);
543 #if !(DCHECK_IS_ON() || defined(LEAK_SANITIZER) || \ 544 #if !(DCHECK_IS_ON() || defined(LEAK_SANITIZER) || \
544 defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER)) 545 defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER))
545 // Clear out the page before adding it to the free page pool, which 546 // Clear out the page before adding it to the free page pool, which
546 // decommits it. Recommitting the page must find a zeroed page later. 547 // decommits it. Recommitting the page must find a zeroed page later.
547 // We cannot assume that the OS will hand back a zeroed page across 548 // We cannot assume that the OS will hand back a zeroed page across
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
1182 size_t FreeList::FreeListSize() const { 1183 size_t FreeList::FreeListSize() const {
1183 size_t free_size = 0; 1184 size_t free_size = 0;
1184 for (unsigned i = 0; i < kBlinkPageSizeLog2; ++i) { 1185 for (unsigned i = 0; i < kBlinkPageSizeLog2; ++i) {
1185 FreeListEntry* entry = free_lists_[i]; 1186 FreeListEntry* entry = free_lists_[i];
1186 while (entry) { 1187 while (entry) {
1187 free_size += entry->size(); 1188 free_size += entry->size();
1188 entry = entry->Next(); 1189 entry = entry->Next();
1189 } 1190 }
1190 } 1191 }
1191 #if DEBUG_HEAP_FREELIST 1192 #if DEBUG_HEAP_FREELIST
1192 if (freeSize) { 1193 if (free_size) {
1193 LOG_HEAP_FREELIST_VERBOSE("FreeList(%p): %zu\n", this, freeSize); 1194 LOG_HEAP_FREELIST_VERBOSE("FreeList(%p): %zu\n", this, free_size);
1194 for (unsigned i = 0; i < blinkPageSizeLog2; ++i) { 1195 for (unsigned i = 0; i < kBlinkPageSizeLog2; ++i) {
1195 FreeListEntry* entry = m_freeLists[i]; 1196 FreeListEntry* entry = free_lists_[i];
1196 size_t bucket = 0; 1197 size_t bucket = 0;
1197 size_t count = 0; 1198 size_t count = 0;
1198 while (entry) { 1199 while (entry) {
1199 bucket += entry->size(); 1200 bucket += entry->size();
1200 count++; 1201 count++;
1201 entry = entry->next(); 1202 entry = entry->Next();
1202 } 1203 }
1203 if (bucket) { 1204 if (bucket) {
1204 LOG_HEAP_FREELIST_VERBOSE("[%d, %d]: %zu (%zu)\n", 0x1 << i, 1205 LOG_HEAP_FREELIST_VERBOSE("[%d, %d]: %zu (%zu)\n", 0x1 << i,
1205 0x1 << (i + 1), bucket, count); 1206 0x1 << (i + 1), bucket, count);
1206 } 1207 }
1207 } 1208 }
1208 } 1209 }
1209 #endif 1210 #endif
1210 return free_size; 1211 return free_size;
1211 } 1212 }
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 1840
1840 has_entries_ = true; 1841 has_entries_ = true;
1841 size_t index = GetHash(address); 1842 size_t index = GetHash(address);
1842 DCHECK(!(index & 1)); 1843 DCHECK(!(index & 1));
1843 Address cache_page = RoundToBlinkPageStart(address); 1844 Address cache_page = RoundToBlinkPageStart(address);
1844 entries_[index + 1] = entries_[index]; 1845 entries_[index + 1] = entries_[index];
1845 entries_[index] = cache_page; 1846 entries_[index] = cache_page;
1846 } 1847 }
1847 1848
1848 } // namespace blink 1849 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapCompact.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698