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

Side by Side Diff: third_party/WebKit/Source/platform/heap/HeapPage.cpp

Issue 2908463002: Enable heap compaction on all 'container' arenas. (Closed)
Patch Set: add checks for compaction being activated. Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapCompactTest.cpp ('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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 normal_page->Unlink(&first_unswept_page_); 497 normal_page->Unlink(&first_unswept_page_);
498 normal_page->MarkAsSwept(); 498 normal_page->MarkAsSwept();
499 // If not the first page, add |normalPage| onto the available pages chain. 499 // If not the first page, add |normalPage| onto the available pages chain.
500 if (!context.current_page_) 500 if (!context.current_page_)
501 context.current_page_ = normal_page; 501 context.current_page_ = normal_page;
502 else 502 else
503 normal_page->Link(&context.available_pages_); 503 normal_page->Link(&context.available_pages_);
504 normal_page->SweepAndCompact(context); 504 normal_page->SweepAndCompact(context);
505 } 505 }
506 506
507 // All pages were empty; nothing to compact.
508 if (!context.current_page_) {
509 heap.Compaction()->FinishedArenaCompaction(this, 0, 0);
510 return;
511 }
512
507 size_t freed_size = 0; 513 size_t freed_size = 0;
508 size_t freed_page_count = 0; 514 size_t freed_page_count = 0;
509 515
510 DCHECK(context.current_page_);
511 // If the current page hasn't been allocated into, add it to the available 516 // If the current page hasn't been allocated into, add it to the available
512 // list, for subsequent release below. 517 // list, for subsequent release below.
513 size_t allocation_point = context.allocation_point_; 518 size_t allocation_point = context.allocation_point_;
514 if (!allocation_point) { 519 if (!allocation_point) {
515 context.current_page_->Link(&context.available_pages_); 520 context.current_page_->Link(&context.available_pages_);
516 } else { 521 } else {
517 NormalPage* current_page = context.current_page_; 522 NormalPage* current_page = context.current_page_;
518 current_page->Link(&first_page_); 523 current_page->Link(&first_page_);
519 if (allocation_point != current_page->PayloadSize()) { 524 if (allocation_point != current_page->PayloadSize()) {
520 // Put the remainder of the page onto the free list. 525 // Put the remainder of the page onto the free list.
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 1844
1840 has_entries_ = true; 1845 has_entries_ = true;
1841 size_t index = GetHash(address); 1846 size_t index = GetHash(address);
1842 DCHECK(!(index & 1)); 1847 DCHECK(!(index & 1));
1843 Address cache_page = RoundToBlinkPageStart(address); 1848 Address cache_page = RoundToBlinkPageStart(address);
1844 entries_[index + 1] = entries_[index]; 1849 entries_[index + 1] = entries_[index];
1845 entries_[index] = cache_page; 1850 entries_[index] = cache_page;
1846 } 1851 }
1847 1852
1848 } // namespace blink 1853 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/HeapCompactTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698