OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/heap/array-buffer-tracker.h" | 5 #include "src/heap/array-buffer-tracker.h" |
6 #include "src/heap/array-buffer-tracker-inl.h" | 6 #include "src/heap/array-buffer-tracker-inl.h" |
7 #include "src/heap/heap.h" | 7 #include "src/heap/heap.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 } | 69 } |
70 if (freed_memory > 0) { | 70 if (freed_memory > 0) { |
71 heap_->update_external_memory_concurrently_freed( | 71 heap_->update_external_memory_concurrently_freed( |
72 static_cast<intptr_t>(freed_memory)); | 72 static_cast<intptr_t>(freed_memory)); |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 void ArrayBufferTracker::FreeDeadInNewSpace(Heap* heap) { | 76 void ArrayBufferTracker::FreeDeadInNewSpace(Heap* heap) { |
77 DCHECK_EQ(heap->gc_state(), Heap::HeapState::SCAVENGE); | 77 DCHECK_EQ(heap->gc_state(), Heap::HeapState::SCAVENGE); |
78 NewSpacePageIterator from_it(heap->new_space()->FromSpaceStart(), | 78 for (Page* page : NewSpacePageRange(heap->new_space()->FromSpaceStart(), |
79 heap->new_space()->FromSpaceEnd()); | 79 heap->new_space()->FromSpaceEnd())) { |
80 while (from_it.has_next()) { | |
81 Page* page = from_it.next(); | |
82 bool empty = ProcessBuffers(page, kUpdateForwardedRemoveOthers); | 80 bool empty = ProcessBuffers(page, kUpdateForwardedRemoveOthers); |
83 CHECK(empty); | 81 CHECK(empty); |
84 } | 82 } |
85 heap->account_external_memory_concurrently_freed(); | 83 heap->account_external_memory_concurrently_freed(); |
86 } | 84 } |
87 | 85 |
88 void ArrayBufferTracker::FreeDead(Page* page) { | 86 void ArrayBufferTracker::FreeDead(Page* page) { |
89 // Callers need to ensure having the page lock. | 87 // Callers need to ensure having the page lock. |
90 LocalArrayBufferTracker* tracker = page->local_tracker(); | 88 LocalArrayBufferTracker* tracker = page->local_tracker(); |
91 if (tracker == nullptr) return; | 89 if (tracker == nullptr) return; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 { | 127 { |
130 base::LockGuard<base::Mutex> guard(page->mutex()); | 128 base::LockGuard<base::Mutex> guard(page->mutex()); |
131 LocalArrayBufferTracker* tracker = page->local_tracker(); | 129 LocalArrayBufferTracker* tracker = page->local_tracker(); |
132 if (tracker == nullptr) return false; | 130 if (tracker == nullptr) return false; |
133 return tracker->IsTracked(buffer); | 131 return tracker->IsTracked(buffer); |
134 } | 132 } |
135 } | 133 } |
136 | 134 |
137 } // namespace internal | 135 } // namespace internal |
138 } // namespace v8 | 136 } // namespace v8 |
OLD | NEW |