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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 , m_persistents(adoptPtr(new PersistentAnchor())) | 229 , m_persistents(adoptPtr(new PersistentAnchor())) |
230 , m_startOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart(
))) | 230 , m_startOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart(
))) |
231 , m_endOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart())
) | 231 , m_endOfStack(reinterpret_cast<intptr_t*>(StackFrameDepth::getStackStart())
) |
232 , m_safePointScopeMarker(nullptr) | 232 , m_safePointScopeMarker(nullptr) |
233 , m_atSafePoint(false) | 233 , m_atSafePoint(false) |
234 , m_interruptors() | 234 , m_interruptors() |
235 , m_hasPendingIdleTask(false) | 235 , m_hasPendingIdleTask(false) |
236 , m_didV8GCAfterLastGC(false) | 236 , m_didV8GCAfterLastGC(false) |
237 , m_sweepForbidden(false) | 237 , m_sweepForbidden(false) |
238 , m_noAllocationCount(0) | 238 , m_noAllocationCount(0) |
| 239 , m_gcForbiddenCount(0) |
239 , m_isTerminating(false) | 240 , m_isTerminating(false) |
240 , m_shouldFlushHeapDoesNotContainCache(false) | 241 , m_shouldFlushHeapDoesNotContainCache(false) |
241 , m_collectionRate(1.0) | 242 , m_collectionRate(1.0) |
242 , m_gcState(NoGCScheduled) | 243 , m_gcState(NoGCScheduled) |
243 , m_traceDOMWrappers(nullptr) | 244 , m_traceDOMWrappers(nullptr) |
244 #if defined(ADDRESS_SANITIZER) | 245 #if defined(ADDRESS_SANITIZER) |
245 , m_asanFakeStack(__asan_get_current_fake_stack()) | 246 , m_asanFakeStack(__asan_get_current_fake_stack()) |
246 #endif | 247 #endif |
247 #if ENABLE(GC_PROFILING) | 248 #if ENABLE(GC_PROFILING) |
248 , m_nextFreeListSnapshotTime(-std::numeric_limits<double>::infinity()) | 249 , m_nextFreeListSnapshotTime(-std::numeric_limits<double>::infinity()) |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 // but not for less than 512 KB. | 663 // but not for less than 512 KB. |
663 size_t newSize = Heap::allocatedObjectSize(); | 664 size_t newSize = Heap::allocatedObjectSize(); |
664 return newSize >= 512 * 1024 && newSize > Heap::markedObjectSize() / 2; | 665 return newSize >= 512 * 1024 && newSize > Heap::markedObjectSize() / 2; |
665 #endif | 666 #endif |
666 } | 667 } |
667 | 668 |
668 // FIXME: We should improve the GC heuristics. | 669 // FIXME: We should improve the GC heuristics. |
669 // These heuristics affect performance significantly. | 670 // These heuristics affect performance significantly. |
670 bool ThreadState::shouldForceConservativeGC() | 671 bool ThreadState::shouldForceConservativeGC() |
671 { | 672 { |
| 673 if (UNLIKELY(m_gcForbiddenCount)) |
| 674 return false; |
| 675 |
672 size_t newSize = Heap::allocatedObjectSize(); | 676 size_t newSize = Heap::allocatedObjectSize(); |
673 if (newSize >= 300 * 1024 * 1024) { | 677 if (newSize >= 300 * 1024 * 1024) { |
674 // If we consume too much memory, trigger a conservative GC | 678 // If we consume too much memory, trigger a conservative GC |
675 // on a 50% increase in size since the last GC. This is a safe guard | 679 // on a 50% increase in size since the last GC. This is a safe guard |
676 // to avoid OOM. | 680 // to avoid OOM. |
677 return newSize > Heap::markedObjectSize() / 2; | 681 return newSize > Heap::markedObjectSize() / 2; |
678 } | 682 } |
679 if (m_didV8GCAfterLastGC && m_collectionRate > 0.5) { | 683 if (m_didV8GCAfterLastGC && m_collectionRate > 0.5) { |
680 // If we had a V8 GC after the last Oilpan GC and the last collection | 684 // If we had a V8 GC after the last Oilpan GC and the last collection |
681 // rate was higher than 50%, trigger a conservative GC on a 200% | 685 // rate was higher than 50%, trigger a conservative GC on a 200% |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1267 json->beginArray(it->key.ascii().data()); | 1271 json->beginArray(it->key.ascii().data()); |
1268 for (size_t age = 0; age <= maxHeapObjectAge; ++age) | 1272 for (size_t age = 0; age <= maxHeapObjectAge; ++age) |
1269 json->pushInteger(it->value.ages[age]); | 1273 json->pushInteger(it->value.ages[age]); |
1270 json->endArray(); | 1274 json->endArray(); |
1271 } | 1275 } |
1272 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); | 1276 TRACE_EVENT_OBJECT_SNAPSHOT_WITH_ID(TRACE_DISABLED_BY_DEFAULT("blink_gc"), s
tatsName, this, json.release()); |
1273 } | 1277 } |
1274 #endif | 1278 #endif |
1275 | 1279 |
1276 } // namespace blink | 1280 } // namespace blink |
OLD | NEW |