| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 } | 85 } |
| 86 | 86 |
| 87 | 87 |
| 88 Address Page::AllocationTop() { | 88 Address Page::AllocationTop() { |
| 89 PagedSpace* owner = MemoryAllocator::PageOwner(this); | 89 PagedSpace* owner = MemoryAllocator::PageOwner(this); |
| 90 return owner->PageAllocationTop(this); | 90 return owner->PageAllocationTop(this); |
| 91 } | 91 } |
| 92 | 92 |
| 93 | 93 |
| 94 void Page::ClearRSet() { | 94 void Page::ClearRSet() { |
| 95 #ifndef V8_HOST_ARCH_64_BIT |
| 95 // This method can be called in all rset states. | 96 // This method can be called in all rset states. |
| 96 memset(RSetStart(), 0, kRSetEndOffset - kRSetStartOffset); | 97 memset(RSetStart(), 0, kRSetEndOffset - kRSetStartOffset); |
| 98 #endif |
| 97 } | 99 } |
| 98 | 100 |
| 99 | 101 |
| 100 // Give an address a (32-bits): | 102 // Give an address a (32-bits): |
| 101 // | page address | words (6) | bit offset (5) | pointer alignment (2) | | 103 // | page address | words (6) | bit offset (5) | pointer alignment (2) | |
| 102 // The rset address is computed as: | 104 // The rset address is computed as: |
| 103 // page_address + words * 4 | 105 // page_address + words * 4 |
| 104 | 106 |
| 105 Address Page::ComputeRSetBitPosition(Address address, int offset, | 107 Address Page::ComputeRSetBitPosition(Address address, int offset, |
| 106 uint32_t* bitmask) { | 108 uint32_t* bitmask) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 189 |
| 188 ChunkInfo& c = chunks_[chunk_id]; | 190 ChunkInfo& c = chunks_[chunk_id]; |
| 189 return (c.address() <= p->address()) && | 191 return (c.address() <= p->address()) && |
| 190 (p->address() < c.address() + c.size()) && | 192 (p->address() < c.address() + c.size()) && |
| 191 (space == c.owner()); | 193 (space == c.owner()); |
| 192 } | 194 } |
| 193 | 195 |
| 194 | 196 |
| 195 Page* MemoryAllocator::GetNextPage(Page* p) { | 197 Page* MemoryAllocator::GetNextPage(Page* p) { |
| 196 ASSERT(p->is_valid()); | 198 ASSERT(p->is_valid()); |
| 197 int raw_addr = p->opaque_header & ~Page::kPageAlignmentMask; | 199 intptr_t raw_addr = p->opaque_header & ~Page::kPageAlignmentMask; |
| 198 return Page::FromAddress(AddressFrom<Address>(raw_addr)); | 200 return Page::FromAddress(AddressFrom<Address>(raw_addr)); |
| 199 } | 201 } |
| 200 | 202 |
| 201 | 203 |
| 202 int MemoryAllocator::GetChunkId(Page* p) { | 204 int MemoryAllocator::GetChunkId(Page* p) { |
| 203 ASSERT(p->is_valid()); | 205 ASSERT(p->is_valid()); |
| 204 return p->opaque_header & Page::kPageAlignmentMask; | 206 return p->opaque_header & Page::kPageAlignmentMask; |
| 205 } | 207 } |
| 206 | 208 |
| 207 | 209 |
| 208 void MemoryAllocator::SetNextPage(Page* prev, Page* next) { | 210 void MemoryAllocator::SetNextPage(Page* prev, Page* next) { |
| 209 ASSERT(prev->is_valid()); | 211 ASSERT(prev->is_valid()); |
| 210 int chunk_id = prev->opaque_header & Page::kPageAlignmentMask; | 212 int chunk_id = GetChunkId(prev); |
| 211 ASSERT_PAGE_ALIGNED(next->address()); | 213 ASSERT_PAGE_ALIGNED(next->address()); |
| 212 prev->opaque_header = OffsetFrom(next->address()) | chunk_id; | 214 prev->opaque_header = OffsetFrom(next->address()) | chunk_id; |
| 213 } | 215 } |
| 214 | 216 |
| 215 | 217 |
| 216 PagedSpace* MemoryAllocator::PageOwner(Page* page) { | 218 PagedSpace* MemoryAllocator::PageOwner(Page* page) { |
| 217 int chunk_id = GetChunkId(page); | 219 int chunk_id = GetChunkId(page); |
| 218 ASSERT(IsValidChunk(chunk_id)); | 220 ASSERT(IsValidChunk(chunk_id)); |
| 219 return chunks_[chunk_id].owner(); | 221 return chunks_[chunk_id].owner(); |
| 220 } | 222 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 ASSERT(space->low() <= alloc_info->top | 350 ASSERT(space->low() <= alloc_info->top |
| 349 && alloc_info->top <= space->high() | 351 && alloc_info->top <= space->high() |
| 350 && alloc_info->limit == space->high()); | 352 && alloc_info->limit == space->high()); |
| 351 #endif | 353 #endif |
| 352 return obj; | 354 return obj; |
| 353 } | 355 } |
| 354 | 356 |
| 355 } } // namespace v8::internal | 357 } } // namespace v8::internal |
| 356 | 358 |
| 357 #endif // V8_SPACES_INL_H_ | 359 #endif // V8_SPACES_INL_H_ |
| OLD | NEW |