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

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

Issue 2652923002: Devirtualize Visitor and remove inline visitor specialization. (Closed)
Patch Set: rebased Created 3 years, 10 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
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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "platform/heap/HeapPage.h" 31 #include "platform/heap/HeapPage.h"
32 32
33 #include "base/trace_event/process_memory_dump.h" 33 #include "base/trace_event/process_memory_dump.h"
34 #include "platform/MemoryCoordinator.h" 34 #include "platform/MemoryCoordinator.h"
35 #include "platform/ScriptForbiddenScope.h" 35 #include "platform/ScriptForbiddenScope.h"
36 #include "platform/heap/BlinkGCMemoryDumpProvider.h" 36 #include "platform/heap/BlinkGCMemoryDumpProvider.h"
37 #include "platform/heap/CallbackStack.h" 37 #include "platform/heap/CallbackStack.h"
38 #include "platform/heap/HeapCompact.h" 38 #include "platform/heap/HeapCompact.h"
39 #include "platform/heap/MarkingVisitor.h"
40 #include "platform/heap/PageMemory.h" 39 #include "platform/heap/PageMemory.h"
41 #include "platform/heap/PagePool.h" 40 #include "platform/heap/PagePool.h"
42 #include "platform/heap/SafePoint.h" 41 #include "platform/heap/SafePoint.h"
43 #include "platform/heap/ThreadState.h" 42 #include "platform/heap/ThreadState.h"
44 #include "platform/instrumentation/tracing/TraceEvent.h" 43 #include "platform/instrumentation/tracing/TraceEvent.h"
45 #include "platform/instrumentation/tracing/web_memory_allocator_dump.h" 44 #include "platform/instrumentation/tracing/web_memory_allocator_dump.h"
46 #include "platform/instrumentation/tracing/web_process_memory_dump.h" 45 #include "platform/instrumentation/tracing/web_process_memory_dump.h"
47 #include "public/platform/Platform.h" 46 #include "public/platform/Platform.h"
48 #include "wtf/Assertions.h" 47 #include "wtf/Assertions.h"
49 #include "wtf/AutoReset.h" 48 #include "wtf/AutoReset.h"
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 // has not yet been initialized. In this case, we should mark the A 1692 // has not yet been initialized. In this case, we should mark the A
1694 // object without tracing any member of the A object. 1693 // object without tracing any member of the A object.
1695 visitor->markHeaderNoTracing(header); 1694 visitor->markHeaderNoTracing(header);
1696 ASSERT(isUninitializedMemory(header->payload(), header->payloadSize())); 1695 ASSERT(isUninitializedMemory(header->payload(), header->payloadSize()));
1697 } else { 1696 } else {
1698 visitor->markHeader(header, gcInfo->m_trace); 1697 visitor->markHeader(header, gcInfo->m_trace);
1699 } 1698 }
1700 } 1699 }
1701 1700
1702 void NormalPage::checkAndMarkPointer(Visitor* visitor, Address address) { 1701 void NormalPage::checkAndMarkPointer(Visitor* visitor, Address address) {
1703 ASSERT(contains(address)); 1702 #if DCHECK_IS_ON()
1703 DCHECK(contains(address));
1704 #endif
1704 HeapObjectHeader* header = findHeaderFromAddress(address); 1705 HeapObjectHeader* header = findHeaderFromAddress(address);
1705 if (!header || header->isDead()) 1706 if (!header || header->isDead())
1706 return; 1707 return;
1707 markPointer(visitor, header); 1708 markPointer(visitor, header);
1708 } 1709 }
1709 1710
1711 #if DCHECK_IS_ON()
1712 void NormalPage::checkAndMarkPointer(Visitor* visitor,
1713 Address address,
1714 MarkedPointerCallbackForTesting callback) {
1715 DCHECK(contains(address));
1716 HeapObjectHeader* header = findHeaderFromAddress(address);
1717 if (!header || header->isDead())
1718 return;
1719 if (!callback(header))
1720 markPointer(visitor, header);
1721 }
1722 #endif
1723
1710 void NormalPage::markOrphaned() { 1724 void NormalPage::markOrphaned() {
1711 // Zap the payload with a recognizable value to detect any incorrect 1725 // Zap the payload with a recognizable value to detect any incorrect
1712 // cross thread pointer usage. 1726 // cross thread pointer usage.
1713 #if defined(ADDRESS_SANITIZER) 1727 #if defined(ADDRESS_SANITIZER)
1714 // This needs to zap poisoned memory as well. 1728 // This needs to zap poisoned memory as well.
1715 // Force unpoison memory before memset. 1729 // Force unpoison memory before memset.
1716 ASAN_UNPOISON_MEMORY_REGION(payload(), payloadSize()); 1730 ASAN_UNPOISON_MEMORY_REGION(payload(), payloadSize());
1717 #endif 1731 #endif
1718 OrphanedPagePool::asanDisabledMemset( 1732 OrphanedPagePool::asanDisabledMemset(
1719 payload(), OrphanedPagePool::orphanedZapValue, payloadSize()); 1733 payload(), OrphanedPagePool::orphanedZapValue, payloadSize());
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 1834
1821 #if defined(ADDRESS_SANITIZER) 1835 #if defined(ADDRESS_SANITIZER)
1822 void LargeObjectPage::poisonUnmarkedObjects() { 1836 void LargeObjectPage::poisonUnmarkedObjects() {
1823 HeapObjectHeader* header = heapObjectHeader(); 1837 HeapObjectHeader* header = heapObjectHeader();
1824 if (!header->isMarked()) 1838 if (!header->isMarked())
1825 ASAN_POISON_MEMORY_REGION(header->payload(), header->payloadSize()); 1839 ASAN_POISON_MEMORY_REGION(header->payload(), header->payloadSize());
1826 } 1840 }
1827 #endif 1841 #endif
1828 1842
1829 void LargeObjectPage::checkAndMarkPointer(Visitor* visitor, Address address) { 1843 void LargeObjectPage::checkAndMarkPointer(Visitor* visitor, Address address) {
1830 ASSERT(contains(address)); 1844 #if DCHECK_IS_ON()
1845 DCHECK(contains(address));
1846 #endif
1831 if (!containedInObjectPayload(address) || heapObjectHeader()->isDead()) 1847 if (!containedInObjectPayload(address) || heapObjectHeader()->isDead())
1832 return; 1848 return;
1833 markPointer(visitor, heapObjectHeader()); 1849 markPointer(visitor, heapObjectHeader());
1834 } 1850 }
1835 1851
1852 #if DCHECK_IS_ON()
1853 void LargeObjectPage::checkAndMarkPointer(
1854 Visitor* visitor,
1855 Address address,
1856 MarkedPointerCallbackForTesting callback) {
1857 DCHECK(contains(address));
1858 if (!containedInObjectPayload(address) || heapObjectHeader()->isDead())
1859 return;
1860 if (!callback(heapObjectHeader()))
1861 markPointer(visitor, heapObjectHeader());
1862 }
1863 #endif
1864
1836 void LargeObjectPage::markOrphaned() { 1865 void LargeObjectPage::markOrphaned() {
1837 // Zap the payload with a recognizable value to detect any incorrect 1866 // Zap the payload with a recognizable value to detect any incorrect
1838 // cross thread pointer usage. 1867 // cross thread pointer usage.
1839 OrphanedPagePool::asanDisabledMemset( 1868 OrphanedPagePool::asanDisabledMemset(
1840 payload(), OrphanedPagePool::orphanedZapValue, payloadSize()); 1869 payload(), OrphanedPagePool::orphanedZapValue, payloadSize());
1841 BasePage::markOrphaned(); 1870 BasePage::markOrphaned();
1842 } 1871 }
1843 1872
1844 void LargeObjectPage::takeSnapshot( 1873 void LargeObjectPage::takeSnapshot(
1845 base::trace_event::MemoryAllocatorDump* pageDump, 1874 base::trace_event::MemoryAllocatorDump* pageDump,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 1940
1912 m_hasEntries = true; 1941 m_hasEntries = true;
1913 size_t index = hash(address); 1942 size_t index = hash(address);
1914 ASSERT(!(index & 1)); 1943 ASSERT(!(index & 1));
1915 Address cachePage = roundToBlinkPageStart(address); 1944 Address cachePage = roundToBlinkPageStart(address);
1916 m_entries[index + 1] = m_entries[index]; 1945 m_entries[index + 1] = m_entries[index];
1917 m_entries[index] = cachePage; 1946 m_entries[index] = cachePage;
1918 } 1947 }
1919 1948
1920 } // namespace blink 1949 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapPage.h ('k') | third_party/WebKit/Source/platform/heap/HeapTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698