| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ProcessHeap::init() | 107 void ProcessHeap::init() |
| 108 { | 108 { |
| 109 s_totalAllocatedSpace = 0; | 109 s_totalAllocatedSpace = 0; |
| 110 s_totalAllocatedObjectSize = 0; | 110 s_totalAllocatedObjectSize = 0; |
| 111 s_totalMarkedObjectSize = 0; | 111 s_totalMarkedObjectSize = 0; |
| 112 s_isLowEndDevice = base::SysInfo::IsLowEndDevice(); | 112 s_isLowEndDevice = base::SysInfo::IsLowEndDevice(); |
| 113 } | 113 } |
| 114 | 114 |
| 115 void ProcessHeap::resetHeapCounters() |
| 116 { |
| 117 s_totalAllocatedObjectSize = 0; |
| 118 s_totalMarkedObjectSize = 0; |
| 119 } |
| 120 |
| 115 void Heap::init() | 121 void Heap::init() |
| 116 { | 122 { |
| 117 ThreadState::init(); | 123 ThreadState::init(); |
| 118 ProcessHeap::init(); | 124 ProcessHeap::init(); |
| 119 s_markingStack = new CallbackStack(); | 125 s_markingStack = new CallbackStack(); |
| 120 s_postMarkingCallbackStack = new CallbackStack(); | 126 s_postMarkingCallbackStack = new CallbackStack(); |
| 121 s_globalWeakCallbackStack = new CallbackStack(); | 127 s_globalWeakCallbackStack = new CallbackStack(); |
| 122 // Use smallest supported block size for ephemerons. | 128 // Use smallest supported block size for ephemerons. |
| 123 s_ephemeronStack = new CallbackStack(CallbackStack::kMinimalBlockSize); | 129 s_ephemeronStack = new CallbackStack(CallbackStack::kMinimalBlockSize); |
| 124 s_heapDoesNotContainCache = new HeapDoesNotContainCache(); | 130 s_heapDoesNotContainCache = new HeapDoesNotContainCache(); |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 } | 687 } |
| 682 return nullptr; | 688 return nullptr; |
| 683 } | 689 } |
| 684 | 690 |
| 685 void Heap::resetHeapCounters() | 691 void Heap::resetHeapCounters() |
| 686 { | 692 { |
| 687 ASSERT(ThreadState::current()->isInGC()); | 693 ASSERT(ThreadState::current()->isInGC()); |
| 688 | 694 |
| 689 Heap::reportMemoryUsageForTracing(); | 695 Heap::reportMemoryUsageForTracing(); |
| 690 | 696 |
| 697 ProcessHeap::resetHeapCounters(); |
| 691 Heap::heapStats().reset(); | 698 Heap::heapStats().reset(); |
| 692 for (ThreadState* state : ThreadState::attachedThreads()) | 699 for (ThreadState* state : ThreadState::attachedThreads()) |
| 693 state->resetHeapCounters(); | 700 state->resetHeapCounters(); |
| 694 } | 701 } |
| 695 | 702 |
| 696 // TODO(keishi): Make this a member of ThreadHeap. | 703 // TODO(keishi): Make this a member of ThreadHeap. |
| 697 ThreadHeapStats& Heap::heapStats() | 704 ThreadHeapStats& Heap::heapStats() |
| 698 { | 705 { |
| 699 DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadHeapStats, stats, new ThreadHeapStats(
)); | 706 DEFINE_THREAD_SAFE_STATIC_LOCAL(ThreadHeapStats, stats, new ThreadHeapStats(
)); |
| 700 return stats; | 707 return stats; |
| 701 } | 708 } |
| 702 | 709 |
| 703 CallbackStack* Heap::s_markingStack; | 710 CallbackStack* Heap::s_markingStack; |
| 704 CallbackStack* Heap::s_postMarkingCallbackStack; | 711 CallbackStack* Heap::s_postMarkingCallbackStack; |
| 705 CallbackStack* Heap::s_globalWeakCallbackStack; | 712 CallbackStack* Heap::s_globalWeakCallbackStack; |
| 706 CallbackStack* Heap::s_ephemeronStack; | 713 CallbackStack* Heap::s_ephemeronStack; |
| 707 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; | 714 HeapDoesNotContainCache* Heap::s_heapDoesNotContainCache; |
| 708 FreePagePool* Heap::s_freePagePool; | 715 FreePagePool* Heap::s_freePagePool; |
| 709 OrphanedPagePool* Heap::s_orphanedPagePool; | 716 OrphanedPagePool* Heap::s_orphanedPagePool; |
| 710 | 717 |
| 711 BlinkGC::GCReason Heap::s_lastGCReason = BlinkGC::NumberOfGCReason; | 718 BlinkGC::GCReason Heap::s_lastGCReason = BlinkGC::NumberOfGCReason; |
| 712 | 719 |
| 713 } // namespace blink | 720 } // namespace blink |
| OLD | NEW |