| 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 compaction()->registerMovingObjectReference(slot); |
| 424 } |
| 425 |
| 426 void ThreadHeap::registerMovingObjectCallback(MovableReference reference, |
| 427 MovingObjectCallback callback, |
| 428 void* callbackData) { |
| 429 DCHECK(reference); |
| 430 compaction()->registerMovingObjectCallback(reference, callback, callbackData); |
| 431 } |
| 432 |
| 433 void ThreadHeap::registerRelocation(MovableReference* slot) { |
| 434 DCHECK(slot); |
| 435 compaction()->registerRelocation(slot); |
| 436 } |
| 437 |
| 415 void ThreadHeap::decommitCallbackStacks() { | 438 void ThreadHeap::decommitCallbackStacks() { |
| 416 m_markingStack->decommit(); | 439 m_markingStack->decommit(); |
| 417 m_postMarkingCallbackStack->decommit(); | 440 m_postMarkingCallbackStack->decommit(); |
| 418 m_globalWeakCallbackStack->decommit(); | 441 m_globalWeakCallbackStack->decommit(); |
| 419 m_ephemeronStack->decommit(); | 442 m_ephemeronStack->decommit(); |
| 420 } | 443 } |
| 421 | 444 |
| 422 void ThreadHeap::preGC() { | 445 void ThreadHeap::preGC() { |
| 423 ASSERT(!ThreadState::current()->isInGC()); | 446 ASSERT(!ThreadState::current()->isInGC()); |
| 424 for (ThreadState* state : m_threads) | 447 for (ThreadState* state : m_threads) |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); | 664 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); |
| 642 | 665 |
| 643 m_stats.reset(); | 666 m_stats.reset(); |
| 644 for (ThreadState* state : m_threads) | 667 for (ThreadState* state : m_threads) |
| 645 state->resetHeapCounters(); | 668 state->resetHeapCounters(); |
| 646 } | 669 } |
| 647 | 670 |
| 648 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; | 671 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; |
| 649 | 672 |
| 650 } // namespace blink | 673 } // namespace blink |
| OLD | NEW |