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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 } | 71 } |
72 } | 72 } |
73 if (freed_memory > 0) { | 73 if (freed_memory > 0) { |
74 heap_->update_external_memory_concurrently_freed( | 74 heap_->update_external_memory_concurrently_freed( |
75 static_cast<intptr_t>(freed_memory)); | 75 static_cast<intptr_t>(freed_memory)); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 void ArrayBufferTracker::FreeDeadInNewSpace(Heap* heap) { | 79 void ArrayBufferTracker::FreeDeadInNewSpace(Heap* heap) { |
80 DCHECK_EQ(heap->gc_state(), Heap::HeapState::SCAVENGE); | 80 DCHECK_EQ(heap->gc_state(), Heap::HeapState::SCAVENGE); |
81 for (Page* page : NewSpacePageRange(heap->new_space()->FromSpaceStart(), | 81 for (Page* page : PageRange(heap->new_space()->FromSpaceStart(), |
82 heap->new_space()->FromSpaceEnd())) { | 82 heap->new_space()->FromSpaceEnd())) { |
83 bool empty = ProcessBuffers(page, kUpdateForwardedRemoveOthers); | 83 bool empty = ProcessBuffers(page, kUpdateForwardedRemoveOthers); |
84 CHECK(empty); | 84 CHECK(empty); |
85 } | 85 } |
86 heap->account_external_memory_concurrently_freed(); | 86 heap->account_external_memory_concurrently_freed(); |
87 } | 87 } |
88 | 88 |
89 void ArrayBufferTracker::FreeDead(Page* page) { | 89 void ArrayBufferTracker::FreeDead(Page* page) { |
90 // Callers need to ensure having the page lock. | 90 // Callers need to ensure having the page lock. |
91 LocalArrayBufferTracker* tracker = page->local_tracker(); | 91 LocalArrayBufferTracker* tracker = page->local_tracker(); |
92 if (tracker == nullptr) return; | 92 if (tracker == nullptr) return; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 { | 130 { |
131 base::LockGuard<base::Mutex> guard(page->mutex()); | 131 base::LockGuard<base::Mutex> guard(page->mutex()); |
132 LocalArrayBufferTracker* tracker = page->local_tracker(); | 132 LocalArrayBufferTracker* tracker = page->local_tracker(); |
133 if (tracker == nullptr) return false; | 133 if (tracker == nullptr) return false; |
134 return tracker->IsTracked(buffer); | 134 return tracker->IsTracked(buffer); |
135 } | 135 } |
136 } | 136 } |
137 | 137 |
138 } // namespace internal | 138 } // namespace internal |
139 } // namespace v8 | 139 } // namespace v8 |
OLD | NEW |