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

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

Issue 1149673002: Adding blink gc memory dump infrastructure for thread specific dumps. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Making changes for forced GC. Created 5 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
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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 bool disabledByDefaultGCTracingEnabled; 871 bool disabledByDefaultGCTracingEnabled;
872 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink_gc") , &disabledByDefaultGCTracingEnabled); 872 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink_gc") , &disabledByDefaultGCTracingEnabled);
873 873
874 snapshot(); 874 snapshot();
875 if (disabledByDefaultGCTracingEnabled) 875 if (disabledByDefaultGCTracingEnabled)
876 collectAndReportMarkSweepStats(); 876 collectAndReportMarkSweepStats();
877 incrementMarkedObjectsAge(); 877 incrementMarkedObjectsAge();
878 } 878 }
879 #endif 879 #endif
880 880
881 if (gcType == TakeSnapshot)
882 takeSnapshot();
883
881 for (int i = 0; i < NumberOfHeaps; i++) 884 for (int i = 0; i < NumberOfHeaps; i++)
882 m_heaps[i]->prepareForSweep(); 885 m_heaps[i]->prepareForSweep();
883 886
884 if (gcType == GCWithSweep) { 887 if (gcType == GCWithSweep) {
885 setGCState(EagerSweepScheduled); 888 setGCState(EagerSweepScheduled);
886 } else if (gcType == GCWithoutSweep) { 889 } else if (gcType == GCWithoutSweep) {
887 setGCState(LazySweepScheduled); 890 setGCState(LazySweepScheduled);
888 } else { 891 } else {
889 takeSnapshot();
890 // This unmarks all marked objects and marks all unmarked objects dead. 892 // This unmarks all marked objects and marks all unmarked objects dead.
891 makeConsistentForSweeping(gcType); 893 makeConsistentForSweeping(gcType);
892 // Force setting NoGCScheduled to circumvent checkThread() 894 // Force setting NoGCScheduled to circumvent checkThread()
893 // in setGCState(). 895 // in setGCState().
894 m_gcState = NoGCScheduled; 896 m_gcState = NoGCScheduled;
895 } 897 }
896 } 898 }
897 899
898 void ThreadState::preSweep() 900 void ThreadState::preSweep()
899 { 901 {
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 void ThreadState::promptlyFreed(size_t gcInfoIndex) 1275 void ThreadState::promptlyFreed(size_t gcInfoIndex)
1274 { 1276 {
1275 size_t entryIndex = gcInfoIndex & likelyToBePromptlyFreedArrayMask; 1277 size_t entryIndex = gcInfoIndex & likelyToBePromptlyFreedArrayMask;
1276 // See the comment in vectorBackingHeap() for why this is +3. 1278 // See the comment in vectorBackingHeap() for why this is +3.
1277 m_likelyToBePromptlyFreed[entryIndex] += 3; 1279 m_likelyToBePromptlyFreed[entryIndex] += 3;
1278 } 1280 }
1279 1281
1280 void ThreadState::takeSnapshot() 1282 void ThreadState::takeSnapshot()
1281 { 1283 {
1282 ASSERT(isInGC()); 1284 ASSERT(isInGC());
1283 // TODO(ssid): Implement this. 1285
1286 #define SNAPSHOT_HEAP(HeapType) \
1287 { \
1288 String allocatorBaseName; \
1289 if (isMainThread()) { \
1290 allocatorBaseName = String("blink_gc/thread_main/heaps/" #HeapType); \
1291 } \
1292 else { \
1293 allocatorBaseName = String::format("blink_gc/thread_%ld/heaps/" #Hea pType, m_thread); \
1294 } \
1295 m_heaps[HeapType##HeapIndex]->takeSnapshot(allocatorBaseName); \
1296 }
1297
1298 SNAPSHOT_HEAP(NormalPage1);
1299 SNAPSHOT_HEAP(NormalPage2);
1300 SNAPSHOT_HEAP(NormalPage3);
1301 SNAPSHOT_HEAP(NormalPage4);
1302 SNAPSHOT_HEAP(EagerSweep);
1303 SNAPSHOT_HEAP(Vector1);
1304 SNAPSHOT_HEAP(Vector2);
1305 SNAPSHOT_HEAP(Vector3);
1306 SNAPSHOT_HEAP(Vector4);
1307 SNAPSHOT_HEAP(InlineVector);
1308 SNAPSHOT_HEAP(HashTable);
1309 SNAPSHOT_HEAP(LargeObject);
1310 FOR_EACH_TYPED_HEAP(SNAPSHOT_HEAP);
1311
1312 #undef SNAPSHOT_HEAP
1284 } 1313 }
1285 1314
1286 #if ENABLE(GC_PROFILING) 1315 #if ENABLE(GC_PROFILING)
1287 const GCInfo* ThreadState::findGCInfoFromAllThreads(Address address) 1316 const GCInfo* ThreadState::findGCInfoFromAllThreads(Address address)
1288 { 1317 {
1289 bool needLockForIteration = !ThreadState::current()->isInGC(); 1318 bool needLockForIteration = !ThreadState::current()->isInGC();
1290 if (needLockForIteration) 1319 if (needLockForIteration)
1291 threadAttachMutex().lock(); 1320 threadAttachMutex().lock();
1292 1321
1293 for (ThreadState* state : attachedThreads()) { 1322 for (ThreadState* state : attachedThreads()) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 json->beginArray(it->key.ascii().data()); 1395 json->beginArray(it->key.ascii().data());
1367 for (size_t age = 0; age <= maxHeapObjectAge; ++age) 1396 for (size_t age = 0; age <= maxHeapObjectAge; ++age)
1368 json->pushInteger(it->value.ages[age]); 1397 json->pushInteger(it->value.ages[age]);
1369 json->endArray(); 1398 json->endArray();
1370 } 1399 }
1371 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release()); 1400 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release());
1372 } 1401 }
1373 #endif 1402 #endif
1374 1403
1375 } // namespace blink 1404 } // namespace blink
OLDNEW
« Source/platform/heap/BlinkGCMemoryDumpProvider.cpp ('K') | « Source/platform/heap/Heap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698