OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_SPACES_H_ | 5 #ifndef V8_HEAP_SPACES_H_ |
6 #define V8_HEAP_SPACES_H_ | 6 #define V8_HEAP_SPACES_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/atomic-utils.h" | 9 #include "src/atomic-utils.h" |
10 #include "src/base/atomicops.h" | 10 #include "src/base/atomicops.h" |
(...skipping 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2748 | 2748 |
2749 // Allows observation of inline allocation. The observer->Step() method gets | 2749 // Allows observation of inline allocation. The observer->Step() method gets |
2750 // called after every step_size bytes have been allocated (approximately). | 2750 // called after every step_size bytes have been allocated (approximately). |
2751 // This works by adjusting the allocation limit to a lower value and adjusting | 2751 // This works by adjusting the allocation limit to a lower value and adjusting |
2752 // it after each step. | 2752 // it after each step. |
2753 void AddInlineAllocationObserver(InlineAllocationObserver* observer); | 2753 void AddInlineAllocationObserver(InlineAllocationObserver* observer); |
2754 | 2754 |
2755 // Removes a previously installed observer. | 2755 // Removes a previously installed observer. |
2756 void RemoveInlineAllocationObserver(InlineAllocationObserver* observer); | 2756 void RemoveInlineAllocationObserver(InlineAllocationObserver* observer); |
2757 | 2757 |
2758 void PauseInlineAllocationObservers(); | |
2759 void ResumeInlineAllocationObservers(); | |
2760 | |
2761 void DisableInlineAllocationSteps() { | 2758 void DisableInlineAllocationSteps() { |
2762 top_on_previous_step_ = 0; | 2759 top_on_previous_step_ = 0; |
2763 UpdateInlineAllocationLimit(0); | 2760 UpdateInlineAllocationLimit(0); |
2764 } | 2761 } |
2765 | 2762 |
2766 // Get the extent of the inactive semispace (for use as a marking stack, | 2763 // Get the extent of the inactive semispace (for use as a marking stack, |
2767 // or to zap it). Notice: space-addresses are not necessarily on the | 2764 // or to zap it). Notice: space-addresses are not necessarily on the |
2768 // same page, so FromSpaceStart() might be above FromSpaceEnd(). | 2765 // same page, so FromSpaceStart() might be above FromSpaceEnd(). |
2769 Address FromSpacePageLow() { return from_space_.page_low(); } | 2766 Address FromSpacePageLow() { return from_space_.page_low(); } |
2770 Address FromSpacePageHigh() { return from_space_.page_high(); } | 2767 Address FromSpacePageHigh() { return from_space_.page_high(); } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2872 // If we are doing inline allocation in steps, this method performs the 'step' | 2869 // If we are doing inline allocation in steps, this method performs the 'step' |
2873 // operation. top is the memory address of the bump pointer at the last | 2870 // operation. top is the memory address of the bump pointer at the last |
2874 // inline allocation (i.e. it determines the numbers of bytes actually | 2871 // inline allocation (i.e. it determines the numbers of bytes actually |
2875 // allocated since the last step.) new_top is the address of the bump pointer | 2872 // allocated since the last step.) new_top is the address of the bump pointer |
2876 // where the next byte is going to be allocated from. top and new_top may be | 2873 // where the next byte is going to be allocated from. top and new_top may be |
2877 // different when we cross a page boundary or reset the space. | 2874 // different when we cross a page boundary or reset the space. |
2878 void InlineAllocationStep(Address top, Address new_top, Address soon_object, | 2875 void InlineAllocationStep(Address top, Address new_top, Address soon_object, |
2879 size_t size); | 2876 size_t size); |
2880 intptr_t GetNextInlineAllocationStepSize(); | 2877 intptr_t GetNextInlineAllocationStepSize(); |
2881 void StartNextInlineAllocationStep(); | 2878 void StartNextInlineAllocationStep(); |
| 2879 void PauseInlineAllocationObservers(); |
| 2880 void ResumeInlineAllocationObservers(); |
2882 | 2881 |
| 2882 friend class PauseInlineAllocationObserversScope; |
2883 friend class SemiSpaceIterator; | 2883 friend class SemiSpaceIterator; |
2884 }; | 2884 }; |
2885 | 2885 |
| 2886 class PauseInlineAllocationObserversScope { |
| 2887 public: |
| 2888 explicit PauseInlineAllocationObserversScope(NewSpace* new_space) |
| 2889 : new_space_(new_space) { |
| 2890 new_space_->PauseInlineAllocationObservers(); |
| 2891 } |
| 2892 ~PauseInlineAllocationObserversScope() { |
| 2893 new_space_->ResumeInlineAllocationObservers(); |
| 2894 } |
| 2895 |
| 2896 private: |
| 2897 NewSpace* new_space_; |
| 2898 DISALLOW_COPY_AND_ASSIGN(PauseInlineAllocationObserversScope); |
| 2899 }; |
| 2900 |
2886 // ----------------------------------------------------------------------------- | 2901 // ----------------------------------------------------------------------------- |
2887 // Compaction space that is used temporarily during compaction. | 2902 // Compaction space that is used temporarily during compaction. |
2888 | 2903 |
2889 class CompactionSpace : public PagedSpace { | 2904 class CompactionSpace : public PagedSpace { |
2890 public: | 2905 public: |
2891 CompactionSpace(Heap* heap, AllocationSpace id, Executability executable) | 2906 CompactionSpace(Heap* heap, AllocationSpace id, Executability executable) |
2892 : PagedSpace(heap, id, executable) {} | 2907 : PagedSpace(heap, id, executable) {} |
2893 | 2908 |
2894 // Adds external memory starting at {start} of {size_in_bytes} to the space. | 2909 // Adds external memory starting at {start} of {size_in_bytes} to the space. |
2895 void AddExternalMemory(Address start, int size_in_bytes) { | 2910 void AddExternalMemory(Address start, int size_in_bytes) { |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3140 count = 0; | 3155 count = 0; |
3141 } | 3156 } |
3142 // Must be small, since an iteration is used for lookup. | 3157 // Must be small, since an iteration is used for lookup. |
3143 static const int kMaxComments = 64; | 3158 static const int kMaxComments = 64; |
3144 }; | 3159 }; |
3145 #endif | 3160 #endif |
3146 } // namespace internal | 3161 } // namespace internal |
3147 } // namespace v8 | 3162 } // namespace v8 |
3148 | 3163 |
3149 #endif // V8_HEAP_SPACES_H_ | 3164 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |