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 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 // function also writes a map to the first word of the block so that it | 1263 // function also writes a map to the first word of the block so that it |
1264 // looks like a heap object to the garbage collector and heap iteration | 1264 // looks like a heap object to the garbage collector and heap iteration |
1265 // functions. | 1265 // functions. |
1266 void set_size(int size_in_bytes); | 1266 void set_size(int size_in_bytes); |
1267 | 1267 |
1268 // Accessors for the next field. | 1268 // Accessors for the next field. |
1269 inline Address next(); | 1269 inline Address next(); |
1270 inline void set_next(Address next); | 1270 inline void set_next(Address next); |
1271 | 1271 |
1272 private: | 1272 private: |
1273 static const int kNextOffset = Array::kHeaderSize; | 1273 static const int kNextOffset = POINTER_SIZE_ALIGN(ByteArray::kHeaderSize); |
1274 | 1274 |
1275 DISALLOW_IMPLICIT_CONSTRUCTORS(FreeListNode); | 1275 DISALLOW_IMPLICIT_CONSTRUCTORS(FreeListNode); |
1276 }; | 1276 }; |
1277 | 1277 |
1278 | 1278 |
1279 // The free list for the old space. | 1279 // The free list for the old space. |
1280 class OldSpaceFreeList BASE_EMBEDDED { | 1280 class OldSpaceFreeList BASE_EMBEDDED { |
1281 public: | 1281 public: |
1282 explicit OldSpaceFreeList(AllocationSpace owner); | 1282 explicit OldSpaceFreeList(AllocationSpace owner); |
1283 | 1283 |
(...skipping 13 matching lines...) Expand all Loading... |
1297 | 1297 |
1298 // Allocate a block of size 'size_in_bytes' from the free list. The block | 1298 // Allocate a block of size 'size_in_bytes' from the free list. The block |
1299 // is unitialized. A failure is returned if no block is available. The | 1299 // is unitialized. A failure is returned if no block is available. The |
1300 // number of bytes lost to fragmentation is returned in the output parameter | 1300 // number of bytes lost to fragmentation is returned in the output parameter |
1301 // 'wasted_bytes'. The size should be a non-zero multiple of the word size. | 1301 // 'wasted_bytes'. The size should be a non-zero multiple of the word size. |
1302 Object* Allocate(int size_in_bytes, int* wasted_bytes); | 1302 Object* Allocate(int size_in_bytes, int* wasted_bytes); |
1303 | 1303 |
1304 private: | 1304 private: |
1305 // The size range of blocks, in bytes. (Smaller allocations are allowed, but | 1305 // The size range of blocks, in bytes. (Smaller allocations are allowed, but |
1306 // will always result in waste.) | 1306 // will always result in waste.) |
1307 static const int kMinBlockSize = Array::kHeaderSize + kPointerSize; | 1307 static const int kMinBlockSize = |
| 1308 POINTER_SIZE_ALIGN(ByteArray::kHeaderSize) + kPointerSize; |
1308 static const int kMaxBlockSize = Page::kMaxHeapObjectSize; | 1309 static const int kMaxBlockSize = Page::kMaxHeapObjectSize; |
1309 | 1310 |
1310 // The identity of the owning space, for building allocation Failure | 1311 // The identity of the owning space, for building allocation Failure |
1311 // objects. | 1312 // objects. |
1312 AllocationSpace owner_; | 1313 AllocationSpace owner_; |
1313 | 1314 |
1314 // Total available bytes in all blocks on this free list. | 1315 // Total available bytes in all blocks on this free list. |
1315 int available_; | 1316 int available_; |
1316 | 1317 |
1317 // Blocks are put on exact free lists in an array, indexed by size in words. | 1318 // Blocks are put on exact free lists in an array, indexed by size in words. |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1729 | 1730 |
1730 private: | 1731 private: |
1731 LargeObjectChunk* current_; | 1732 LargeObjectChunk* current_; |
1732 HeapObjectCallback size_func_; | 1733 HeapObjectCallback size_func_; |
1733 }; | 1734 }; |
1734 | 1735 |
1735 | 1736 |
1736 } } // namespace v8::internal | 1737 } } // namespace v8::internal |
1737 | 1738 |
1738 #endif // V8_SPACES_H_ | 1739 #endif // V8_SPACES_H_ |
OLD | NEW |