| 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 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 m_safePointStackCopy.resize(slotCount); | 1211 m_safePointStackCopy.resize(slotCount); |
| 1212 for (size_t i = 0; i < slotCount; ++i) { | 1212 for (size_t i = 0; i < slotCount; ++i) { |
| 1213 m_safePointStackCopy[i] = from[i]; | 1213 m_safePointStackCopy[i] = from[i]; |
| 1214 } | 1214 } |
| 1215 } | 1215 } |
| 1216 | 1216 |
| 1217 void ThreadState::addInterruptor( | 1217 void ThreadState::addInterruptor( |
| 1218 std::unique_ptr<BlinkGCInterruptor> interruptor) { | 1218 std::unique_ptr<BlinkGCInterruptor> interruptor) { |
| 1219 ASSERT(checkThread()); | 1219 ASSERT(checkThread()); |
| 1220 SafePointScope scope(BlinkGC::HeapPointersOnStack); | 1220 SafePointScope scope(BlinkGC::HeapPointersOnStack); |
| 1221 { | 1221 m_interruptors.push_back(std::move(interruptor)); |
| 1222 MutexLocker locker(m_heap->threadAttachMutex()); | |
| 1223 m_interruptors.push_back(std::move(interruptor)); | |
| 1224 } | |
| 1225 } | 1222 } |
| 1226 | 1223 |
| 1227 void ThreadState::registerStaticPersistentNode( | 1224 void ThreadState::registerStaticPersistentNode( |
| 1228 PersistentNode* node, | 1225 PersistentNode* node, |
| 1229 PersistentClearCallback callback) { | 1226 PersistentClearCallback callback) { |
| 1230 #if defined(LEAK_SANITIZER) | 1227 #if defined(LEAK_SANITIZER) |
| 1231 if (m_disabledStaticPersistentsRegistration) | 1228 if (m_disabledStaticPersistentsRegistration) |
| 1232 return; | 1229 return; |
| 1233 #endif | 1230 #endif |
| 1234 | 1231 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1261 void ThreadState::enterStaticReferenceRegistrationDisabledScope() { | 1258 void ThreadState::enterStaticReferenceRegistrationDisabledScope() { |
| 1262 m_disabledStaticPersistentsRegistration++; | 1259 m_disabledStaticPersistentsRegistration++; |
| 1263 } | 1260 } |
| 1264 | 1261 |
| 1265 void ThreadState::leaveStaticReferenceRegistrationDisabledScope() { | 1262 void ThreadState::leaveStaticReferenceRegistrationDisabledScope() { |
| 1266 ASSERT(m_disabledStaticPersistentsRegistration); | 1263 ASSERT(m_disabledStaticPersistentsRegistration); |
| 1267 m_disabledStaticPersistentsRegistration--; | 1264 m_disabledStaticPersistentsRegistration--; |
| 1268 } | 1265 } |
| 1269 #endif | 1266 #endif |
| 1270 | 1267 |
| 1271 void ThreadState::lockThreadAttachMutex() { | |
| 1272 m_heap->threadAttachMutex().lock(); | |
| 1273 } | |
| 1274 | |
| 1275 void ThreadState::unlockThreadAttachMutex() { | |
| 1276 m_heap->threadAttachMutex().unlock(); | |
| 1277 } | |
| 1278 | |
| 1279 void ThreadState::invokePreFinalizers() { | 1268 void ThreadState::invokePreFinalizers() { |
| 1280 ASSERT(checkThread()); | 1269 ASSERT(checkThread()); |
| 1281 ASSERT(!sweepForbidden()); | 1270 ASSERT(!sweepForbidden()); |
| 1282 TRACE_EVENT0("blink_gc", "ThreadState::invokePreFinalizers"); | 1271 TRACE_EVENT0("blink_gc", "ThreadState::invokePreFinalizers"); |
| 1283 | 1272 |
| 1284 double startTime = WTF::currentTimeMS(); | 1273 double startTime = WTF::currentTimeMS(); |
| 1285 if (!m_orderedPreFinalizers.isEmpty()) { | 1274 if (!m_orderedPreFinalizers.isEmpty()) { |
| 1286 SweepForbiddenScope sweepForbidden(this); | 1275 SweepForbiddenScope sweepForbidden(this); |
| 1287 ScriptForbiddenIfMainThreadScope scriptForbidden; | 1276 ScriptForbiddenIfMainThreadScope scriptForbidden; |
| 1288 | 1277 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, | 1557 collectGarbage(BlinkGC::NoHeapPointersOnStack, BlinkGC::GCWithSweep, |
| 1569 BlinkGC::ForcedGC); | 1558 BlinkGC::ForcedGC); |
| 1570 size_t liveObjects = heap().heapStats().markedObjectSize(); | 1559 size_t liveObjects = heap().heapStats().markedObjectSize(); |
| 1571 if (liveObjects == previousLiveObjects) | 1560 if (liveObjects == previousLiveObjects) |
| 1572 break; | 1561 break; |
| 1573 previousLiveObjects = liveObjects; | 1562 previousLiveObjects = liveObjects; |
| 1574 } | 1563 } |
| 1575 } | 1564 } |
| 1576 | 1565 |
| 1577 } // namespace blink | 1566 } // namespace blink |
| OLD | NEW |