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

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

Issue 337653002: Oilpan: GC_TRACING: Improve object path dump (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Backtrace Created 6 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 | Annotate | Revision Log
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 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 fprintf(stderr, "%ld", *it); 1465 fprintf(stderr, "%ld", *it);
1466 if (--count) 1466 if (--count)
1467 fprintf(stderr, ", "); 1467 fprintf(stderr, ", ");
1468 } 1468 }
1469 ASSERT(!count); 1469 ASSERT(!count);
1470 fprintf(stderr, "}"); 1470 fprintf(stderr, "}");
1471 } 1471 }
1472 1472
1473 static void dumpPathToObjectFromObjectGraph(const ObjectGraph& graph, uintpt r_t target) 1473 static void dumpPathToObjectFromObjectGraph(const ObjectGraph& graph, uintpt r_t target)
1474 { 1474 {
1475 ObjectGraph::const_iterator it = graph.find(target);
1476 if (it == graph.end())
1477 return;
1475 fprintf(stderr, "Path to %lx of %s\n", target, classOf(reinterpret_cast< const void*>(target)).ascii().data()); 1478 fprintf(stderr, "Path to %lx of %s\n", target, classOf(reinterpret_cast< const void*>(target)).ascii().data());
1476 ObjectGraph::const_iterator it = graph.find(target);
1477 while (it != graph.end()) { 1479 while (it != graph.end()) {
1478 fprintf(stderr, "<- %lx of %s\n", it->value.first, it->value.second. ascii().data()); 1480 fprintf(stderr, "<- %lx of %s\n", it->value.first, it->value.second. utf8().data());
1479 it = graph.find(it->value.first); 1481 it = graph.find(it->value.first);
1480 } 1482 }
1481 fprintf(stderr, "\n"); 1483 fprintf(stderr, "\n");
1482 } 1484 }
1483 1485
1484 static void dumpPathToObjectOnNextGC(void* p) 1486 static void dumpPathToObjectOnNextGC(void* p)
1485 { 1487 {
1486 objectsToFindPath().add(reinterpret_cast<uintptr_t>(p)); 1488 objectsToFindPath().add(reinterpret_cast<uintptr_t>(p));
1487 } 1489 }
1488 1490
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1600 #if ENABLE(GC_TRACING) 1602 #if ENABLE(GC_TRACING)
1601 const GCInfo* Heap::findGCInfo(Address address) 1603 const GCInfo* Heap::findGCInfo(Address address)
1602 { 1604 {
1603 return ThreadState::findGCInfoFromAllThreads(address); 1605 return ThreadState::findGCInfoFromAllThreads(address);
1604 } 1606 }
1605 1607
1606 void Heap::dumpPathToObjectOnNextGC(void* p) 1608 void Heap::dumpPathToObjectOnNextGC(void* p)
1607 { 1609 {
1608 static_cast<MarkingVisitor*>(s_markingVisitor)->dumpPathToObjectOnNextGC(p); 1610 static_cast<MarkingVisitor*>(s_markingVisitor)->dumpPathToObjectOnNextGC(p);
1609 } 1611 }
1612
1613 String Heap::createBacktraceString()
1614 {
1615 // Skip the followings:
1616 // - WTFGetBacktrace
1617 // - Heap::createBacktraceString
1618 // - Persistent::recordBacktrace
1619 // - Persistent::Persistent
1620 const int framesToSkip = 4;
haraken 2014/06/16 01:15:40 It would be better if we could determine this numb
tkent 2014/06/16 02:34:47 Done.
1621 const int framesToShow = 4;
1622 typedef void* FramePointer;
1623 FramePointer* stackFrame = static_cast<FramePointer*>(alloca((framesToShow + framesToSkip) * sizeof(FramePointer)));
1624 int stackFrameSize = framesToShow + framesToSkip;
1625 WTFGetBacktrace(stackFrame, &stackFrameSize);
1626
1627 StringBuilder builder;
1628 builder.append("Persistent");
1629 bool gotFirstName = false;
1630 for (int i = framesToSkip; i < stackFrameSize; ++i) {
1631 FrameToNameScope frameToName(stackFrame[i]);
1632 if (!frameToName.nullableName())
1633 continue;
1634 if (!gotFirstName) {
1635 gotFirstName = true;
1636 builder.append(" ... Backtrace:");
1637 }
1638 builder.append("\n\t");
1639 builder.append(frameToName.nullableName());
1640 }
1641 return builder.toString().replace("WebCore::", "");
1642 }
1610 #endif 1643 #endif
1611 1644
1612 void Heap::pushTraceCallback(void* object, TraceCallback callback) 1645 void Heap::pushTraceCallback(void* object, TraceCallback callback)
1613 { 1646 {
1614 ASSERT(Heap::contains(object)); 1647 ASSERT(Heap::contains(object));
1615 CallbackStack::Item* slot = s_markingStack->allocateEntry(&s_markingStack); 1648 CallbackStack::Item* slot = s_markingStack->allocateEntry(&s_markingStack);
1616 *slot = CallbackStack::Item(object, callback); 1649 *slot = CallbackStack::Item(object, callback);
1617 } 1650 }
1618 1651
1619 bool Heap::popAndInvokeTraceCallback(Visitor* visitor) 1652 bool Heap::popAndInvokeTraceCallback(Visitor* visitor)
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 template class ThreadHeap<FinalizedHeapObjectHeader>; 1804 template class ThreadHeap<FinalizedHeapObjectHeader>;
1772 template class ThreadHeap<HeapObjectHeader>; 1805 template class ThreadHeap<HeapObjectHeader>;
1773 1806
1774 Visitor* Heap::s_markingVisitor; 1807 Visitor* Heap::s_markingVisitor;
1775 CallbackStack* Heap::s_markingStack; 1808 CallbackStack* Heap::s_markingStack;
1776 CallbackStack* Heap::s_weakCallbackStack; 1809 CallbackStack* Heap::s_weakCallbackStack;
1777 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; 1810 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache;
1778 bool Heap::s_shutdownCalled = false; 1811 bool Heap::s_shutdownCalled = false;
1779 bool Heap::s_lastGCWasConservative = false; 1812 bool Heap::s_lastGCWasConservative = false;
1780 } 1813 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698