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

Side by Side Diff: src/heap/spaces.cc

Issue 2428043002: [heap] Start sweeper tasks after evacuation. (Closed)
Patch Set: address comment Created 4 years, 2 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/heap/spaces.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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/spaces.h" 5 #include "src/heap/spaces.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 void MemoryAllocator::Unmapper::ReconsiderDelayedChunks() { 387 void MemoryAllocator::Unmapper::ReconsiderDelayedChunks() {
388 std::list<MemoryChunk*> delayed_chunks(std::move(delayed_regular_chunks_)); 388 std::list<MemoryChunk*> delayed_chunks(std::move(delayed_regular_chunks_));
389 // Move constructed, so the permanent list should be empty. 389 // Move constructed, so the permanent list should be empty.
390 DCHECK(delayed_regular_chunks_.empty()); 390 DCHECK(delayed_regular_chunks_.empty());
391 for (auto it = delayed_chunks.begin(); it != delayed_chunks.end(); ++it) { 391 for (auto it = delayed_chunks.begin(); it != delayed_chunks.end(); ++it) {
392 AddMemoryChunkSafe<kRegular>(*it); 392 AddMemoryChunkSafe<kRegular>(*it);
393 } 393 }
394 } 394 }
395 395
396 bool MemoryAllocator::CanFreeMemoryChunk(MemoryChunk* chunk) { 396 bool MemoryAllocator::CanFreeMemoryChunk(MemoryChunk* chunk) {
397 MarkCompactCollector* mc = isolate_->heap()->mark_compact_collector();
398 // We cannot free memory chunks in new space while the sweeper is running 397 // We cannot free memory chunks in new space while the sweeper is running
399 // since a sweeper thread might be stuck right before trying to lock the 398 // since a sweeper thread might be stuck right before trying to lock the
400 // corresponding page. 399 // corresponding page.
401 return !chunk->InNewSpace() || (mc == nullptr) || !FLAG_concurrent_sweeping || 400
402 mc->sweeper().IsSweepingCompleted(); 401 // Chunks in old generation are unmapped if they are empty.
402 DCHECK(chunk->InNewSpace() || chunk->SweepingDone());
403 return !chunk->InNewSpace() || !FLAG_concurrent_sweeping ||
404 chunk->SweepingDone();
403 } 405 }
404 406
405 bool MemoryAllocator::CommitMemory(Address base, size_t size, 407 bool MemoryAllocator::CommitMemory(Address base, size_t size,
406 Executability executable) { 408 Executability executable) {
407 if (!base::VirtualMemory::CommitRegion(base, size, 409 if (!base::VirtualMemory::CommitRegion(base, size,
408 executable == EXECUTABLE)) { 410 executable == EXECUTABLE)) {
409 return false; 411 return false;
410 } 412 }
411 UpdateAllocatedSpaceLimits(base, base + size); 413 UpdateAllocatedSpaceLimits(base, base + size);
412 return true; 414 return true;
(...skipping 2833 matching lines...) Expand 10 before | Expand all | Expand 10 after
3246 object->ShortPrint(); 3248 object->ShortPrint();
3247 PrintF("\n"); 3249 PrintF("\n");
3248 } 3250 }
3249 printf(" --------------------------------------\n"); 3251 printf(" --------------------------------------\n");
3250 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3252 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3251 } 3253 }
3252 3254
3253 #endif // DEBUG 3255 #endif // DEBUG
3254 } // namespace internal 3256 } // namespace internal
3255 } // namespace v8 3257 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698