| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 MarkCompactCollector* mc = isolate_->heap()->mark_compact_collector(); |
| 398 // We cannot free memory chunks in new space while the sweeper is running | 398 // We cannot free a memory chunk in new space while the sweeper is running |
| 399 // since a sweeper thread might be stuck right before trying to lock the | 399 // because the memory chunk can be in the queue of a sweeper task. |
| 400 // corresponding page. | 400 // Chunks in old generation are unmapped if they are empty. |
| 401 return !chunk->InNewSpace() || (mc == nullptr) || !FLAG_concurrent_sweeping || | 401 DCHECK(chunk->InNewSpace() || chunk->SweepingDone()); |
| 402 mc->sweeper().IsSweepingCompleted(); | 402 return !chunk->InNewSpace() || mc == nullptr || !FLAG_concurrent_sweeping || |
| 403 mc->sweeper().IsSweepingCompleted(NEW_SPACE); |
| 403 } | 404 } |
| 404 | 405 |
| 405 bool MemoryAllocator::CommitMemory(Address base, size_t size, | 406 bool MemoryAllocator::CommitMemory(Address base, size_t size, |
| 406 Executability executable) { | 407 Executability executable) { |
| 407 if (!base::VirtualMemory::CommitRegion(base, size, | 408 if (!base::VirtualMemory::CommitRegion(base, size, |
| 408 executable == EXECUTABLE)) { | 409 executable == EXECUTABLE)) { |
| 409 return false; | 410 return false; |
| 410 } | 411 } |
| 411 UpdateAllocatedSpaceLimits(base, base + size); | 412 UpdateAllocatedSpaceLimits(base, base + size); |
| 412 return true; | 413 return true; |
| (...skipping 2824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3237 object->ShortPrint(); | 3238 object->ShortPrint(); |
| 3238 PrintF("\n"); | 3239 PrintF("\n"); |
| 3239 } | 3240 } |
| 3240 printf(" --------------------------------------\n"); | 3241 printf(" --------------------------------------\n"); |
| 3241 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3242 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
| 3242 } | 3243 } |
| 3243 | 3244 |
| 3244 #endif // DEBUG | 3245 #endif // DEBUG |
| 3245 } // namespace internal | 3246 } // namespace internal |
| 3246 } // namespace v8 | 3247 } // namespace v8 |
| OLD | NEW |