| Index: src/heap/spaces.h
|
| diff --git a/src/heap/spaces.h b/src/heap/spaces.h
|
| index ef294b243948b3cd4bbdc5101385baf295cb8a73..dcd336437e9cdc161ff5b157a3f1de512a4e051e 100644
|
| --- a/src/heap/spaces.h
|
| +++ b/src/heap/spaces.h
|
| @@ -900,6 +900,9 @@ class CodeRange {
|
| bool UncommitRawMemory(Address start, size_t length);
|
| void FreeRawMemory(Address buf, size_t length);
|
|
|
| + void ReserveEmergencyBlock();
|
| + void ReleaseEmergencyBlock();
|
| +
|
| private:
|
| Isolate* isolate_;
|
|
|
| @@ -908,6 +911,7 @@ class CodeRange {
|
| // Plain old data class, just a struct plus a constructor.
|
| class FreeBlock {
|
| public:
|
| + FreeBlock() : start(0), size(0) {}
|
| FreeBlock(Address start_arg, size_t size_arg)
|
| : start(start_arg), size(size_arg) {
|
| DCHECK(IsAddressAligned(start, MemoryChunk::kAlignment));
|
| @@ -932,6 +936,12 @@ class CodeRange {
|
| List<FreeBlock> allocation_list_;
|
| int current_allocation_block_index_;
|
|
|
| + // Emergency block guarantees that we can always allocate a page for
|
| + // evacuation candidates when code space is compacted. Emergency block is
|
| + // reserved immediately after GC and is released immedietely before
|
| + // allocating a page for evacuation.
|
| + FreeBlock emergency_block_;
|
| +
|
| // Finds a block on the allocation list that contains at least the
|
| // requested amount of memory. If none is found, sorts and merges
|
| // the existing free memory blocks, and searches again.
|
| @@ -940,6 +950,8 @@ class CodeRange {
|
| // Compares the start addresses of two free blocks.
|
| static int CompareFreeBlockAddress(const FreeBlock* left,
|
| const FreeBlock* right);
|
| + bool ReserveBlock(const size_t requested_size, FreeBlock* block);
|
| + void ReleaseBlock(const FreeBlock* block);
|
|
|
| DISALLOW_COPY_AND_ASSIGN(CodeRange);
|
| };
|
|
|