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

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

Issue 2364923002: [heap] New heuristics for starting of incremental marking. (Closed)
Patch Set: rebase 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
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 181
182 Address* Heap::OldSpaceAllocationTopAddress() { 182 Address* Heap::OldSpaceAllocationTopAddress() {
183 return old_space_->allocation_top_address(); 183 return old_space_->allocation_top_address();
184 } 184 }
185 185
186 Address* Heap::OldSpaceAllocationLimitAddress() { 186 Address* Heap::OldSpaceAllocationLimitAddress() {
187 return old_space_->allocation_limit_address(); 187 return old_space_->allocation_limit_address();
188 } 188 }
189 189
190 bool Heap::HeapIsFullEnoughToStartIncrementalMarking(intptr_t limit) {
191 if (FLAG_stress_compaction && (gc_count_ & 1) != 0) return true;
192
193 intptr_t adjusted_allocation_limit = limit - new_space_->Capacity();
194
195 if (PromotedTotalSize() >= adjusted_allocation_limit) return true;
196
197 if (HighMemoryPressure()) return true;
198
199 return false;
200 }
201
202 void Heap::UpdateNewSpaceAllocationCounter() { 190 void Heap::UpdateNewSpaceAllocationCounter() {
203 new_space_allocation_counter_ = NewSpaceAllocationCounter(); 191 new_space_allocation_counter_ = NewSpaceAllocationCounter();
204 } 192 }
205 193
206 size_t Heap::NewSpaceAllocationCounter() { 194 size_t Heap::NewSpaceAllocationCounter() {
207 return new_space_allocation_counter_ + new_space()->AllocatedSinceLastGC(); 195 return new_space_allocation_counter_ + new_space()->AllocatedSinceLastGC();
208 } 196 }
209 197
210 template <> 198 template <>
211 bool inline Heap::IsOneByte(Vector<const char> str, int chars) { 199 bool inline Heap::IsOneByte(Vector<const char> str, int chars) {
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 bool Heap::InOldSpace(Object* object) { return old_space_->Contains(object); } 491 bool Heap::InOldSpace(Object* object) { return old_space_->Contains(object); }
504 492
505 bool Heap::InNewSpaceSlow(Address address) { 493 bool Heap::InNewSpaceSlow(Address address) {
506 return new_space_->ContainsSlow(address); 494 return new_space_->ContainsSlow(address);
507 } 495 }
508 496
509 bool Heap::InOldSpaceSlow(Address address) { 497 bool Heap::InOldSpaceSlow(Address address) {
510 return old_space_->ContainsSlow(address); 498 return old_space_->ContainsSlow(address);
511 } 499 }
512 500
513 bool Heap::OldGenerationAllocationLimitReached() {
514 if (!incremental_marking()->IsStopped() && !ShouldOptimizeForMemoryUsage()) {
515 return false;
516 }
517 return OldGenerationSpaceAvailable() < 0;
518 }
519
520 template <PromotionMode promotion_mode> 501 template <PromotionMode promotion_mode>
521 bool Heap::ShouldBePromoted(Address old_address, int object_size) { 502 bool Heap::ShouldBePromoted(Address old_address, int object_size) {
522 Page* page = Page::FromAddress(old_address); 503 Page* page = Page::FromAddress(old_address);
523 Address age_mark = new_space_->age_mark(); 504 Address age_mark = new_space_->age_mark();
524 505
525 if (promotion_mode == PROMOTE_MARKED) { 506 if (promotion_mode == PROMOTE_MARKED) {
526 MarkBit mark_bit = ObjectMarking::MarkBitFrom(old_address); 507 MarkBit mark_bit = ObjectMarking::MarkBitFrom(old_address);
527 if (!Marking::IsWhite(mark_bit)) { 508 if (!Marking::IsWhite(mark_bit)) {
528 return true; 509 return true;
529 } 510 }
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 860
880 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { 861 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) {
881 for (Object** current = start; current < end; current++) { 862 for (Object** current = start; current < end; current++) {
882 CHECK((*current)->IsSmi()); 863 CHECK((*current)->IsSmi());
883 } 864 }
884 } 865 }
885 } // namespace internal 866 } // namespace internal
886 } // namespace v8 867 } // namespace v8
887 868
888 #endif // V8_HEAP_HEAP_INL_H_ 869 #endif // V8_HEAP_HEAP_INL_H_
OLDNEW
« src/heap/heap.cc ('K') | « src/heap/heap.cc ('k') | src/heap/incremental-marking.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698