Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1192)

Side by Side Diff: third_party/WebKit/Source/platform/heap/Heap.cpp

Issue 2531973002: Simple BlinkGC heap compaction. (Closed)
Patch Set: add pointer alignment handling to SparseHeapBitmap Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 && *slot);
haraken 2016/12/09 07:25:54 DCHECK(slot); DCHECK(*slot); It would help to ide
sof 2016/12/09 21:44:03 Done.
424 compaction()->registerMovingObjectReference(slot);
425 }
426
427 void ThreadHeap::registerMovingObjectCallback(MovableReference reference,
428 MovingObjectCallback callback,
429 void* callbackData) {
430 DCHECK(reference);
431 compaction()->registerMovingObjectCallback(reference, callback, callbackData);
432 }
433
415 void ThreadHeap::decommitCallbackStacks() { 434 void ThreadHeap::decommitCallbackStacks() {
416 m_markingStack->decommit(); 435 m_markingStack->decommit();
417 m_postMarkingCallbackStack->decommit(); 436 m_postMarkingCallbackStack->decommit();
418 m_globalWeakCallbackStack->decommit(); 437 m_globalWeakCallbackStack->decommit();
419 m_ephemeronStack->decommit(); 438 m_ephemeronStack->decommit();
420 } 439 }
421 440
422 void ThreadHeap::preGC() { 441 void ThreadHeap::preGC() {
423 ASSERT(!ThreadState::current()->isInGC()); 442 ASSERT(!ThreadState::current()->isInGC());
424 for (ThreadState* state : m_threads) 443 for (ThreadState* state : m_threads)
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize()); 660 ProcessHeap::decreaseTotalMarkedObjectSize(m_stats.markedObjectSize());
642 661
643 m_stats.reset(); 662 m_stats.reset();
644 for (ThreadState* state : m_threads) 663 for (ThreadState* state : m_threads)
645 state->resetHeapCounters(); 664 state->resetHeapCounters();
646 } 665 }
647 666
648 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr; 667 ThreadHeap* ThreadHeap::s_mainThreadHeap = nullptr;
649 668
650 } // namespace blink 669 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698