OLD | NEW |
---|---|
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 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1307 #endif | 1307 #endif |
1308 | 1308 |
1309 inline void visitHeader(HeapObjectHeader* header, const void* objectPointer, TraceCallback callback) | 1309 inline void visitHeader(HeapObjectHeader* header, const void* objectPointer, TraceCallback callback) |
1310 { | 1310 { |
1311 ASSERT(header); | 1311 ASSERT(header); |
1312 ASSERT(objectPointer); | 1312 ASSERT(objectPointer); |
1313 if (header->isMarked()) | 1313 if (header->isMarked()) |
1314 return; | 1314 return; |
1315 header->mark(); | 1315 header->mark(); |
1316 #if ENABLE(GC_TRACING) | 1316 #if ENABLE(GC_TRACING) |
1317 MutexLocker locker(objectGraphMutex()); | |
1317 String className(classOf(objectPointer)); | 1318 String className(classOf(objectPointer)); |
1318 { | 1319 { |
1319 LiveObjectMap::AddResult result = currentlyLive().add(className, Liv eObjectSet()); | 1320 LiveObjectMap::AddResult result = currentlyLive().add(className, Liv eObjectSet()); |
1320 result.storedValue->value.add(reinterpret_cast<uintptr_t>(objectPoin ter)); | 1321 result.storedValue->value.add(reinterpret_cast<uintptr_t>(objectPoin ter)); |
1321 } | 1322 } |
1322 ObjectGraph::AddResult result = objectGraph().add(reinterpret_cast<uintp tr_t>(objectPointer), std::make_pair(reinterpret_cast<uintptr_t>(m_hostObject), m_hostName)); | 1323 ObjectGraph::AddResult result = objectGraph().add(reinterpret_cast<uintp tr_t>(objectPointer), std::make_pair(reinterpret_cast<uintptr_t>(m_hostObject), m_hostName)); |
1323 ASSERT(result.isNewEntry); | 1324 ASSERT(result.isNewEntry); |
1324 // printf("%s[%p] -> %s[%p]\n", m_hostName.ascii().data(), m_hostObject, className.ascii().data(), objectPointer); | 1325 // printf("%s[%p] -> %s[%p]\n", m_hostName.ascii().data(), m_hostObject, className.ascii().data(), objectPointer); |
1325 #endif | 1326 #endif |
1326 if (callback) | 1327 if (callback) |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1462 it = graph.find(it->value.first); | 1463 it = graph.find(it->value.first); |
1463 } | 1464 } |
1464 printf("\n"); | 1465 printf("\n"); |
1465 } | 1466 } |
1466 | 1467 |
1467 static void dumpPathToObjectOnNextGC(void* p) | 1468 static void dumpPathToObjectOnNextGC(void* p) |
1468 { | 1469 { |
1469 objectsToFindPath().add(reinterpret_cast<uintptr_t>(p)); | 1470 objectsToFindPath().add(reinterpret_cast<uintptr_t>(p)); |
1470 } | 1471 } |
1471 | 1472 |
1473 static Mutex& objectGraphMutex() | |
1474 { | |
1475 AtomicallyInitializedStatic(Mutex&, mutex = *new Mutex); | |
tkent
2014/05/29 12:43:05
This looks unnatural.
Does the following work?
| |
1476 return mutex; | |
1477 } | |
1478 | |
1472 static LiveObjectMap& previouslyLive() | 1479 static LiveObjectMap& previouslyLive() |
1473 { | 1480 { |
1474 DEFINE_STATIC_LOCAL(LiveObjectMap, map, ()); | 1481 DEFINE_STATIC_LOCAL(LiveObjectMap, map, ()); |
1475 return map; | 1482 return map; |
1476 } | 1483 } |
1477 | 1484 |
1478 static LiveObjectMap& currentlyLive() | 1485 static LiveObjectMap& currentlyLive() |
1479 { | 1486 { |
1480 DEFINE_STATIC_LOCAL(LiveObjectMap, map, ()); | 1487 DEFINE_STATIC_LOCAL(LiveObjectMap, map, ()); |
1481 return map; | 1488 return map; |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1754 template class ThreadHeap<FinalizedHeapObjectHeader>; | 1761 template class ThreadHeap<FinalizedHeapObjectHeader>; |
1755 template class ThreadHeap<HeapObjectHeader>; | 1762 template class ThreadHeap<HeapObjectHeader>; |
1756 | 1763 |
1757 Visitor* Heap::s_markingVisitor; | 1764 Visitor* Heap::s_markingVisitor; |
1758 CallbackStack* Heap::s_markingStack; | 1765 CallbackStack* Heap::s_markingStack; |
1759 CallbackStack* Heap::s_weakCallbackStack; | 1766 CallbackStack* Heap::s_weakCallbackStack; |
1760 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; | 1767 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; |
1761 bool Heap::s_shutdownCalled = false; | 1768 bool Heap::s_shutdownCalled = false; |
1762 bool Heap::s_lastGCWasConservative = false; | 1769 bool Heap::s_lastGCWasConservative = false; |
1763 } | 1770 } |
OLD | NEW |