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

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

Issue 2127453002: Oilpan: Introduce memory pool for CallbackStacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 ASSERT(m_heap); 129 ASSERT(m_heap);
130 m_heap->attach(this); 130 m_heap->attach(this);
131 131
132 for (int arenaIndex = 0; arenaIndex < BlinkGC::LargeObjectArenaIndex; arenaI ndex++) 132 for (int arenaIndex = 0; arenaIndex < BlinkGC::LargeObjectArenaIndex; arenaI ndex++)
133 m_arenas[arenaIndex] = new NormalPageArena(this, arenaIndex); 133 m_arenas[arenaIndex] = new NormalPageArena(this, arenaIndex);
134 m_arenas[BlinkGC::LargeObjectArenaIndex] = new LargeObjectArena(this, BlinkG C::LargeObjectArenaIndex); 134 m_arenas[BlinkGC::LargeObjectArenaIndex] = new LargeObjectArena(this, BlinkG C::LargeObjectArenaIndex);
135 135
136 m_likelyToBePromptlyFreed = wrapArrayUnique(new int[likelyToBePromptlyFreedA rraySize]); 136 m_likelyToBePromptlyFreed = wrapArrayUnique(new int[likelyToBePromptlyFreedA rraySize]);
137 clearArenaAges(); 137 clearArenaAges();
138 138
139 // There is little use of weak references and collections off the main threa d; 139 m_threadLocalWeakCallbackStack = new CallbackStack();
140 // use a much lower initial block reservation.
141 size_t initialBlockSize = isMainThread() ? CallbackStack::kDefaultBlockSize : CallbackStack::kMinimalBlockSize;
142 m_threadLocalWeakCallbackStack = new CallbackStack(initialBlockSize);
143 } 140 }
144 141
145 ThreadState::~ThreadState() 142 ThreadState::~ThreadState()
146 { 143 {
147 ASSERT(checkThread()); 144 ASSERT(checkThread());
148 delete m_threadLocalWeakCallbackStack; 145 delete m_threadLocalWeakCallbackStack;
149 m_threadLocalWeakCallbackStack = nullptr; 146 m_threadLocalWeakCallbackStack = nullptr;
150 for (int i = 0; i < BlinkGC::NumberOfArenas; ++i) 147 for (int i = 0; i < BlinkGC::NumberOfArenas; ++i)
151 delete m_arenas[i]; 148 delete m_arenas[i];
152 149
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 // safepoint barrier mutexes etc, which can additionally delay 953 // safepoint barrier mutexes etc, which can additionally delay
957 // a thread. Enough so that another thread may initiate 954 // a thread. Enough so that another thread may initiate
958 // a new GC before this has happened. 955 // a new GC before this has happened.
959 // 956 //
960 // In which case the parked thread's ThreadState will have unprocessed 957 // In which case the parked thread's ThreadState will have unprocessed
961 // entries on its local weak callback stack when that later GC goes 958 // entries on its local weak callback stack when that later GC goes
962 // ahead. Clear out and invalidate the stack now, as the thread 959 // ahead. Clear out and invalidate the stack now, as the thread
963 // should only process callbacks that's found to be reachable by 960 // should only process callbacks that's found to be reachable by
964 // the latest GC, when it eventually gets to next perform 961 // the latest GC, when it eventually gets to next perform
965 // thread-local weak processing. 962 // thread-local weak processing.
966 m_threadLocalWeakCallbackStack->clear(); 963 m_threadLocalWeakCallbackStack->decommit();
sof 2016/07/05 14:19:02 Naming this clear() or reset() would be clearer, p
haraken 2016/07/06 01:58:11 We're already calling decommit() at the end of Thr
sof 2016/07/06 13:22:17 Ah, of course we already are; good.
964 m_threadLocalWeakCallbackStack->commit();
967 } 965 }
968 966
969 void ThreadState::postGC(BlinkGC::GCType gcType) 967 void ThreadState::postGC(BlinkGC::GCType gcType)
970 { 968 {
971 if (RuntimeEnabledFeatures::traceWrappablesEnabled() 969 if (RuntimeEnabledFeatures::traceWrappablesEnabled()
972 && m_invalidateDeadObjectsInWrappersMarkingDeque) { 970 && m_invalidateDeadObjectsInWrappersMarkingDeque) {
973 m_invalidateDeadObjectsInWrappersMarkingDeque(m_isolate); 971 m_invalidateDeadObjectsInWrappersMarkingDeque(m_isolate);
974 } 972 }
975 973
976 ASSERT(isInGC()); 974 ASSERT(isInGC());
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 threadDump->AddScalar("dead_count", "objects", totalDeadCount); 1531 threadDump->AddScalar("dead_count", "objects", totalDeadCount);
1534 threadDump->AddScalar("live_size", "bytes", totalLiveSize); 1532 threadDump->AddScalar("live_size", "bytes", totalLiveSize);
1535 threadDump->AddScalar("dead_size", "bytes", totalDeadSize); 1533 threadDump->AddScalar("dead_size", "bytes", totalDeadSize);
1536 1534
1537 base::trace_event::MemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvide r::instance()->createMemoryAllocatorDumpForCurrentGC(heapsDumpName); 1535 base::trace_event::MemoryAllocatorDump* heapsDump = BlinkGCMemoryDumpProvide r::instance()->createMemoryAllocatorDumpForCurrentGC(heapsDumpName);
1538 base::trace_event::MemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvi der::instance()->createMemoryAllocatorDumpForCurrentGC(classesDumpName); 1536 base::trace_event::MemoryAllocatorDump* classesDump = BlinkGCMemoryDumpProvi der::instance()->createMemoryAllocatorDumpForCurrentGC(classesDumpName);
1539 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->AddOwners hipEdge(classesDump->guid(), heapsDump->guid()); 1537 BlinkGCMemoryDumpProvider::instance()->currentProcessMemoryDump()->AddOwners hipEdge(classesDump->guid(), heapsDump->guid());
1540 } 1538 }
1541 1539
1542 } // namespace blink 1540 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698