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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 memory chunks in new space while the sweeper is running |
399 // 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 |
400 // corresponding page. | 400 // corresponding page. |
401 | |
402 // Chunks in old generation are unmapped if they are empty. | |
403 DCHECK(chunk->InNewSpace() || chunk->SweepingDone()); | |
401 return !chunk->InNewSpace() || (mc == nullptr) || !FLAG_concurrent_sweeping || | 404 return !chunk->InNewSpace() || (mc == nullptr) || !FLAG_concurrent_sweeping || |
402 mc->sweeper().IsSweepingCompleted(); | 405 chunk->SweepingDone(); |
Michael Lippautz
2016/10/18 16:02:39
I think (mc == nullptr) can go.
ulan
2016/10/18 16:07:05
Done.
| |
403 } | 406 } |
404 | 407 |
405 bool MemoryAllocator::CommitMemory(Address base, size_t size, | 408 bool MemoryAllocator::CommitMemory(Address base, size_t size, |
406 Executability executable) { | 409 Executability executable) { |
407 if (!base::VirtualMemory::CommitRegion(base, size, | 410 if (!base::VirtualMemory::CommitRegion(base, size, |
408 executable == EXECUTABLE)) { | 411 executable == EXECUTABLE)) { |
409 return false; | 412 return false; |
410 } | 413 } |
411 UpdateAllocatedSpaceLimits(base, base + size); | 414 UpdateAllocatedSpaceLimits(base, base + size); |
412 return true; | 415 return true; |
(...skipping 2833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3246 object->ShortPrint(); | 3249 object->ShortPrint(); |
3247 PrintF("\n"); | 3250 PrintF("\n"); |
3248 } | 3251 } |
3249 printf(" --------------------------------------\n"); | 3252 printf(" --------------------------------------\n"); |
3250 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3253 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3251 } | 3254 } |
3252 | 3255 |
3253 #endif // DEBUG | 3256 #endif // DEBUG |
3254 } // namespace internal | 3257 } // namespace internal |
3255 } // namespace v8 | 3258 } // namespace v8 |
OLD | NEW |