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 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "platform/heap/Heap.h" | 31 #include "platform/heap/Heap.h" |
32 | 32 |
33 #include "platform/Histogram.h" | 33 #include "platform/Histogram.h" |
34 #include "platform/RuntimeEnabledFeatures.h" | 34 #include "platform/RuntimeEnabledFeatures.h" |
35 #include "platform/ScriptForbiddenScope.h" | 35 #include "platform/ScriptForbiddenScope.h" |
36 #include "platform/heap/BlinkGCMemoryDumpProvider.h" | 36 #include "platform/heap/BlinkGCMemoryDumpProvider.h" |
37 #include "platform/heap/CallbackStack.h" | 37 #include "platform/heap/CallbackStack.h" |
| 38 #include "platform/heap/HeapCompact.h" |
38 #include "platform/heap/MarkingVisitor.h" | 39 #include "platform/heap/MarkingVisitor.h" |
39 #include "platform/heap/PageMemory.h" | 40 #include "platform/heap/PageMemory.h" |
40 #include "platform/heap/PagePool.h" | 41 #include "platform/heap/PagePool.h" |
41 #include "platform/heap/SafePoint.h" | 42 #include "platform/heap/SafePoint.h" |
42 #include "platform/heap/ThreadState.h" | 43 #include "platform/heap/ThreadState.h" |
43 #include "platform/tracing/TraceEvent.h" | 44 #include "platform/tracing/TraceEvent.h" |
44 #include "platform/tracing/web_memory_allocator_dump.h" | 45 #include "platform/tracing/web_memory_allocator_dump.h" |
45 #include "platform/tracing/web_process_memory_dump.h" | 46 #include "platform/tracing/web_process_memory_dump.h" |
46 #include "public/platform/Platform.h" | 47 #include "public/platform/Platform.h" |
47 #include "wtf/Assertions.h" | 48 #include "wtf/Assertions.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 } | 406 } |
406 #endif | 407 #endif |
407 | 408 |
408 void ThreadHeap::commitCallbackStacks() { | 409 void ThreadHeap::commitCallbackStacks() { |
409 m_markingStack->commit(); | 410 m_markingStack->commit(); |
410 m_postMarkingCallbackStack->commit(); | 411 m_postMarkingCallbackStack->commit(); |
411 m_globalWeakCallbackStack->commit(); | 412 m_globalWeakCallbackStack->commit(); |
412 m_ephemeronStack->commit(); | 413 m_ephemeronStack->commit(); |
413 } | 414 } |
414 | 415 |
| 416 HeapCompact* ThreadHeap::compaction() { |
| 417 if (!m_compaction) |
| 418 m_compaction = HeapCompact::create(); |
| 419 return m_compaction.get(); |
| 420 } |
| 421 |
| 422 void ThreadHeap::registerMovingObjectReference(MovableReference* slot) { |
| 423 DCHECK(slot); |
| 424 DCHECK(*slot); |
| 425 compaction()->registerMovingObjectReference(slot); |
| 426 } |
| 427 |
| 428 void ThreadHeap::registerMovingObjectCallback(MovableReference reference, |
| 429 MovingObjectCallback callback, |
| 430 void* callbackData) { |
| 431 DCHECK(reference); |
| 432 compaction()->registerMovingObjectCallback(reference, callback, callbackData); |
| 433 } |
| 434 |
415 void ThreadHeap::decommitCallbackStacks() { | 435 void ThreadHeap::decommitCallbackStacks() { |
416 m_markingStack->decommit(); | 436 m_markingStack->decommit(); |
417 m_postMarkingCallbackStack->decommit(); | 437 m_postMarkingCallbackStack->decommit(); |
418 m_globalWeakCallbackStack->decommit(); | 438 m_globalWeakCallbackStack->decommit(); |
419 m_ephemeronStack->decommit(); | 439 m_ephemeronStack->decommit(); |
420 } | 440 } |
421 | 441 |
422 void ThreadHeap::preGC() { | 442 void ThreadHeap::preGC() { |
423 ASSERT(!ThreadState::current()->isInGC()); | 443 ASSERT(!ThreadState::current()->isInGC()); |
424 for (ThreadState* state : m_threads) | 444 for (ThreadState* state : m_threads) |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); | 661 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); |
642 | 662 |
643 m_stats.reset(); | 663 m_stats.reset(); |
644 for (ThreadState* state : m_threads) | 664 for (ThreadState* state : m_threads) |
645 state->resetHeapCounters(); | 665 state->resetHeapCounters(); |
646 } | 666 } |
647 | 667 |
648 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; | 668 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; |
649 | 669 |
650 } // namespace blink | 670 } // namespace blink |
OLD | NEW |