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" | |
39 #include "platform/heap/MarkingVisitor.h" | 38 #include "platform/heap/MarkingVisitor.h" |
40 #include "platform/heap/PageMemory.h" | 39 #include "platform/heap/PageMemory.h" |
41 #include "platform/heap/PagePool.h" | 40 #include "platform/heap/PagePool.h" |
42 #include "platform/heap/SafePoint.h" | 41 #include "platform/heap/SafePoint.h" |
43 #include "platform/heap/ThreadState.h" | 42 #include "platform/heap/ThreadState.h" |
44 #include "platform/tracing/TraceEvent.h" | 43 #include "platform/tracing/TraceEvent.h" |
45 #include "platform/tracing/web_memory_allocator_dump.h" | 44 #include "platform/tracing/web_memory_allocator_dump.h" |
46 #include "platform/tracing/web_process_memory_dump.h" | 45 #include "platform/tracing/web_process_memory_dump.h" |
47 #include "public/platform/Platform.h" | 46 #include "public/platform/Platform.h" |
48 #include "wtf/Assertions.h" | 47 #include "wtf/Assertions.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 } | 405 } |
407 #endif | 406 #endif |
408 | 407 |
409 void ThreadHeap::commitCallbackStacks() { | 408 void ThreadHeap::commitCallbackStacks() { |
410 m_markingStack->commit(); | 409 m_markingStack->commit(); |
411 m_postMarkingCallbackStack->commit(); | 410 m_postMarkingCallbackStack->commit(); |
412 m_globalWeakCallbackStack->commit(); | 411 m_globalWeakCallbackStack->commit(); |
413 m_ephemeronStack->commit(); | 412 m_ephemeronStack->commit(); |
414 } | 413 } |
415 | 414 |
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 | |
435 void ThreadHeap::decommitCallbackStacks() { | 415 void ThreadHeap::decommitCallbackStacks() { |
436 m_markingStack->decommit(); | 416 m_markingStack->decommit(); |
437 m_postMarkingCallbackStack->decommit(); | 417 m_postMarkingCallbackStack->decommit(); |
438 m_globalWeakCallbackStack->decommit(); | 418 m_globalWeakCallbackStack->decommit(); |
439 m_ephemeronStack->decommit(); | 419 m_ephemeronStack->decommit(); |
440 } | 420 } |
441 | 421 |
442 void ThreadHeap::preGC() { | 422 void ThreadHeap::preGC() { |
443 ASSERT(!ThreadState::current()->isInGC()); | 423 ASSERT(!ThreadState::current()->isInGC()); |
444 for (ThreadState* state : m_threads) | 424 for (ThreadState* state : m_threads) |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); | 641 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); |
662 | 642 |
663 m_stats.reset(); | 643 m_stats.reset(); |
664 for (ThreadState* state : m_threads) | 644 for (ThreadState* state : m_threads) |
665 state->resetHeapCounters(); | 645 state->resetHeapCounters(); |
666 } | 646 } |
667 | 647 |
668 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; | 648 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; |
669 | 649 |
670 } // namespace blink | 650 } // namespace blink |
OLD | NEW |