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

Side by Side Diff: src/heap/concurrent-marking.cc

Issue 2872263002: [heap] Synchronize young generation GC with concurrent marking. (Closed)
Patch Set: add guard in Heap::EvacuateYoungGeneration Created 3 years, 7 months 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
« no previous file with comments | « src/crankshaft/hydrogen-environment-liveness.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 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/concurrent-marking.h" 5 #include "src/heap/concurrent-marking.h"
6 6
7 #include <stack> 7 #include <stack>
8 #include <unordered_map> 8 #include <unordered_map>
9 9
10 #include "src/heap/concurrent-marking-deque.h" 10 #include "src/heap/concurrent-marking-deque.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 STATIC_ASSERT(!(V8_CONCURRENT_MARKING && V8_DOUBLE_FIELDS_UNBOXING)); 178 STATIC_ASSERT(!(V8_CONCURRENT_MARKING && V8_DOUBLE_FIELDS_UNBOXING));
179 // The runtime flag should be set only if the compile time flag was set. 179 // The runtime flag should be set only if the compile time flag was set.
180 CHECK(!FLAG_concurrent_marking || V8_CONCURRENT_MARKING); 180 CHECK(!FLAG_concurrent_marking || V8_CONCURRENT_MARKING);
181 } 181 }
182 182
183 ConcurrentMarking::~ConcurrentMarking() { delete visitor_; } 183 ConcurrentMarking::~ConcurrentMarking() { delete visitor_; }
184 184
185 void ConcurrentMarking::Run() { 185 void ConcurrentMarking::Run() {
186 double time_ms = heap_->MonotonicallyIncreasingTimeInMs(); 186 double time_ms = heap_->MonotonicallyIncreasingTimeInMs();
187 size_t bytes_marked = 0; 187 size_t bytes_marked = 0;
188 base::Mutex* relocation_mutex = heap_->relocation_mutex();
188 { 189 {
189 TimedScope scope(&time_ms); 190 TimedScope scope(&time_ms);
190 HeapObject* object; 191 HeapObject* object;
191 while ((object = deque_->Pop(MarkingThread::kConcurrent)) != nullptr) { 192 while ((object = deque_->Pop(MarkingThread::kConcurrent)) != nullptr) {
193 base::LockGuard<base::Mutex> guard(relocation_mutex);
192 bytes_marked += visitor_->Visit(object); 194 bytes_marked += visitor_->Visit(object);
193 } 195 }
194 } 196 }
195 if (FLAG_trace_concurrent_marking) { 197 if (FLAG_trace_concurrent_marking) {
196 heap_->isolate()->PrintWithTimestamp("concurrently marked %dKB in %.2fms\n", 198 heap_->isolate()->PrintWithTimestamp("concurrently marked %dKB in %.2fms\n",
197 static_cast<int>(bytes_marked / KB), 199 static_cast<int>(bytes_marked / KB),
198 time_ms); 200 time_ms);
199 } 201 }
200 } 202 }
201 203
(...skipping 12 matching lines...) Expand all
214 } 216 }
215 217
216 void ConcurrentMarking::EnsureTaskCompleted() { 218 void ConcurrentMarking::EnsureTaskCompleted() {
217 if (IsTaskPending()) { 219 if (IsTaskPending()) {
218 WaitForTaskToComplete(); 220 WaitForTaskToComplete();
219 } 221 }
220 } 222 }
221 223
222 } // namespace internal 224 } // namespace internal
223 } // namespace v8 225 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen-environment-liveness.cc ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698