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

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: Rebase and replacing main thread with thread id. Created 5 years, 6 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 | « Source/platform/heap/Heap.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 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 void ThreadState::promptlyFreed(size_t gcInfoIndex) 1369 void ThreadState::promptlyFreed(size_t gcInfoIndex)
1370 { 1370 {
1371 size_t entryIndex = gcInfoIndex & likelyToBePromptlyFreedArrayMask; 1371 size_t entryIndex = gcInfoIndex & likelyToBePromptlyFreedArrayMask;
1372 // See the comment in vectorBackingHeap() for why this is +3. 1372 // See the comment in vectorBackingHeap() for why this is +3.
1373 m_likelyToBePromptlyFreed[entryIndex] += 3; 1373 m_likelyToBePromptlyFreed[entryIndex] += 3;
1374 } 1374 }
1375 1375
1376 void ThreadState::takeSnapshot() 1376 void ThreadState::takeSnapshot()
1377 { 1377 {
1378 ASSERT(isInGC()); 1378 ASSERT(isInGC());
1379 // TODO(ssid): Implement this. 1379
1380 int numberOfHeapsReported = 0;
1381 #define SNAPSHOT_HEAP(HeapType) \
1382 { \
1383 numberOfHeapsReported++; \
1384 String allocatorBaseName; \
1385 allocatorBaseName = String::format("blink_gc/thread_%lu/heaps/" #HeapTyp e, (unsigned long)(m_thread)); \
1386 m_heaps[HeapType##HeapIndex]->takeSnapshot(allocatorBaseName); \
1387 }
1388
1389 SNAPSHOT_HEAP(NormalPage1);
1390 SNAPSHOT_HEAP(NormalPage2);
1391 SNAPSHOT_HEAP(NormalPage3);
1392 SNAPSHOT_HEAP(NormalPage4);
1393 SNAPSHOT_HEAP(EagerSweep);
1394 SNAPSHOT_HEAP(Vector1);
1395 SNAPSHOT_HEAP(Vector2);
1396 SNAPSHOT_HEAP(Vector3);
1397 SNAPSHOT_HEAP(Vector4);
1398 SNAPSHOT_HEAP(InlineVector);
1399 SNAPSHOT_HEAP(HashTable);
1400 SNAPSHOT_HEAP(LargeObject);
1401 FOR_EACH_TYPED_HEAP(SNAPSHOT_HEAP);
1402
1403 ASSERT(numberOfHeapsReported == NumberOfHeaps);
1404
1405 #undef SNAPSHOT_HEAP
1380 } 1406 }
1381 1407
1382 #if ENABLE(GC_PROFILING) 1408 #if ENABLE(GC_PROFILING)
1383 const GCInfo* ThreadState::findGCInfoFromAllThreads(Address address) 1409 const GCInfo* ThreadState::findGCInfoFromAllThreads(Address address)
1384 { 1410 {
1385 bool needLockForIteration = !ThreadState::current()->isInGC(); 1411 bool needLockForIteration = !ThreadState::current()->isInGC();
1386 if (needLockForIteration) 1412 if (needLockForIteration)
1387 threadAttachMutex().lock(); 1413 threadAttachMutex().lock();
1388 1414
1389 for (ThreadState* state : attachedThreads()) { 1415 for (ThreadState* state : attachedThreads()) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 json->beginArray(it->key.ascii().data()); 1495 json->beginArray(it->key.ascii().data());
1470 for (size_t age = 0; age <= maxHeapObjectAge; ++age) 1496 for (size_t age = 0; age <= maxHeapObjectAge; ++age)
1471 json->pushInteger(it->value.ages[age]); 1497 json->pushInteger(it->value.ages[age]);
1472 json->endArray(); 1498 json->endArray();
1473 } 1499 }
1474 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release()); 1500 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s tatsName, this, json.release());
1475 } 1501 }
1476 #endif 1502 #endif
1477 1503
1478 } // namespace blink 1504 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/heap/Heap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698