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 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1325 | 1325 |
1326 int OldSpaceFreeList::Free(Address start, int size_in_bytes) { | 1326 int OldSpaceFreeList::Free(Address start, int size_in_bytes) { |
1327 #ifdef DEBUG | 1327 #ifdef DEBUG |
1328 for (int i = 0; i < size_in_bytes; i += kPointerSize) { | 1328 for (int i = 0; i < size_in_bytes; i += kPointerSize) { |
1329 Memory::Address_at(start + i) = kZapValue; | 1329 Memory::Address_at(start + i) = kZapValue; |
1330 } | 1330 } |
1331 #endif | 1331 #endif |
1332 FreeListNode* node = FreeListNode::FromAddress(start); | 1332 FreeListNode* node = FreeListNode::FromAddress(start); |
1333 node->set_size(size_in_bytes); | 1333 node->set_size(size_in_bytes); |
1334 | 1334 |
| 1335 // We don't use the freelists in compacting mode. This makes it more like a |
| 1336 // GC that only has mark-sweep-compact and doesn't have a mark-sweep |
| 1337 // collector. |
| 1338 if (FLAG_always_compact) { |
| 1339 return size_in_bytes; |
| 1340 } |
| 1341 |
1335 // Early return to drop too-small blocks on the floor (one or two word | 1342 // Early return to drop too-small blocks on the floor (one or two word |
1336 // blocks cannot hold a map pointer, a size field, and a pointer to the | 1343 // blocks cannot hold a map pointer, a size field, and a pointer to the |
1337 // next block in the free list). | 1344 // next block in the free list). |
1338 if (size_in_bytes < kMinBlockSize) { | 1345 if (size_in_bytes < kMinBlockSize) { |
1339 return size_in_bytes; | 1346 return size_in_bytes; |
1340 } | 1347 } |
1341 | 1348 |
1342 // Insert other blocks at the head of an exact free list. | 1349 // Insert other blocks at the head of an exact free list. |
1343 int index = size_in_bytes >> kPointerSizeLog2; | 1350 int index = size_in_bytes >> kPointerSizeLog2; |
1344 node->set_next(free_[index].head_node_); | 1351 node->set_next(free_[index].head_node_); |
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2618 reinterpret_cast<Object**>(object->address() | 2625 reinterpret_cast<Object**>(object->address() |
2619 + Page::kObjectAreaSize), | 2626 + Page::kObjectAreaSize), |
2620 allocation_top); | 2627 allocation_top); |
2621 PrintF("\n"); | 2628 PrintF("\n"); |
2622 } | 2629 } |
2623 } | 2630 } |
2624 } | 2631 } |
2625 #endif // DEBUG | 2632 #endif // DEBUG |
2626 | 2633 |
2627 } } // namespace v8::internal | 2634 } } // namespace v8::internal |
OLD | NEW |