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

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

Issue 14208005: Use worst-fit allocation in old space for prentured objects. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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') | test/cctest/test-spaces.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 HeapObject* PagedSpace::AllocateLinearly(int size_in_bytes) { 265 HeapObject* PagedSpace::AllocateLinearly(int size_in_bytes) {
266 Address current_top = allocation_info_.top; 266 Address current_top = allocation_info_.top;
267 Address new_top = current_top + size_in_bytes; 267 Address new_top = current_top + size_in_bytes;
268 if (new_top > allocation_info_.limit) return NULL; 268 if (new_top > allocation_info_.limit) return NULL;
269 269
270 allocation_info_.top = new_top; 270 allocation_info_.top = new_top;
271 return HeapObject::FromAddress(current_top); 271 return HeapObject::FromAddress(current_top);
272 } 272 }
273 273
274 274
275 // Raw allocation. 275 template MaybeObject* PagedSpace::
276 AllocateRaw<FreeList::BEST_FIT>(int size_in_bytes);
277
278
279 template MaybeObject* PagedSpace::
280 AllocateRaw<FreeList::WORST_FIT>(int size_in_bytes);
281
282
283 // Raw allocation
284 template<FreeList::AllocationStrategy strategy>
276 MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) { 285 MaybeObject* PagedSpace::AllocateRaw(int size_in_bytes) {
277 HeapObject* object = AllocateLinearly(size_in_bytes); 286 HeapObject* object = AllocateLinearly(size_in_bytes);
278 if (object != NULL) { 287 if (object != NULL) {
279 if (identity() == CODE_SPACE) { 288 if (identity() == CODE_SPACE) {
280 SkipList::Update(object->address(), size_in_bytes); 289 SkipList::Update(object->address(), size_in_bytes);
281 } 290 }
282 return object; 291 return object;
283 } 292 }
284 293
285 ASSERT(!heap()->linear_allocation() || 294 ASSERT(!heap()->linear_allocation() ||
286 (anchor_.next_chunk() == &anchor_ && 295 (anchor_.next_chunk() == &anchor_ &&
287 anchor_.prev_chunk() == &anchor_)); 296 anchor_.prev_chunk() == &anchor_));
288 297
289 object = free_list_.Allocate(size_in_bytes); 298 object = free_list_.Allocate<strategy>(size_in_bytes);
290 if (object != NULL) { 299 if (object != NULL) {
291 if (identity() == CODE_SPACE) { 300 if (identity() == CODE_SPACE) {
292 SkipList::Update(object->address(), size_in_bytes); 301 SkipList::Update(object->address(), size_in_bytes);
293 } 302 }
294 return object; 303 return object;
295 } 304 }
296 305
297 object = SlowAllocateRaw(size_in_bytes); 306 object = SlowAllocateRaw<strategy>(size_in_bytes);
298 if (object != NULL) { 307 if (object != NULL) {
299 if (identity() == CODE_SPACE) { 308 if (identity() == CODE_SPACE) {
300 SkipList::Update(object->address(), size_in_bytes); 309 SkipList::Update(object->address(), size_in_bytes);
301 } 310 }
302 return object; 311 return object;
303 } 312 }
304 313
305 return Failure::RetryAfterGC(identity()); 314 return Failure::RetryAfterGC(identity());
306 } 315 }
307 316
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 Map* map = object->map(); 364 Map* map = object->map();
356 Heap* heap = object->GetHeap(); 365 Heap* heap = object->GetHeap();
357 return map == heap->raw_unchecked_free_space_map() 366 return map == heap->raw_unchecked_free_space_map()
358 || map == heap->raw_unchecked_one_pointer_filler_map() 367 || map == heap->raw_unchecked_one_pointer_filler_map()
359 || map == heap->raw_unchecked_two_pointer_filler_map(); 368 || map == heap->raw_unchecked_two_pointer_filler_map();
360 } 369 }
361 370
362 } } // namespace v8::internal 371 } } // namespace v8::internal
363 372
364 #endif // V8_SPACES_INL_H_ 373 #endif // V8_SPACES_INL_H_
OLDNEW
« no previous file with comments | « src/spaces.cc ('k') | test/cctest/test-spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698