| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 object = SlowMCAllocateRaw(size_in_bytes); | 458 object = SlowMCAllocateRaw(size_in_bytes); |
| 459 if (object != NULL) return object; | 459 if (object != NULL) return object; |
| 460 | 460 |
| 461 return Failure::RetryAfterGC(identity()); | 461 return Failure::RetryAfterGC(identity()); |
| 462 } | 462 } |
| 463 | 463 |
| 464 | 464 |
| 465 // ----------------------------------------------------------------------------- | 465 // ----------------------------------------------------------------------------- |
| 466 // LargeObjectChunk | 466 // LargeObjectChunk |
| 467 | 467 |
| 468 HeapObject* LargeObjectChunk::GetObject() { | 468 Address LargeObjectChunk::GetStartAddress() { |
| 469 // Round the chunk address up to the nearest page-aligned address | 469 // Round the chunk address up to the nearest page-aligned address |
| 470 // and return the heap object in that page. | 470 // and return the heap object in that page. |
| 471 Page* page = Page::FromAddress(RoundUp(address(), Page::kPageSize)); | 471 Page* page = Page::FromAddress(RoundUp(address(), Page::kPageSize)); |
| 472 return HeapObject::FromAddress(page->ObjectAreaStart()); | 472 return page->ObjectAreaStart(); |
| 473 } | 473 } |
| 474 | 474 |
| 475 | 475 |
| 476 void LargeObjectChunk::Free(Executability executable) { |
| 477 Isolate* isolate = |
| 478 Page::FromAddress(RoundUp(address(), Page::kPageSize))->heap_->isolate(); |
| 479 isolate->memory_allocator()->FreeRawMemory(address(), size(), executable); |
| 480 } |
| 481 |
| 476 // ----------------------------------------------------------------------------- | 482 // ----------------------------------------------------------------------------- |
| 477 // LargeObjectSpace | 483 // LargeObjectSpace |
| 478 | 484 |
| 479 MaybeObject* NewSpace::AllocateRawInternal(int size_in_bytes, | 485 MaybeObject* NewSpace::AllocateRawInternal(int size_in_bytes, |
| 480 AllocationInfo* alloc_info) { | 486 AllocationInfo* alloc_info) { |
| 481 Address new_top = alloc_info->top + size_in_bytes; | 487 Address new_top = alloc_info->top + size_in_bytes; |
| 482 if (new_top > alloc_info->limit) return Failure::RetryAfterGC(); | 488 if (new_top > alloc_info->limit) return Failure::RetryAfterGC(); |
| 483 | 489 |
| 484 Object* obj = HeapObject::FromAddress(alloc_info->top); | 490 Object* obj = HeapObject::FromAddress(alloc_info->top); |
| 485 alloc_info->top = new_top; | 491 alloc_info->top = new_top; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 502 | 508 |
| 503 bool FreeListNode::IsFreeListNode(HeapObject* object) { | 509 bool FreeListNode::IsFreeListNode(HeapObject* object) { |
| 504 return object->map() == HEAP->raw_unchecked_byte_array_map() | 510 return object->map() == HEAP->raw_unchecked_byte_array_map() |
| 505 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map() | 511 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map() |
| 506 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map(); | 512 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map(); |
| 507 } | 513 } |
| 508 | 514 |
| 509 } } // namespace v8::internal | 515 } } // namespace v8::internal |
| 510 | 516 |
| 511 #endif // V8_SPACES_INL_H_ | 517 #endif // V8_SPACES_INL_H_ |
| OLD | NEW |