| 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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(int size_in_bytes) { | 254 HeapObject* PagedSpace::AllocateLinearly(int size_in_bytes) { |
| 255 Address current_top = allocation_info_.top; | 255 Address current_top = allocation_info_.top; |
| 256 Address new_top = current_top + size_in_bytes; | 256 Address new_top = current_top + size_in_bytes; |
| 257 if (new_top > allocation_info_.limit) return NULL; | 257 if (new_top > allocation_info_.limit) return NULL; |
| 258 | 258 |
| 259 allocation_info_.top = new_top; | 259 allocation_info_.top = new_top; |
| 260 ASSERT(allocation_info_.VerifyPagedAllocation()); | |
| 261 ASSERT(current_top != NULL); | |
| 262 return HeapObject::FromAddress(current_top); | 260 return HeapObject::FromAddress(current_top); |
| 263 } | 261 } |
| 264 | 262 |
| 265 | 263 |
| 266 // Raw allocation. | 264 // Raw allocation. |
| 267 MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) { | 265 MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) { |
| 268 ASSERT(HasBeenSetup()); | |
| 269 ASSERT_OBJECT_SIZE(size_in_bytes); | |
| 270 HeapObject* object = AllocateLinearly(size_in_bytes); | 266 HeapObject* object = AllocateLinearly(size_in_bytes); |
| 271 if (object != NULL) { | 267 if (object != NULL) { |
| 272 if (identity() == CODE_SPACE) { | 268 if (identity() == CODE_SPACE) { |
| 273 SkipList::Update(object->address(), size_in_bytes); | 269 SkipList::Update(object->address(), size_in_bytes); |
| 274 } | 270 } |
| 275 return object; | 271 return object; |
| 276 } | 272 } |
| 277 | 273 |
| 278 object = free_list_.Allocate(size_in_bytes); | 274 object = free_list_.Allocate(size_in_bytes); |
| 279 if (object != NULL) { | 275 if (object != NULL) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 Map* map = object->map(); | 359 Map* map = object->map(); |
| 364 Heap* heap = object->GetHeap(); | 360 Heap* heap = object->GetHeap(); |
| 365 return map == heap->raw_unchecked_free_space_map() | 361 return map == heap->raw_unchecked_free_space_map() |
| 366 || map == heap->raw_unchecked_one_pointer_filler_map() | 362 || map == heap->raw_unchecked_one_pointer_filler_map() |
| 367 || map == heap->raw_unchecked_two_pointer_filler_map(); | 363 || map == heap->raw_unchecked_two_pointer_filler_map(); |
| 368 } | 364 } |
| 369 | 365 |
| 370 } } // namespace v8::internal | 366 } } // namespace v8::internal |
| 371 | 367 |
| 372 #endif // V8_SPACES_INL_H_ | 368 #endif // V8_SPACES_INL_H_ |
| OLD | NEW |