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

Unified Diff: src/spaces.cc

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, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/spaces.h ('k') | src/spaces-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/spaces.cc
===================================================================
--- src/spaces.cc (revision 9014)
+++ src/spaces.cc (working copy)
@@ -2722,12 +2722,17 @@
LargeObjectChunk* chunk = reinterpret_cast<LargeObjectChunk*>(mem);
chunk->size_ = size;
- Page* page = Page::FromAddress(RoundUp(chunk->address(), Page::kPageSize));
- page->heap_ = isolate->heap();
+ chunk->GetPage()->heap_ = isolate->heap();
return chunk;
}
+void LargeObjectChunk::Free(Executability executable) {
+ Isolate* isolate = GetPage()->heap_->isolate();
+ isolate->memory_allocator()->FreeRawMemory(address(), size(), executable);
+}
+
+
int LargeObjectChunk::ChunkSizeFor(int size_in_bytes) {
int os_alignment = static_cast<int>(OS::AllocateAlignment());
if (os_alignment < Page::kPageSize) {
@@ -2761,8 +2766,7 @@
LargeObjectChunk* chunk = first_chunk_;
first_chunk_ = first_chunk_->next();
LOG(heap()->isolate(), DeleteEvent("LargeObjectChunk", chunk->address()));
- Page* page = Page::FromAddress(RoundUp(chunk->address(), Page::kPageSize));
- Executability executable = page->PageExecutability();
+ Executability executable = chunk->GetPage()->PageExecutability();
ObjectSpace space = kObjectSpaceLoSpace;
if (executable == EXECUTABLE) space = kObjectSpaceCodeSpace;
size_t size = chunk->size();
@@ -2805,7 +2809,7 @@
first_chunk_ = chunk;
// Initialize page header.
- Page* page = Page::FromAddress(RoundUp(chunk->address(), Page::kPageSize));
+ Page* page = chunk->GetPage();
Address object_address = page->ObjectAreaStart();
// Clear the low order bit of the second word in the page to flag it as a
@@ -2943,9 +2947,7 @@
previous = current;
current = current->next();
} else {
- Page* page = Page::FromAddress(RoundUp(current->address(),
- Page::kPageSize));
- Executability executable = page->PageExecutability();
+ Executability executable = current->GetPage()->PageExecutability();
Address chunk_address = current->address();
size_t chunk_size = current->size();
« no previous file with comments | « src/spaces.h ('k') | src/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698