| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 bool Page::IsRSetSet(Address address, int offset) { | 167 bool Page::IsRSetSet(Address address, int offset) { |
| 168 uint32_t bitmask = 0; | 168 uint32_t bitmask = 0; |
| 169 Address rset_address = ComputeRSetBitPosition(address, offset, &bitmask); | 169 Address rset_address = ComputeRSetBitPosition(address, offset, &bitmask); |
| 170 return (Memory::uint32_at(rset_address) & bitmask) != 0; | 170 return (Memory::uint32_at(rset_address) & bitmask) != 0; |
| 171 } | 171 } |
| 172 | 172 |
| 173 | 173 |
| 174 // ----------------------------------------------------------------------------- | 174 // ----------------------------------------------------------------------------- |
| 175 // MemoryAllocator | 175 // MemoryAllocator |
| 176 | 176 |
| 177 bool MemoryAllocator::ResetBlock(Address start, size_t size, |
| 178 Executability executable) { |
| 179 return initial_chunk_->Reset(start, size, executable == EXECUTABLE); |
| 180 } |
| 181 |
| 177 bool MemoryAllocator::IsValidChunk(int chunk_id) { | 182 bool MemoryAllocator::IsValidChunk(int chunk_id) { |
| 178 if (!IsValidChunkId(chunk_id)) return false; | 183 if (!IsValidChunkId(chunk_id)) return false; |
| 179 | 184 |
| 180 ChunkInfo& c = chunks_[chunk_id]; | 185 ChunkInfo& c = chunks_[chunk_id]; |
| 181 return (c.address() != NULL) && (c.size() != 0) && (c.owner() != NULL); | 186 return (c.address() != NULL) && (c.size() != 0) && (c.owner() != NULL); |
| 182 } | 187 } |
| 183 | 188 |
| 184 | 189 |
| 185 bool MemoryAllocator::IsValidChunkId(int chunk_id) { | 190 bool MemoryAllocator::IsValidChunkId(int chunk_id) { |
| 186 return (0 <= chunk_id) && (chunk_id < max_nof_chunks_); | 191 return (0 <= chunk_id) && (chunk_id < max_nof_chunks_); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 if (object != NULL) return object; | 320 if (object != NULL) return object; |
| 316 | 321 |
| 317 object = SlowMCAllocateRaw(size_in_bytes); | 322 object = SlowMCAllocateRaw(size_in_bytes); |
| 318 if (object != NULL) return object; | 323 if (object != NULL) return object; |
| 319 | 324 |
| 320 return Failure::RetryAfterGC(size_in_bytes, identity()); | 325 return Failure::RetryAfterGC(size_in_bytes, identity()); |
| 321 } | 326 } |
| 322 | 327 |
| 323 | 328 |
| 324 // ----------------------------------------------------------------------------- | 329 // ----------------------------------------------------------------------------- |
| 330 // SemiSpace |
| 331 |
| 332 bool SemiSpace::Reset() { |
| 333 return MemoryAllocator::ResetBlock(start_, capacity_, executable()); |
| 334 } |
| 335 |
| 336 // ----------------------------------------------------------------------------- |
| 325 // LargeObjectChunk | 337 // LargeObjectChunk |
| 326 | 338 |
| 327 HeapObject* LargeObjectChunk::GetObject() { | 339 HeapObject* LargeObjectChunk::GetObject() { |
| 328 // Round the chunk address up to the nearest page-aligned address | 340 // Round the chunk address up to the nearest page-aligned address |
| 329 // and return the heap object in that page. | 341 // and return the heap object in that page. |
| 330 Page* page = Page::FromAddress(RoundUp(address(), Page::kPageSize)); | 342 Page* page = Page::FromAddress(RoundUp(address(), Page::kPageSize)); |
| 331 return HeapObject::FromAddress(page->ObjectAreaStart()); | 343 return HeapObject::FromAddress(page->ObjectAreaStart()); |
| 332 } | 344 } |
| 333 | 345 |
| 334 | 346 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 363 | 375 |
| 364 bool FreeListNode::IsFreeListNode(HeapObject* object) { | 376 bool FreeListNode::IsFreeListNode(HeapObject* object) { |
| 365 return object->map() == Heap::raw_unchecked_byte_array_map() | 377 return object->map() == Heap::raw_unchecked_byte_array_map() |
| 366 || object->map() == Heap::raw_unchecked_one_pointer_filler_map() | 378 || object->map() == Heap::raw_unchecked_one_pointer_filler_map() |
| 367 || object->map() == Heap::raw_unchecked_two_pointer_filler_map(); | 379 || object->map() == Heap::raw_unchecked_two_pointer_filler_map(); |
| 368 } | 380 } |
| 369 | 381 |
| 370 } } // namespace v8::internal | 382 } } // namespace v8::internal |
| 371 | 383 |
| 372 #endif // V8_SPACES_INL_H_ | 384 #endif // V8_SPACES_INL_H_ |
| OLD | NEW |