Chromium Code Reviews| Index: src/serialize.cc |
| =================================================================== |
| --- src/serialize.cc (revision 24979) |
| +++ src/serialize.cc (working copy) |
| @@ -1915,7 +1915,13 @@ |
| CHECK(space >= 0 && space < kNumberOfPreallocatedSpaces); |
| DCHECK(size > 0 && size <= Page::kMaxRegularHeapObjectSize); |
| uint32_t new_chunk_size = pending_chunk_[space] + size; |
| - if (new_chunk_size > static_cast<uint32_t>(Page::kMaxRegularHeapObjectSize)) { |
| + const int kMaxChunkSize = |
| + space == CODE_SPACE ? |
| + // Code page has addidional guard areas at the start and at the end. |
| + Page::kPageSize - (MemoryAllocator::CodePageAreaStartOffset() + |
| + MemoryAllocator::CodePageGuardSize()) : |
| + Page::kMaxRegularHeapObjectSize; |
|
Yang
2014/10/30 09:36:29
Wouldn't it be easier to use MemoryAllocator::Code
|
| + if (new_chunk_size > static_cast<uint32_t>(kMaxChunkSize)) { |
| // The new chunk size would not fit onto a single page. Complete the |
| // current chunk and start a new one. |
| completed_chunks_[space].Add(pending_chunk_[space]); |