| 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_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
| 6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
| 7 | 7 |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 #undef ROOT_INDEX_DECLARATION | 549 #undef ROOT_INDEX_DECLARATION |
| 550 kRootListLength, | 550 kRootListLength, |
| 551 kStrongRootListLength = kStringTableRootIndex, | 551 kStrongRootListLength = kStringTableRootIndex, |
| 552 kSmiRootsStart = kStringTableRootIndex + 1 | 552 kSmiRootsStart = kStringTableRootIndex + 1 |
| 553 }; | 553 }; |
| 554 | 554 |
| 555 enum FindMementoMode { kForRuntime, kForGC }; | 555 enum FindMementoMode { kForRuntime, kForGC }; |
| 556 | 556 |
| 557 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; | 557 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; |
| 558 | 558 |
| 559 // Indicates whether live bytes adjustment is triggered | |
| 560 // - from within the GC code before sweeping started (SEQUENTIAL_TO_SWEEPER), | |
| 561 // - or from within GC (CONCURRENT_TO_SWEEPER), | |
| 562 // - or mutator code (CONCURRENT_TO_SWEEPER). | |
| 563 enum InvocationMode { SEQUENTIAL_TO_SWEEPER, CONCURRENT_TO_SWEEPER }; | |
| 564 | |
| 565 enum UpdateAllocationSiteMode { kGlobal, kCached }; | 559 enum UpdateAllocationSiteMode { kGlobal, kCached }; |
| 566 | 560 |
| 567 // Taking this lock prevents the GC from entering a phase that relocates | 561 // Taking this lock prevents the GC from entering a phase that relocates |
| 568 // object references. | 562 // object references. |
| 569 class RelocationLock { | 563 class RelocationLock { |
| 570 public: | 564 public: |
| 571 explicit RelocationLock(Heap* heap) : heap_(heap) { | 565 explicit RelocationLock(Heap* heap) : heap_(heap) { |
| 572 heap_->relocation_mutex_.Lock(); | 566 heap_->relocation_mutex_.Lock(); |
| 573 } | 567 } |
| 574 | 568 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 // pass ClearRecordedSlots::kNo. If the filler was created in a black area | 738 // pass ClearRecordedSlots::kNo. If the filler was created in a black area |
| 745 // we may want to clear the corresponding mark bits with ClearBlackArea::kYes, | 739 // we may want to clear the corresponding mark bits with ClearBlackArea::kYes, |
| 746 // which is the default. ClearBlackArea::kNo does not clear the mark bits. | 740 // which is the default. ClearBlackArea::kNo does not clear the mark bits. |
| 747 void CreateFillerObjectAt( | 741 void CreateFillerObjectAt( |
| 748 Address addr, int size, ClearRecordedSlots mode, | 742 Address addr, int size, ClearRecordedSlots mode, |
| 749 ClearBlackArea black_area_mode = ClearBlackArea::kYes); | 743 ClearBlackArea black_area_mode = ClearBlackArea::kYes); |
| 750 | 744 |
| 751 bool CanMoveObjectStart(HeapObject* object); | 745 bool CanMoveObjectStart(HeapObject* object); |
| 752 | 746 |
| 753 // Maintain consistency of live bytes during incremental marking. | 747 // Maintain consistency of live bytes during incremental marking. |
| 754 void AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode); | 748 void AdjustLiveBytes(HeapObject* object, int by); |
| 755 | 749 |
| 756 // Trim the given array from the left. Note that this relocates the object | 750 // Trim the given array from the left. Note that this relocates the object |
| 757 // start and hence is only valid if there is only a single reference to it. | 751 // start and hence is only valid if there is only a single reference to it. |
| 758 FixedArrayBase* LeftTrimFixedArray(FixedArrayBase* obj, int elements_to_trim); | 752 FixedArrayBase* LeftTrimFixedArray(FixedArrayBase* obj, int elements_to_trim); |
| 759 | 753 |
| 760 // Trim the given array from the right. | 754 // Trim the given array from the right. |
| 761 template<Heap::InvocationMode mode> | |
| 762 void RightTrimFixedArray(FixedArrayBase* obj, int elements_to_trim); | 755 void RightTrimFixedArray(FixedArrayBase* obj, int elements_to_trim); |
| 763 | 756 |
| 764 // Converts the given boolean condition to JavaScript boolean value. | 757 // Converts the given boolean condition to JavaScript boolean value. |
| 765 inline Oddball* ToBoolean(bool condition); | 758 inline Oddball* ToBoolean(bool condition); |
| 766 | 759 |
| 767 // Check whether the heap is currently iterable. | 760 // Check whether the heap is currently iterable. |
| 768 bool IsHeapIterable(); | 761 bool IsHeapIterable(); |
| 769 | 762 |
| 770 // Notify the heap that a context has been disposed. | 763 // Notify the heap that a context has been disposed. |
| 771 int NotifyContextDisposed(bool dependant_context); | 764 int NotifyContextDisposed(bool dependant_context); |
| (...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2639 friend class LargeObjectSpace; | 2632 friend class LargeObjectSpace; |
| 2640 friend class NewSpace; | 2633 friend class NewSpace; |
| 2641 friend class PagedSpace; | 2634 friend class PagedSpace; |
| 2642 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2635 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
| 2643 }; | 2636 }; |
| 2644 | 2637 |
| 2645 } // namespace internal | 2638 } // namespace internal |
| 2646 } // namespace v8 | 2639 } // namespace v8 |
| 2647 | 2640 |
| 2648 #endif // V8_HEAP_HEAP_H_ | 2641 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |