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 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1593 #else | 1593 #else |
1594 if (!s_heapDoesNotContainCache->lookup(address)) | 1594 if (!s_heapDoesNotContainCache->lookup(address)) |
1595 s_heapDoesNotContainCache->addEntry(address, true); | 1595 s_heapDoesNotContainCache->addEntry(address, true); |
1596 #endif | 1596 #endif |
1597 return 0; | 1597 return 0; |
1598 } | 1598 } |
1599 | 1599 |
1600 #if ENABLE(GC_TRACING) | 1600 #if ENABLE(GC_TRACING) |
1601 const GCInfo* Heap::findGCInfo(Address address) | 1601 const GCInfo* Heap::findGCInfo(Address address) |
1602 { | 1602 { |
1603 bool needLockForIteration = !ThreadState::isAnyThreadInGC(); | |
1604 if (needLockForIteration) | |
1605 ThreadState::threadAttachMutex().lock(); | |
1606 | |
1603 ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads( ); | 1607 ThreadState::AttachedThreadStateSet& threads = ThreadState::attachedThreads( ); |
1604 for (ThreadState::AttachedThreadStateSet::iterator it = threads.begin(), end = threads.end(); it != end; ++it) { | 1608 for (ThreadState::AttachedThreadStateSet::iterator it = threads.begin(), end = threads.end(); it != end; ++it) { |
1605 if (const GCInfo* gcInfo = (*it)->findGCInfo(address)) { | 1609 if (const GCInfo* gcInfo = (*it)->findGCInfo(address)) { |
1610 if (needLockForIteration) | |
1611 ThreadState::threadAttachMutex().unlock(); | |
Mads Ager (chromium)
2014/06/06 06:54:01
Do we have a scoped lock object that we could use
kouhei (in TOK)
2014/06/06 06:58:26
I tried to use MutexLocker, but it requires lock a
Mads Ager (chromium)
2014/06/06 07:03:30
Nah, don't bother for this change. This code is ne
| |
1606 return gcInfo; | 1612 return gcInfo; |
1607 } | 1613 } |
1608 } | 1614 } |
1615 if (needLockForIteration) | |
1616 ThreadState::threadAttachMutex().unlock(); | |
1609 return 0; | 1617 return 0; |
1610 } | 1618 } |
1611 | 1619 |
1612 void Heap::dumpPathToObjectOnNextGC(void* p) | 1620 void Heap::dumpPathToObjectOnNextGC(void* p) |
1613 { | 1621 { |
1614 static_cast<MarkingVisitor*>(s_markingVisitor)->dumpPathToObjectOnNextGC(p); | 1622 static_cast<MarkingVisitor*>(s_markingVisitor)->dumpPathToObjectOnNextGC(p); |
1615 } | 1623 } |
1616 #endif | 1624 #endif |
1617 | 1625 |
1618 void Heap::pushTraceCallback(void* object, TraceCallback callback) | 1626 void Heap::pushTraceCallback(void* object, TraceCallback callback) |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1777 template class ThreadHeap<FinalizedHeapObjectHeader>; | 1785 template class ThreadHeap<FinalizedHeapObjectHeader>; |
1778 template class ThreadHeap<HeapObjectHeader>; | 1786 template class ThreadHeap<HeapObjectHeader>; |
1779 | 1787 |
1780 Visitor* Heap::s_markingVisitor; | 1788 Visitor* Heap::s_markingVisitor; |
1781 CallbackStack* Heap::s_markingStack; | 1789 CallbackStack* Heap::s_markingStack; |
1782 CallbackStack* Heap::s_weakCallbackStack; | 1790 CallbackStack* Heap::s_weakCallbackStack; |
1783 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; | 1791 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; |
1784 bool Heap::s_shutdownCalled = false; | 1792 bool Heap::s_shutdownCalled = false; |
1785 bool Heap::s_lastGCWasConservative = false; | 1793 bool Heap::s_lastGCWasConservative = false; |
1786 } | 1794 } |
OLD | NEW |