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 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 template <PromotionMode promotion_mode> |
397 bool Heap::ShouldBePromoted(Address old_address, int object_size) { | 397 bool Heap::ShouldBePromoted(Address old_address, int object_size) { |
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 == PROMOTE_MARKED) { |
| 402 MarkBit mark_bit = Marking::MarkBitFrom(old_address); |
| 403 if (!Marking::IsWhite(mark_bit)) { |
| 404 return true; |
| 405 } |
| 406 } |
| 407 |
400 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && | 408 return page->IsFlagSet(MemoryChunk::NEW_SPACE_BELOW_AGE_MARK) && |
401 (!page->ContainsLimit(age_mark) || old_address < age_mark); | 409 (!page->ContainsLimit(age_mark) || old_address < age_mark); |
402 } | 410 } |
403 | 411 |
| 412 PromotionMode Heap::CurrentPromotionMode() { |
| 413 if (incremental_marking()->IsMarking()) { |
| 414 return PROMOTE_MARKED; |
| 415 } else { |
| 416 return DEFAULT_PROMOTION; |
| 417 } |
| 418 } |
| 419 |
404 void Heap::RecordWrite(Object* object, int offset, Object* o) { | 420 void Heap::RecordWrite(Object* object, int offset, Object* o) { |
405 if (!InNewSpace(o) || !object->IsHeapObject() || InNewSpace(object)) { | 421 if (!InNewSpace(o) || !object->IsHeapObject() || InNewSpace(object)) { |
406 return; | 422 return; |
407 } | 423 } |
408 RememberedSet<OLD_TO_NEW>::Insert( | 424 RememberedSet<OLD_TO_NEW>::Insert( |
409 Page::FromAddress(reinterpret_cast<Address>(object)), | 425 Page::FromAddress(reinterpret_cast<Address>(object)), |
410 HeapObject::cast(object)->address() + offset); | 426 HeapObject::cast(object)->address() + offset); |
411 } | 427 } |
412 | 428 |
413 void Heap::RecordFixedArrayElements(FixedArray* array, int offset, int length) { | 429 void Heap::RecordFixedArrayElements(FixedArray* array, int offset, int length) { |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 | 750 |
735 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 751 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
736 for (Object** current = start; current < end; current++) { | 752 for (Object** current = start; current < end; current++) { |
737 CHECK((*current)->IsSmi()); | 753 CHECK((*current)->IsSmi()); |
738 } | 754 } |
739 } | 755 } |
740 } // namespace internal | 756 } // namespace internal |
741 } // namespace v8 | 757 } // namespace v8 |
742 | 758 |
743 #endif // V8_HEAP_HEAP_INL_H_ | 759 #endif // V8_HEAP_HEAP_INL_H_ |
OLD | NEW |