| 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 2899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2910 MUST_USE_RESULT HeapObject* SweepAndRetryAllocation( | 2910 MUST_USE_RESULT HeapObject* SweepAndRetryAllocation( |
| 2911 int size_in_bytes) override; | 2911 int size_in_bytes) override; |
| 2912 }; | 2912 }; |
| 2913 | 2913 |
| 2914 | 2914 |
| 2915 // A collection of |CompactionSpace|s used by a single compaction task. | 2915 // A collection of |CompactionSpace|s used by a single compaction task. |
| 2916 class CompactionSpaceCollection : public Malloced { | 2916 class CompactionSpaceCollection : public Malloced { |
| 2917 public: | 2917 public: |
| 2918 explicit CompactionSpaceCollection(Heap* heap) | 2918 explicit CompactionSpaceCollection(Heap* heap) |
| 2919 : old_space_(heap, OLD_SPACE, Executability::NOT_EXECUTABLE), | 2919 : old_space_(heap, OLD_SPACE, Executability::NOT_EXECUTABLE), |
| 2920 code_space_(heap, CODE_SPACE, Executability::EXECUTABLE), | 2920 code_space_(heap, CODE_SPACE, Executability::EXECUTABLE) {} |
| 2921 duration_(0.0), | |
| 2922 bytes_compacted_(0) {} | |
| 2923 | 2921 |
| 2924 CompactionSpace* Get(AllocationSpace space) { | 2922 CompactionSpace* Get(AllocationSpace space) { |
| 2925 switch (space) { | 2923 switch (space) { |
| 2926 case OLD_SPACE: | 2924 case OLD_SPACE: |
| 2927 return &old_space_; | 2925 return &old_space_; |
| 2928 case CODE_SPACE: | 2926 case CODE_SPACE: |
| 2929 return &code_space_; | 2927 return &code_space_; |
| 2930 default: | 2928 default: |
| 2931 UNREACHABLE(); | 2929 UNREACHABLE(); |
| 2932 } | 2930 } |
| 2933 UNREACHABLE(); | 2931 UNREACHABLE(); |
| 2934 return nullptr; | 2932 return nullptr; |
| 2935 } | 2933 } |
| 2936 | 2934 |
| 2937 void ReportCompactionProgress(double duration, intptr_t bytes_compacted) { | |
| 2938 duration_ += duration; | |
| 2939 bytes_compacted_ += bytes_compacted; | |
| 2940 } | |
| 2941 | |
| 2942 double duration() const { return duration_; } | |
| 2943 intptr_t bytes_compacted() const { return bytes_compacted_; } | |
| 2944 | |
| 2945 private: | 2935 private: |
| 2946 CompactionSpace old_space_; | 2936 CompactionSpace old_space_; |
| 2947 CompactionSpace code_space_; | 2937 CompactionSpace code_space_; |
| 2948 | |
| 2949 // Book keeping. | |
| 2950 double duration_; | |
| 2951 intptr_t bytes_compacted_; | |
| 2952 }; | 2938 }; |
| 2953 | 2939 |
| 2954 | 2940 |
| 2955 // ----------------------------------------------------------------------------- | 2941 // ----------------------------------------------------------------------------- |
| 2956 // Old object space (includes the old space of objects and code space) | 2942 // Old object space (includes the old space of objects and code space) |
| 2957 | 2943 |
| 2958 class OldSpace : public PagedSpace { | 2944 class OldSpace : public PagedSpace { |
| 2959 public: | 2945 public: |
| 2960 // Creates an old space object. The constructor does not allocate pages | 2946 // Creates an old space object. The constructor does not allocate pages |
| 2961 // from OS. | 2947 // from OS. |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3142 count = 0; | 3128 count = 0; |
| 3143 } | 3129 } |
| 3144 // Must be small, since an iteration is used for lookup. | 3130 // Must be small, since an iteration is used for lookup. |
| 3145 static const int kMaxComments = 64; | 3131 static const int kMaxComments = 64; |
| 3146 }; | 3132 }; |
| 3147 #endif | 3133 #endif |
| 3148 } // namespace internal | 3134 } // namespace internal |
| 3149 } // namespace v8 | 3135 } // namespace v8 |
| 3150 | 3136 |
| 3151 #endif // V8_HEAP_SPACES_H_ | 3137 #endif // V8_HEAP_SPACES_H_ |
| OLD | NEW |