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

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

Issue 9179012: Reduce boot-up memory use of V8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 11 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
OLDNEW
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 #endif 157 #endif
158 158
159 159
160 // -------------------------------------------------------------------------- 160 // --------------------------------------------------------------------------
161 // PagedSpace 161 // PagedSpace
162 Page* Page::Initialize(Heap* heap, 162 Page* Page::Initialize(Heap* heap,
163 MemoryChunk* chunk, 163 MemoryChunk* chunk,
164 Executability executable, 164 Executability executable,
165 PagedSpace* owner) { 165 PagedSpace* owner) {
166 Page* page = reinterpret_cast<Page*>(chunk); 166 Page* page = reinterpret_cast<Page*>(chunk);
167 ASSERT(chunk->size() == static_cast<size_t>(kPageSize)); 167 ASSERT(chunk->size() <= kPageSize);
168 ASSERT(chunk->owner() == owner); 168 ASSERT(chunk->owner() == owner);
169 owner->IncreaseCapacity(Page::kObjectAreaSize); 169 intptr_t object_bytes = page->ObjectAreaEnd() - page->ObjectAreaStart();
170 owner->Free(page->ObjectAreaStart(), 170 owner->IncreaseCapacity(object_bytes);
171 static_cast<int>(page->ObjectAreaEnd() - 171 owner->AddToFreeLists(page->ObjectAreaStart(),
172 page->ObjectAreaStart())); 172 static_cast<int>(object_bytes));
173 173
174 heap->incremental_marking()->SetOldSpacePageFlags(chunk); 174 heap->incremental_marking()->SetOldSpacePageFlags(chunk);
175 175
176 return page; 176 return page;
177 } 177 }
178 178
179 179
180 bool PagedSpace::Contains(Address addr) { 180 bool PagedSpace::Contains(Address addr) {
181 Page* p = Page::FromAddress(addr); 181 Page* p = Page::FromAddress(addr);
182 if (!p->is_valid()) return false; 182 if (!p->is_valid()) return false;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 (e.g. move to the next page or try free list 251 // not contain slow case logic (e.g. 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(new_top >= Page::FromAddress(new_top - 1)->ObjectAreaStart());
Vyacheslav Egorov (Chromium) 2012/01/16 17:02:54 FromAllocationTop instead of FromAddress
Erik Corry 2012/01/17 11:37:22 Done.
260 return HeapObject::FromAddress(current_top); 261 return HeapObject::FromAddress(current_top);
261 } 262 }
262 263
263 264
264 // Raw allocation. 265 // Raw allocation.
265 MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) { 266 MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) {
266 HeapObject* object = AllocateLinearly(size_in_bytes); 267 HeapObject* object = AllocateLinearly(size_in_bytes);
267 if (object != NULL) { 268 if (object != NULL) {
268 if (identity() == CODE_SPACE) { 269 if (identity() == CODE_SPACE) {
269 SkipList::Update(object->address(), size_in_bytes); 270 SkipList::Update(object->address(), size_in_bytes);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 Map* map = object->map(); 342 Map* map = object->map();
342 Heap* heap = object->GetHeap(); 343 Heap* heap = object->GetHeap();
343 return map == heap->raw_unchecked_free_space_map() 344 return map == heap->raw_unchecked_free_space_map()
344 || map == heap->raw_unchecked_one_pointer_filler_map() 345 || map == heap->raw_unchecked_one_pointer_filler_map()
345 || map == heap->raw_unchecked_two_pointer_filler_map(); 346 || map == heap->raw_unchecked_two_pointer_filler_map();
346 } 347 }
347 348
348 } } // namespace v8::internal 349 } } // namespace v8::internal
349 350
350 #endif // V8_SPACES_INL_H_ 351 #endif // V8_SPACES_INL_H_
OLDNEW
« src/spaces.cc ('K') | « src/spaces.cc ('k') | src/store-buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698