Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Side by Side Diff: src/spaces-inl.h

Issue 7744023: Two tiny refactorings: Removed a bit of copy-n-paste. Moved LargeObjectChunk::Free from header to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/spaces.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2010 the V8 project authors. All rights reserved. 1 // Copyright 2006-2010 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 if (object != NULL) return object; 427 if (object != NULL) return object;
428 428
429 object = SlowMCAllocateRaw(size_in_bytes); 429 object = SlowMCAllocateRaw(size_in_bytes);
430 if (object != NULL) return object; 430 if (object != NULL) return object;
431 431
432 return Failure::RetryAfterGC(identity()); 432 return Failure::RetryAfterGC(identity());
433 } 433 }
434 434
435 435
436 // ----------------------------------------------------------------------------- 436 // -----------------------------------------------------------------------------
437 // LargeObjectChunk
438
439 Address LargeObjectChunk::GetStartAddress() {
440 // Round the chunk address up to the nearest page-aligned address
441 // and return the heap object in that page.
442 Page* page = Page::FromAddress(RoundUp(address(), Page::kPageSize));
443 return page->ObjectAreaStart();
444 }
445
446
447 void LargeObjectChunk::Free(Executability executable) {
448 Isolate* isolate =
449 Page::FromAddress(RoundUp(address(), Page::kPageSize))->heap_->isolate();
450 isolate->memory_allocator()->FreeRawMemory(address(), size(), executable);
451 }
452
453 // -----------------------------------------------------------------------------
454 // NewSpace 437 // NewSpace
455 438
456 MaybeObject* NewSpace::AllocateRawInternal(int size_in_bytes, 439 MaybeObject* NewSpace::AllocateRawInternal(int size_in_bytes,
457 AllocationInfo* alloc_info) { 440 AllocationInfo* alloc_info) {
458 Address new_top = alloc_info->top + size_in_bytes; 441 Address new_top = alloc_info->top + size_in_bytes;
459 if (new_top > alloc_info->limit) return Failure::RetryAfterGC(); 442 if (new_top > alloc_info->limit) return Failure::RetryAfterGC();
460 443
461 Object* obj = HeapObject::FromAddress(alloc_info->top); 444 Object* obj = HeapObject::FromAddress(alloc_info->top);
462 alloc_info->top = new_top; 445 alloc_info->top = new_top;
463 #ifdef DEBUG 446 #ifdef DEBUG
(...skipping 27 matching lines...) Expand all
491 474
492 bool FreeListNode::IsFreeListNode(HeapObject* object) { 475 bool FreeListNode::IsFreeListNode(HeapObject* object) {
493 return object->map() == HEAP->raw_unchecked_byte_array_map() 476 return object->map() == HEAP->raw_unchecked_byte_array_map()
494 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map() 477 || object->map() == HEAP->raw_unchecked_one_pointer_filler_map()
495 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map(); 478 || object->map() == HEAP->raw_unchecked_two_pointer_filler_map();
496 } 479 }
497 480
498 } } // namespace v8::internal 481 } } // namespace v8::internal
499 482
500 #endif // V8_SPACES_INL_H_ 483 #endif // V8_SPACES_INL_H_
OLDNEW
« no previous file with comments | « src/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698