| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 void Page::set_prev_page(Page* page) { | 244 void Page::set_prev_page(Page* page) { |
| 245 ASSERT(page->owner() == owner()); | 245 ASSERT(page->owner() == owner()); |
| 246 set_prev_chunk(page); | 246 set_prev_chunk(page); |
| 247 } | 247 } |
| 248 | 248 |
| 249 | 249 |
| 250 // Try linear allocation in the page of alloc_info's allocation top. Does | 250 // Try linear allocation in the page of alloc_info's allocation top. Does |
| 251 // not contain slow case logic (eg, move to the next page or try free list | 251 // not contain slow case logic (eg, move to the next page or try free list |
| 252 // allocation) so it can be used by all the allocation functions and for all | 252 // allocation) so it can be used by all the allocation functions and for all |
| 253 // the paged spaces. | 253 // the paged spaces. |
| 254 HeapObject* PagedSpace::AllocateLinearly(AllocationInfo* alloc_info, | 254 HeapObject* PagedSpace::AllocateLinearly(int size_in_bytes) { |
| 255 int size_in_bytes) { | 255 Address current_top = allocation_info_.top; |
| 256 Address current_top = alloc_info->top; | |
| 257 Address new_top = current_top + size_in_bytes; | 256 Address new_top = current_top + size_in_bytes; |
| 258 if (new_top > alloc_info->limit) return NULL; | 257 if (new_top > allocation_info_.limit) return NULL; |
| 259 | 258 |
| 260 alloc_info->top = new_top; | 259 allocation_info_.top = new_top; |
| 261 ASSERT(alloc_info->VerifyPagedAllocation()); | 260 ASSERT(allocation_info_.VerifyPagedAllocation()); |
| 262 ASSERT(current_top != NULL); | 261 ASSERT(current_top != NULL); |
| 263 return HeapObject::FromAddress(current_top); | 262 return HeapObject::FromAddress(current_top); |
| 264 } | 263 } |
| 265 | 264 |
| 266 | 265 |
| 267 // Raw allocation. | 266 // Raw allocation. |
| 268 MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) { | 267 MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) { |
| 269 ASSERT(HasBeenSetup()); | 268 ASSERT(HasBeenSetup()); |
| 270 ASSERT_OBJECT_SIZE(size_in_bytes); | 269 ASSERT_OBJECT_SIZE(size_in_bytes); |
| 271 HeapObject* object = AllocateLinearly(&allocation_info_, size_in_bytes); | 270 HeapObject* object = AllocateLinearly(size_in_bytes); |
| 272 if (object != NULL) { | 271 if (object != NULL) { |
| 273 if (identity() == CODE_SPACE) { | 272 if (identity() == CODE_SPACE) { |
| 274 SkipList::Update(object->address(), size_in_bytes); | 273 SkipList::Update(object->address(), size_in_bytes); |
| 275 } | 274 } |
| 276 return object; | 275 return object; |
| 277 } | 276 } |
| 278 | 277 |
| 279 object = free_list_.Allocate(size_in_bytes); | 278 object = free_list_.Allocate(size_in_bytes); |
| 280 if (object != NULL) { | 279 if (object != NULL) { |
| 281 if (identity() == CODE_SPACE) { | 280 if (identity() == CODE_SPACE) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 Map* map = object->map(); | 363 Map* map = object->map(); |
| 365 Heap* heap = object->GetHeap(); | 364 Heap* heap = object->GetHeap(); |
| 366 return map == heap->raw_unchecked_free_space_map() | 365 return map == heap->raw_unchecked_free_space_map() |
| 367 || map == heap->raw_unchecked_one_pointer_filler_map() | 366 || map == heap->raw_unchecked_one_pointer_filler_map() |
| 368 || map == heap->raw_unchecked_two_pointer_filler_map(); | 367 || map == heap->raw_unchecked_two_pointer_filler_map(); |
| 369 } | 368 } |
| 370 | 369 |
| 371 } } // namespace v8::internal | 370 } } // namespace v8::internal |
| 372 | 371 |
| 373 #endif // V8_SPACES_INL_H_ | 372 #endif // V8_SPACES_INL_H_ |
| OLD | NEW |