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

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

Issue 2374253003: Revert of [heap] Remove border page (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 2 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 | « src/heap/heap.cc ('k') | src/heap/mark-compact.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_HEAP_INL_H_ 5 #ifndef V8_HEAP_HEAP_INL_H_
6 #define V8_HEAP_HEAP_INL_H_ 6 #define V8_HEAP_HEAP_INL_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 512
513 bool Heap::OldGenerationAllocationLimitReached() { 513 bool Heap::OldGenerationAllocationLimitReached() {
514 if (!incremental_marking()->IsStopped() && !ShouldOptimizeForMemoryUsage()) { 514 if (!incremental_marking()->IsStopped() && !ShouldOptimizeForMemoryUsage()) {
515 return false; 515 return false;
516 } 516 }
517 return OldGenerationSpaceAvailable() < 0; 517 return OldGenerationSpaceAvailable() < 0;
518 } 518 }
519 519
520 template <PromotionMode promotion_mode> 520 template <PromotionMode promotion_mode>
521 bool Heap::ShouldBePromoted(Address old_address, int object_size) { 521 bool Heap::ShouldBePromoted(Address old_address, int object_size) {
522 Page* page = Page::FromAddress(old_address);
523 Address age_mark = new_space_->age_mark();
524
522 if (promotion_mode == PROMOTE_MARKED) { 525 if (promotion_mode == PROMOTE_MARKED) {
523 MarkBit mark_bit = ObjectMarking::MarkBitFrom(old_address); 526 MarkBit mark_bit = ObjectMarking::MarkBitFrom(old_address);
524 if (!Marking::IsWhite(mark_bit)) { 527 if (!Marking::IsWhite(mark_bit)) {
525 return true; 528 return true;
526 } 529 }
527 } 530 }
528 531
529 return Page::FromAddress(old_address)->InIntermediateGeneration(); 532 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) &&
533 (!page->ContainsLimit(age_mark) || old_address < age_mark);
530 } 534 }
531 535
532 PromotionMode Heap::CurrentPromotionMode() { 536 PromotionMode Heap::CurrentPromotionMode() {
533 if (incremental_marking()->IsMarking()) { 537 if (incremental_marking()->IsMarking()) {
534 return PROMOTE_MARKED; 538 return PROMOTE_MARKED;
535 } else { 539 } else {
536 return DEFAULT_PROMOTION; 540 return DEFAULT_PROMOTION;
537 } 541 }
538 } 542 }
539 543
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 // below (memento_address == top) ensures that this is safe. Mark the word as 624 // below (memento_address == top) ensures that this is safe. Mark the word as
621 // initialized to silence MemorySanitizer warnings. 625 // initialized to silence MemorySanitizer warnings.
622 MSAN_MEMORY_IS_INITIALIZED(&candidate_map, sizeof(candidate_map)); 626 MSAN_MEMORY_IS_INITIALIZED(&candidate_map, sizeof(candidate_map));
623 if (candidate_map != allocation_memento_map()) { 627 if (candidate_map != allocation_memento_map()) {
624 return nullptr; 628 return nullptr;
625 } 629 }
626 630
627 // Bail out if the memento is below the age mark, which can happen when 631 // Bail out if the memento is below the age mark, which can happen when
628 // mementos survived because a page got moved within new space. 632 // mementos survived because a page got moved within new space.
629 Page* object_page = Page::FromAddress(object_address); 633 Page* object_page = Page::FromAddress(object_address);
630 if (object_page->InIntermediateGeneration()) { 634 if (object_page->IsFlagSet(Page::NEW_SPACE_BELOW_AGE_MARK)) {
631 return nullptr; 635 Address age_mark =
636 reinterpret_cast<SemiSpace*>(object_page->owner())->age_mark();
637 if (!object_page->Contains(age_mark)) {
638 return nullptr;
639 }
640 // Do an exact check in the case where the age mark is on the same page.
641 if (object_address < age_mark) {
642 return nullptr;
643 }
632 } 644 }
633 645
634 AllocationMemento* memento_candidate = AllocationMemento::cast(candidate); 646 AllocationMemento* memento_candidate = AllocationMemento::cast(candidate);
635 647
636 // Depending on what the memento is used for, we might need to perform 648 // Depending on what the memento is used for, we might need to perform
637 // additional checks. 649 // additional checks.
638 Address top; 650 Address top;
639 switch (mode) { 651 switch (mode) {
640 case Heap::kForGC: 652 case Heap::kForGC:
641 return memento_candidate; 653 return memento_candidate;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 879
868 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { 880 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) {
869 for (Object** current = start; current < end; current++) { 881 for (Object** current = start; current < end; current++) {
870 CHECK((*current)->IsSmi()); 882 CHECK((*current)->IsSmi());
871 } 883 }
872 } 884 }
873 } // namespace internal 885 } // namespace internal
874 } // namespace v8 886 } // namespace v8
875 887
876 #endif // V8_HEAP_HEAP_INL_H_ 888 #endif // V8_HEAP_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap/heap.cc ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698