OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 virtual ~Space() {} | 294 virtual ~Space() {} |
295 | 295 |
296 // Does the space need executable memory? | 296 // Does the space need executable memory? |
297 Executability executable() { return executable_; } | 297 Executability executable() { return executable_; } |
298 | 298 |
299 // Identity used in error reporting. | 299 // Identity used in error reporting. |
300 AllocationSpace identity() { return id_; } | 300 AllocationSpace identity() { return id_; } |
301 | 301 |
302 virtual int Size() = 0; | 302 virtual int Size() = 0; |
303 | 303 |
| 304 #ifdef ENABLE_HEAP_PROTECTION |
| 305 // Protect/unprotect the space by marking it read-only/writable. |
| 306 virtual void Protect() = 0; |
| 307 virtual void Unprotect() = 0; |
| 308 #endif |
| 309 |
304 #ifdef DEBUG | 310 #ifdef DEBUG |
305 virtual void Print() = 0; | 311 virtual void Print() = 0; |
306 #endif | 312 #endif |
307 | 313 |
308 // After calling this we can allocate a certain number of bytes using only | 314 // After calling this we can allocate a certain number of bytes using only |
309 // linear allocation (with a LinearAllocationScope and an AlwaysAllocateScope) | 315 // linear allocation (with a LinearAllocationScope and an AlwaysAllocateScope) |
310 // without using freelists or causing a GC. This is used by partial | 316 // without using freelists or causing a GC. This is used by partial |
311 // snapshots. It returns true of space was reserved or false if a GC is | 317 // snapshots. It returns true of space was reserved or false if a GC is |
312 // needed. For paged spaces the space requested must include the space wasted | 318 // needed. For paged spaces the space requested must include the space wasted |
313 // at the end of each when allocating linearly. | 319 // at the end of each when allocating linearly. |
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 | 1168 |
1163 virtual bool ReserveSpace(int bytes) { | 1169 virtual bool ReserveSpace(int bytes) { |
1164 UNREACHABLE(); | 1170 UNREACHABLE(); |
1165 return false; | 1171 return false; |
1166 } | 1172 } |
1167 | 1173 |
1168 bool is_committed() { return committed_; } | 1174 bool is_committed() { return committed_; } |
1169 bool Commit(); | 1175 bool Commit(); |
1170 bool Uncommit(); | 1176 bool Uncommit(); |
1171 | 1177 |
| 1178 #ifdef ENABLE_HEAP_PROTECTION |
| 1179 // Protect/unprotect the space by marking it read-only/writable. |
| 1180 virtual void Protect() {} |
| 1181 virtual void Unprotect() {} |
| 1182 #endif |
| 1183 |
1172 #ifdef DEBUG | 1184 #ifdef DEBUG |
1173 virtual void Print(); | 1185 virtual void Print(); |
1174 virtual void Verify(); | 1186 virtual void Verify(); |
1175 #endif | 1187 #endif |
1176 | 1188 |
1177 // Returns the current capacity of the semi space. | 1189 // Returns the current capacity of the semi space. |
1178 int Capacity() { return capacity_; } | 1190 int Capacity() { return capacity_; } |
1179 | 1191 |
1180 // Returns the maximum capacity of the semi space. | 1192 // Returns the maximum capacity of the semi space. |
1181 int MaximumCapacity() { return maximum_capacity_; } | 1193 int MaximumCapacity() { return maximum_capacity_; } |
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2070 | 2082 |
2071 private: | 2083 private: |
2072 LargeObjectChunk* current_; | 2084 LargeObjectChunk* current_; |
2073 HeapObjectCallback size_func_; | 2085 HeapObjectCallback size_func_; |
2074 }; | 2086 }; |
2075 | 2087 |
2076 | 2088 |
2077 } } // namespace v8::internal | 2089 } } // namespace v8::internal |
2078 | 2090 |
2079 #endif // V8_SPACES_H_ | 2091 #endif // V8_SPACES_H_ |
OLD | NEW |