OLD | NEW |
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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 bool Heap::InOldSpace(Object* object) { return old_space_->Contains(object); } | 483 bool Heap::InOldSpace(Object* object) { return old_space_->Contains(object); } |
484 | 484 |
485 bool Heap::InNewSpaceSlow(Address address) { | 485 bool Heap::InNewSpaceSlow(Address address) { |
486 return new_space_->ContainsSlow(address); | 486 return new_space_->ContainsSlow(address); |
487 } | 487 } |
488 | 488 |
489 bool Heap::InOldSpaceSlow(Address address) { | 489 bool Heap::InOldSpaceSlow(Address address) { |
490 return old_space_->ContainsSlow(address); | 490 return old_space_->ContainsSlow(address); |
491 } | 491 } |
492 | 492 |
493 template <PromotionMode promotion_mode> | |
494 bool Heap::ShouldBePromoted(Address old_address, int object_size) { | 493 bool Heap::ShouldBePromoted(Address old_address, int object_size) { |
495 Page* page = Page::FromAddress(old_address); | 494 Page* page = Page::FromAddress(old_address); |
496 Address age_mark = new_space_->age_mark(); | 495 Address age_mark = new_space_->age_mark(); |
497 | |
498 if (promotion_mode == PROMOTE_MARKED) { | |
499 MarkBit mark_bit = ObjectMarking::MarkBitFrom(old_address); | |
500 if (!Marking::IsWhite(mark_bit)) { | |
501 return true; | |
502 } | |
503 } | |
504 | |
505 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && | 496 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && |
506 (!page->ContainsLimit(age_mark) || old_address < age_mark); | 497 (!page->ContainsLimit(age_mark) || old_address < age_mark); |
507 } | 498 } |
508 | 499 |
509 PromotionMode Heap::CurrentPromotionMode() { | |
510 if (incremental_marking()->IsMarking()) { | |
511 return PROMOTE_MARKED; | |
512 } else { | |
513 return DEFAULT_PROMOTION; | |
514 } | |
515 } | |
516 | |
517 void Heap::RecordWrite(Object* object, int offset, Object* o) { | 500 void Heap::RecordWrite(Object* object, int offset, Object* o) { |
518 if (!InNewSpace(o) || !object->IsHeapObject() || InNewSpace(object)) { | 501 if (!InNewSpace(o) || !object->IsHeapObject() || InNewSpace(object)) { |
519 return; | 502 return; |
520 } | 503 } |
521 RememberedSet<OLD_TO_NEW>::Insert( | 504 RememberedSet<OLD_TO_NEW>::Insert( |
522 Page::FromAddress(reinterpret_cast<Address>(object)), | 505 Page::FromAddress(reinterpret_cast<Address>(object)), |
523 HeapObject::cast(object)->address() + offset); | 506 HeapObject::cast(object)->address() + offset); |
524 } | 507 } |
525 | 508 |
526 void Heap::RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value) { | 509 void Heap::RecordWriteIntoCode(Code* host, RelocInfo* rinfo, Object* value) { |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 | 835 |
853 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 836 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
854 for (Object** current = start; current < end; current++) { | 837 for (Object** current = start; current < end; current++) { |
855 CHECK((*current)->IsSmi()); | 838 CHECK((*current)->IsSmi()); |
856 } | 839 } |
857 } | 840 } |
858 } // namespace internal | 841 } // namespace internal |
859 } // namespace v8 | 842 } // namespace v8 |
860 | 843 |
861 #endif // V8_HEAP_HEAP_INL_H_ | 844 #endif // V8_HEAP_HEAP_INL_H_ |
OLD | NEW |