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