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

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

Issue 2383443002: Revert of [heap] Remove border page (Closed)
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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 bool Heap::InNewSpaceSlow(Address address) { 475 bool Heap::InNewSpaceSlow(Address address) {
476 return new_space_->ContainsSlow(address); 476 return new_space_->ContainsSlow(address);
477 } 477 }
478 478
479 bool Heap::InOldSpaceSlow(Address address) { 479 bool Heap::InOldSpaceSlow(Address address) {
480 return old_space_->ContainsSlow(address); 480 return old_space_->ContainsSlow(address);
481 } 481 }
482 482
483 template <PromotionMode promotion_mode> 483 template <PromotionMode promotion_mode>
484 bool Heap::ShouldBePromoted(Address old_address, int object_size) { 484 bool Heap::ShouldBePromoted(Address old_address, int object_size) {
485 Page* page = Page::FromAddress(old_address);
486 Address age_mark = new_space_->age_mark();
487
485 if (promotion_mode == PROMOTE_MARKED) { 488 if (promotion_mode == PROMOTE_MARKED) {
486 MarkBit mark_bit = ObjectMarking::MarkBitFrom(old_address); 489 MarkBit mark_bit = ObjectMarking::MarkBitFrom(old_address);
487 if (!Marking::IsWhite(mark_bit)) { 490 if (!Marking::IsWhite(mark_bit)) {
488 return true; 491 return true;
489 } 492 }
490 } 493 }
491 494
492 return Page::FromAddress(old_address)->InIntermediateGeneration(); 495 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) &&
496 (!page->ContainsLimit(age_mark) || old_address < age_mark);
493 } 497 }
494 498
495 PromotionMode Heap::CurrentPromotionMode() { 499 PromotionMode Heap::CurrentPromotionMode() {
496 if (incremental_marking()->IsMarking()) { 500 if (incremental_marking()->IsMarking()) {
497 return PROMOTE_MARKED; 501 return PROMOTE_MARKED;
498 } else { 502 } else {
499 return DEFAULT_PROMOTION; 503 return DEFAULT_PROMOTION;
500 } 504 }
501 } 505 }
502 506
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 // below (memento_address == top) ensures that this is safe. Mark the word as 587 // below (memento_address == top) ensures that this is safe. Mark the word as
584 // initialized to silence MemorySanitizer warnings. 588 // initialized to silence MemorySanitizer warnings.
585 MSAN_MEMORY_IS_INITIALIZED(&candidate_map, sizeof(candidate_map)); 589 MSAN_MEMORY_IS_INITIALIZED(&candidate_map, sizeof(candidate_map));
586 if (candidate_map != allocation_memento_map()) { 590 if (candidate_map != allocation_memento_map()) {
587 return nullptr; 591 return nullptr;
588 } 592 }
589 593
590 // Bail out if the memento is below the age mark, which can happen when 594 // Bail out if the memento is below the age mark, which can happen when
591 // mementos survived because a page got moved within new space. 595 // mementos survived because a page got moved within new space.
592 Page* object_page = Page::FromAddress(object_address); 596 Page* object_page = Page::FromAddress(object_address);
593 if (object_page->InIntermediateGeneration()) { 597 if (object_page->IsFlagSet(Page::NEW_SPACE_BELOW_AGE_MARK)) {
594 return nullptr; 598 Address age_mark =
599 reinterpret_cast<SemiSpace*>(object_page->owner())->age_mark();
600 if (!object_page->Contains(age_mark)) {
601 return nullptr;
602 }
603 // Do an exact check in the case where the age mark is on the same page.
604 if (object_address < age_mark) {
605 return nullptr;
606 }
595 } 607 }
596 608
597 AllocationMemento* memento_candidate = AllocationMemento::cast(candidate); 609 AllocationMemento* memento_candidate = AllocationMemento::cast(candidate);
598 610
599 // Depending on what the memento is used for, we might need to perform 611 // Depending on what the memento is used for, we might need to perform
600 // additional checks. 612 // additional checks.
601 Address top; 613 Address top;
602 switch (mode) { 614 switch (mode) {
603 case Heap::kForGC: 615 case Heap::kForGC:
604 return memento_candidate; 616 return memento_candidate;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 842
831 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { 843 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) {
832 for (Object** current = start; current < end; current++) { 844 for (Object** current = start; current < end; current++) {
833 CHECK((*current)->IsSmi()); 845 CHECK((*current)->IsSmi());
834 } 846 }
835 } 847 }
836 } // namespace internal 848 } // namespace internal
837 } // namespace v8 849 } // namespace v8
838 850
839 #endif // V8_HEAP_HEAP_INL_H_ 851 #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