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

Side by Side Diff: src/heap/spaces.h

Issue 1957323003: [heap] Add page evacuation mode for new->new (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase after fix Created 4 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_SPACES_H_ 5 #ifndef V8_HEAP_SPACES_H_
6 #define V8_HEAP_SPACES_H_ 6 #define V8_HEAP_SPACES_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "src/allocation.h" 10 #include "src/allocation.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 // Large objects can have a progress bar in their page header. These object 418 // Large objects can have a progress bar in their page header. These object
419 // are scanned in increments and will be kept black while being scanned. 419 // are scanned in increments and will be kept black while being scanned.
420 // Even if the mutator writes to them they will be kept black and a white 420 // Even if the mutator writes to them they will be kept black and a white
421 // to grey transition is performed in the value. 421 // to grey transition is performed in the value.
422 HAS_PROGRESS_BAR, 422 HAS_PROGRESS_BAR,
423 423
424 // |PAGE_NEW_OLD_PROMOTION|: A page tagged with this flag has been promoted 424 // |PAGE_NEW_OLD_PROMOTION|: A page tagged with this flag has been promoted
425 // from new to old space during evacuation. 425 // from new to old space during evacuation.
426 PAGE_NEW_OLD_PROMOTION, 426 PAGE_NEW_OLD_PROMOTION,
427 427
428 // |PAGE_NEW_NEW_PROMITION|: A page tagged with this flag has been moved
429 // within the new space during evacuation.
430 PAGE_NEW_NEW_PROMOTION,
431
428 // A black page has all mark bits set to 1 (black). A black page currently 432 // A black page has all mark bits set to 1 (black). A black page currently
429 // cannot be iterated because it is not swept. Moreover live bytes are also 433 // cannot be iterated because it is not swept. Moreover live bytes are also
430 // not updated. 434 // not updated.
431 BLACK_PAGE, 435 BLACK_PAGE,
432 436
433 // This flag is intended to be used for testing. Works only when both 437 // This flag is intended to be used for testing. Works only when both
434 // FLAG_stress_compaction and FLAG_manual_evacuation_candidates_selection 438 // FLAG_stress_compaction and FLAG_manual_evacuation_candidates_selection
435 // are set. It forces the page to become an evacuation candidate at next 439 // are set. It forces the page to become an evacuation candidate at next
436 // candidates selection cycle. 440 // candidates selection cycle.
437 FORCE_EVACUATION_CANDIDATE_FOR_TESTING, 441 FORCE_EVACUATION_CANDIDATE_FOR_TESTING,
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after
2433 2437
2434 // Returns the start address of the first page of the space. 2438 // Returns the start address of the first page of the space.
2435 Address space_start() { 2439 Address space_start() {
2436 DCHECK_NE(anchor_.next_page(), anchor()); 2440 DCHECK_NE(anchor_.next_page(), anchor());
2437 return anchor_.next_page()->area_start(); 2441 return anchor_.next_page()->area_start();
2438 } 2442 }
2439 2443
2440 Page* first_page() { return anchor_.next_page(); } 2444 Page* first_page() { return anchor_.next_page(); }
2441 Page* current_page() { return current_page_; } 2445 Page* current_page() { return current_page_; }
2442 2446
2447 bool OnLastPage() { return current_page() == anchor()->prev_page(); }
2448
2443 // Returns one past the end address of the space. 2449 // Returns one past the end address of the space.
2444 Address space_end() { return anchor_.prev_page()->area_end(); } 2450 Address space_end() { return anchor_.prev_page()->area_end(); }
2445 2451
2446 // Returns the start address of the current page of the space. 2452 // Returns the start address of the current page of the space.
2447 Address page_low() { return current_page_->area_start(); } 2453 Address page_low() { return current_page_->area_start(); }
2448 2454
2449 // Returns one past the end address of the current page of the space. 2455 // Returns one past the end address of the current page of the space.
2450 Address page_high() { return current_page_->area_end(); } 2456 Address page_high() { return current_page_->area_end(); }
2451 2457
2452 bool AdvancePage() { 2458 bool AdvancePage() {
2453 Page* next_page = current_page_->next_page(); 2459 Page* next_page = current_page_->next_page();
2454 if (next_page == anchor()) return false; 2460 if (next_page == anchor()) return false;
2455 current_page_ = next_page; 2461 current_page_ = next_page;
2456 return true; 2462 return true;
2457 } 2463 }
2458 2464
2459 // Resets the space to using the first page. 2465 // Resets the space to using the first page.
2460 void Reset(); 2466 void Reset();
2461 2467
2462 bool ReplaceWithEmptyPage(Page* page); 2468 bool ReplaceWithEmptyPage(Page* page);
2469 void PrependPage(Page* page);
2463 2470
2464 // Age mark accessors. 2471 // Age mark accessors.
2465 Address age_mark() { return age_mark_; } 2472 Address age_mark() { return age_mark_; }
2466 void set_age_mark(Address mark); 2473 void set_age_mark(Address mark);
2467 2474
2468 // Returns the current capacity of the semispace. 2475 // Returns the current capacity of the semispace.
2469 int current_capacity() { return current_capacity_; } 2476 int current_capacity() { return current_capacity_; }
2470 2477
2471 // Returns the maximum capacity of the semispace. 2478 // Returns the maximum capacity of the semispace.
2472 int maximum_capacity() { return maximum_capacity_; } 2479 int maximum_capacity() { return maximum_capacity_; }
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
2714 DCHECK_LE(allocated, Size()); 2721 DCHECK_LE(allocated, Size());
2715 return static_cast<size_t>(allocated); 2722 return static_cast<size_t>(allocated);
2716 } 2723 }
2717 2724
2718 bool ReplaceWithEmptyPage(Page* page) { 2725 bool ReplaceWithEmptyPage(Page* page) {
2719 // This method is called after flipping the semispace. 2726 // This method is called after flipping the semispace.
2720 DCHECK(page->InFromSpace()); 2727 DCHECK(page->InFromSpace());
2721 return from_space_.ReplaceWithEmptyPage(page); 2728 return from_space_.ReplaceWithEmptyPage(page);
2722 } 2729 }
2723 2730
2731 void AddPageToToSpace(Page* page) {
2732 DCHECK(page->InFromSpace());
2733 DCHECK(!to_space_.OnLastPage());
2734 to_space_.PrependPage(page);
2735 pages_used_++;
2736 }
2737
2724 // Return the maximum capacity of a semispace. 2738 // Return the maximum capacity of a semispace.
2725 int MaximumCapacity() { 2739 int MaximumCapacity() {
2726 DCHECK(to_space_.maximum_capacity() == from_space_.maximum_capacity()); 2740 DCHECK(to_space_.maximum_capacity() == from_space_.maximum_capacity());
2727 return to_space_.maximum_capacity(); 2741 return to_space_.maximum_capacity();
2728 } 2742 }
2729 2743
2730 bool IsAtMaximumCapacity() { return TotalCapacity() == MaximumCapacity(); } 2744 bool IsAtMaximumCapacity() { return TotalCapacity() == MaximumCapacity(); }
2731 2745
2732 // Returns the initial capacity of a semispace. 2746 // Returns the initial capacity of a semispace.
2733 int InitialTotalCapacity() { 2747 int InitialTotalCapacity() {
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
3148 count = 0; 3162 count = 0;
3149 } 3163 }
3150 // Must be small, since an iteration is used for lookup. 3164 // Must be small, since an iteration is used for lookup.
3151 static const int kMaxComments = 64; 3165 static const int kMaxComments = 64;
3152 }; 3166 };
3153 #endif 3167 #endif
3154 } // namespace internal 3168 } // namespace internal
3155 } // namespace v8 3169 } // namespace v8
3156 3170
3157 #endif // V8_HEAP_SPACES_H_ 3171 #endif // V8_HEAP_SPACES_H_
OLDNEW
« src/heap/mark-compact.cc ('K') | « src/heap/mark-compact.cc ('k') | src/heap/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698