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

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

Issue 2518273003: [Blink Heap] Move isLowEndDevice to Memory Coordinator, attempt #3 (Closed)
Patch Set: Created 4 years 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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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/ScriptForbiddenScope.h" 35 #include "platform/ScriptForbiddenScope.h"
35 #include "platform/heap/BlinkGCMemoryDumpProvider.h" 36 #include "platform/heap/BlinkGCMemoryDumpProvider.h"
36 #include "platform/heap/CallbackStack.h" 37 #include "platform/heap/CallbackStack.h"
37 #include "platform/heap/Heap.h"
38 #include "platform/heap/MarkingVisitor.h" 38 #include "platform/heap/MarkingVisitor.h"
39 #include "platform/heap/PageMemory.h" 39 #include "platform/heap/PageMemory.h"
40 #include "platform/heap/PagePool.h" 40 #include "platform/heap/PagePool.h"
41 #include "platform/heap/SafePoint.h" 41 #include "platform/heap/SafePoint.h"
42 #include "platform/heap/ThreadState.h" 42 #include "platform/heap/ThreadState.h"
43 #include "platform/tracing/TraceEvent.h" 43 #include "platform/tracing/TraceEvent.h"
44 #include "platform/tracing/web_memory_allocator_dump.h" 44 #include "platform/tracing/web_memory_allocator_dump.h"
45 #include "platform/tracing/web_process_memory_dump.h" 45 #include "platform/tracing/web_process_memory_dump.h"
46 #include "public/platform/Platform.h" 46 #include "public/platform/Platform.h"
47 #include "wtf/Assertions.h" 47 #include "wtf/Assertions.h"
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 // that memory on the freelist is zero filled. 1218 // that memory on the freelist is zero filled.
1219 SET_MEMORY_INACCESSIBLE(headerAddress, size); 1219 SET_MEMORY_INACCESSIBLE(headerAddress, size);
1220 headerAddress += size; 1220 headerAddress += size;
1221 continue; 1221 continue;
1222 } 1222 }
1223 if (startOfGap != headerAddress) { 1223 if (startOfGap != headerAddress) {
1224 pageArena->addToFreeList(startOfGap, headerAddress - startOfGap); 1224 pageArena->addToFreeList(startOfGap, headerAddress - startOfGap);
1225 #if !ENABLE(ASSERT) && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER) 1225 #if !ENABLE(ASSERT) && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER)
1226 // Discarding pages increases page faults and may regress performance. 1226 // Discarding pages increases page faults and may regress performance.
1227 // So we enable this only on low-RAM devices. 1227 // So we enable this only on low-RAM devices.
1228 if (ProcessHeap::isLowEndDevice()) 1228 if (MemoryCoordinator::isLowEndDevice())
1229 discardPages(startOfGap + sizeof(FreeListEntry), headerAddress); 1229 discardPages(startOfGap + sizeof(FreeListEntry), headerAddress);
1230 #endif 1230 #endif
1231 } 1231 }
1232 header->unmark(); 1232 header->unmark();
1233 headerAddress += size; 1233 headerAddress += size;
1234 markedObjectSize += size; 1234 markedObjectSize += size;
1235 startOfGap = headerAddress; 1235 startOfGap = headerAddress;
1236 } 1236 }
1237 if (startOfGap != payloadEnd()) { 1237 if (startOfGap != payloadEnd()) {
1238 pageArena->addToFreeList(startOfGap, payloadEnd() - startOfGap); 1238 pageArena->addToFreeList(startOfGap, payloadEnd() - startOfGap);
1239 #if !ENABLE(ASSERT) && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER) 1239 #if !ENABLE(ASSERT) && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER)
1240 if (ProcessHeap::isLowEndDevice()) 1240 if (MemoryCoordinator::isLowEndDevice())
1241 discardPages(startOfGap + sizeof(FreeListEntry), payloadEnd()); 1241 discardPages(startOfGap + sizeof(FreeListEntry), payloadEnd());
1242 #endif 1242 #endif
1243 } 1243 }
1244 1244
1245 if (markedObjectSize) 1245 if (markedObjectSize)
1246 pageArena->getThreadState()->increaseMarkedObjectSize(markedObjectSize); 1246 pageArena->getThreadState()->increaseMarkedObjectSize(markedObjectSize);
1247 } 1247 }
1248 1248
1249 void NormalPage::makeConsistentForGC() { 1249 void NormalPage::makeConsistentForGC() {
1250 size_t markedObjectSize = 0; 1250 size_t markedObjectSize = 0;
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 1631
1632 m_hasEntries = true; 1632 m_hasEntries = true;
1633 size_t index = hash(address); 1633 size_t index = hash(address);
1634 ASSERT(!(index & 1)); 1634 ASSERT(!(index & 1));
1635 Address cachePage = roundToBlinkPageStart(address); 1635 Address cachePage = roundToBlinkPageStart(address);
1636 m_entries[index + 1] = m_entries[index]; 1636 m_entries[index + 1] = m_entries[index];
1637 m_entries[index] = cachePage; 1637 m_entries[index] = cachePage;
1638 } 1638 }
1639 1639
1640 } // namespace blink 1640 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698