OLD | NEW |
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 Loading... |
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(); |
397 // We cannot free memory chunks in new space while the sweeper is running | 398 // We cannot free memory chunks in new space while the sweeper is running |
398 // since a sweeper thread might be stuck right before trying to lock the | 399 // since a sweeper thread might be stuck right before trying to lock the |
399 // corresponding page. | 400 // corresponding page. |
400 | 401 return !chunk->InNewSpace() || (mc == nullptr) || !FLAG_concurrent_sweeping || |
401 // Chunks in old generation are unmapped if they are empty. | 402 mc->sweeper().IsSweepingCompleted(); |
402 DCHECK(chunk->InNewSpace() || chunk->SweepingDone()); | |
403 return !chunk->InNewSpace() || !FLAG_concurrent_sweeping || | |
404 chunk->SweepingDone(); | |
405 } | 403 } |
406 | 404 |
407 bool MemoryAllocator::CommitMemory(Address base, size_t size, | 405 bool MemoryAllocator::CommitMemory(Address base, size_t size, |
408 Executability executable) { | 406 Executability executable) { |
409 if (!base::VirtualMemory::CommitRegion(base, size, | 407 if (!base::VirtualMemory::CommitRegion(base, size, |
410 executable == EXECUTABLE)) { | 408 executable == EXECUTABLE)) { |
411 return false; | 409 return false; |
412 } | 410 } |
413 UpdateAllocatedSpaceLimits(base, base + size); | 411 UpdateAllocatedSpaceLimits(base, base + size); |
414 return true; | 412 return true; |
(...skipping 2833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3248 object->ShortPrint(); | 3246 object->ShortPrint(); |
3249 PrintF("\n"); | 3247 PrintF("\n"); |
3250 } | 3248 } |
3251 printf(" --------------------------------------\n"); | 3249 printf(" --------------------------------------\n"); |
3252 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3250 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3253 } | 3251 } |
3254 | 3252 |
3255 #endif // DEBUG | 3253 #endif // DEBUG |
3256 } // namespace internal | 3254 } // namespace internal |
3257 } // namespace v8 | 3255 } // namespace v8 |
OLD | NEW |