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

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

Issue 2005173003: Immediatelly promote marked objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rewrite using PromotionMode Created 4 years, 7 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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 386
387 bool Heap::InOldSpaceSlow(Address address) { 387 bool Heap::InOldSpaceSlow(Address address) {
388 return old_space_->ContainsSlow(address); 388 return old_space_->ContainsSlow(address);
389 } 389 }
390 390
391 bool Heap::OldGenerationAllocationLimitReached() { 391 bool Heap::OldGenerationAllocationLimitReached() {
392 if (!incremental_marking()->IsStopped()) return false; 392 if (!incremental_marking()->IsStopped()) return false;
393 return OldGenerationSpaceAvailable() < 0; 393 return OldGenerationSpaceAvailable() < 0;
394 } 394 }
395 395
396 396 bool Heap::ShouldBePromoted(Address old_address, int object_size,
397 bool Heap::ShouldBePromoted(Address old_address, int object_size) { 397 PromotionMode promotion_mode) {
398 Page* page = Page::FromAddress(old_address); 398 Page* page = Page::FromAddress(old_address);
399 Address age_mark = new_space_.age_mark(); 399 Address age_mark = new_space_.age_mark();
400
401 if (promotion_mode == FORCE_PROMOTION) {
402 return true;
403 }
404
405 if (promotion_mode == PROMOTE_MARKED) {
406 MarkBit mark_bit = Marking::MarkBitFrom(old_address);
407 if (!Marking::IsWhite(mark_bit)) {
408 return true;
409 }
410 }
411
400 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && 412 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) &&
401 (!page->ContainsLimit(age_mark) || old_address < age_mark); 413 (!page->ContainsLimit(age_mark) || old_address < age_mark);
402 } 414 }
403 415
404 void Heap::RecordWrite(Object* object, int offset, Object* o) { 416 void Heap::RecordWrite(Object* object, int offset, Object* o) {
405 if (!InNewSpace(o) || !object->IsHeapObject() || InNewSpace(object)) { 417 if (!InNewSpace(o) || !object->IsHeapObject() || InNewSpace(object)) {
406 return; 418 return;
407 } 419 }
408 RememberedSet<OLD_TO_NEW>::Insert( 420 RememberedSet<OLD_TO_NEW>::Insert(
409 Page::FromAddress(reinterpret_cast<Address>(object)), 421 Page::FromAddress(reinterpret_cast<Address>(object)),
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 746
735 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { 747 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) {
736 for (Object** current = start; current < end; current++) { 748 for (Object** current = start; current < end; current++) {
737 CHECK((*current)->IsSmi()); 749 CHECK((*current)->IsSmi());
738 } 750 }
739 } 751 }
740 } // namespace internal 752 } // namespace internal
741 } // namespace v8 753 } // namespace v8
742 754
743 #endif // V8_HEAP_HEAP_INL_H_ 755 #endif // V8_HEAP_HEAP_INL_H_
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/mark-compact.cc » ('j') | src/heap/scavenger-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698