Chromium Code Reviews| Index: src/spaces.h |
| =================================================================== |
| --- src/spaces.h (revision 3575) |
| +++ src/spaces.h (working copy) |
| @@ -305,6 +305,13 @@ |
| virtual void Print() = 0; |
| #endif |
| + // After calling this we can allocate a certain number of bytes using only |
| + // linear allocation (with a LinearAllocationScope and an AlwaysAllocateScope) |
| + // without using freelists or causing a GC. This is used by partial |
| + // snapshots. It returns true of space was reserved or false if a GC is |
|
Mads Ager (chromium)
2010/01/12 14:17:49
of space -> if space
|
| + // needed. |
| + virtual bool ReserveSpace(int bytes) = 0; |
| + |
| private: |
| AllocationSpace id_; |
| Executability executable_; |
| @@ -887,7 +894,11 @@ |
| // collection. |
| inline Object* MCAllocateRaw(int size_in_bytes); |
| + virtual bool ReserveSpace(int bytes); |
| + // Used by ReserveSpace. |
| + virtual void PutRestOfCurrentPageOnFreeList(Page* current_page) = 0; |
| + |
| // --------------------------------------------------------------------------- |
| // Mark-compact collection support functions |
| @@ -1115,13 +1126,18 @@ |
| return static_cast<int>(addr - low()); |
| } |
| - // If we don't have this here then SemiSpace will be abstract. However |
| - // it should never be called. |
| + // If we don't have these here then SemiSpace will be abstract. However |
| + // they should never be called. |
| virtual int Size() { |
| UNREACHABLE(); |
| return 0; |
| } |
| + virtual bool ReserveSpace(int bytes) { |
| + UNREACHABLE(); |
| + return false; |
| + } |
| + |
| bool is_committed() { return committed_; } |
| bool Commit(); |
| bool Uncommit(); |
| @@ -1345,6 +1361,8 @@ |
| bool ToSpaceContains(Address a) { return to_space_.Contains(a); } |
| bool FromSpaceContains(Address a) { return from_space_.Contains(a); } |
| + virtual bool ReserveSpace(int bytes); |
| + |
| #ifdef ENABLE_HEAP_PROTECTION |
| // Protect/unprotect the space by marking it read-only/writable. |
| virtual void Protect(); |
| @@ -1631,6 +1649,8 @@ |
| // collection. |
| virtual void MCCommitRelocationInfo(); |
| + virtual void PutRestOfCurrentPageOnFreeList(Page* current_page); |
| + |
| #ifdef DEBUG |
| // Reports statistics for the space |
| void ReportStatistics(); |
| @@ -1692,6 +1712,8 @@ |
| // collection. |
| virtual void MCCommitRelocationInfo(); |
| + virtual void PutRestOfCurrentPageOnFreeList(Page* current_page); |
| + |
| #ifdef DEBUG |
| // Reports statistic info of the space |
| void ReportStatistics(); |
| @@ -1899,6 +1921,11 @@ |
| // Checks whether the space is empty. |
| bool IsEmpty() { return first_chunk_ == NULL; } |
| + // See the comments for ReserveSpace in the Space class. This has to be |
| + // called after ReserveSpace has been called on the paged spaces, since they |
| + // may use some memory, leaving less for large objects. |
| + virtual bool ReserveSpace(int bytes); |
| + |
| #ifdef ENABLE_HEAP_PROTECTION |
| // Protect/unprotect the space by marking it read-only/writable. |
| void Protect(); |