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" |
11 #include "src/base/bits.h" | 11 #include "src/base/bits.h" |
12 #include "src/base/platform/mutex.h" | 12 #include "src/base/platform/mutex.h" |
13 #include "src/flags.h" | 13 #include "src/flags.h" |
14 #include "src/hashmap.h" | 14 #include "src/hashmap.h" |
| 15 #include "src/heap/store-buffer.h" |
15 #include "src/list.h" | 16 #include "src/list.h" |
16 #include "src/objects.h" | 17 #include "src/objects.h" |
17 #include "src/utils.h" | 18 #include "src/utils.h" |
18 | 19 |
19 namespace v8 { | 20 namespace v8 { |
20 namespace internal { | 21 namespace internal { |
21 | 22 |
22 class CompactionSpaceCollection; | 23 class CompactionSpaceCollection; |
23 class Isolate; | 24 class Isolate; |
24 | 25 |
(...skipping 2963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2988 MUST_USE_RESULT HeapObject* SweepAndRetryAllocation( | 2989 MUST_USE_RESULT HeapObject* SweepAndRetryAllocation( |
2989 int size_in_bytes) override; | 2990 int size_in_bytes) override; |
2990 }; | 2991 }; |
2991 | 2992 |
2992 | 2993 |
2993 // A collection of |CompactionSpace|s used by a single compaction task. | 2994 // A collection of |CompactionSpace|s used by a single compaction task. |
2994 class CompactionSpaceCollection : public Malloced { | 2995 class CompactionSpaceCollection : public Malloced { |
2995 public: | 2996 public: |
2996 explicit CompactionSpaceCollection(Heap* heap) | 2997 explicit CompactionSpaceCollection(Heap* heap) |
2997 : old_space_(heap, OLD_SPACE, Executability::NOT_EXECUTABLE), | 2998 : old_space_(heap, OLD_SPACE, Executability::NOT_EXECUTABLE), |
2998 code_space_(heap, CODE_SPACE, Executability::EXECUTABLE), | 2999 code_space_(heap, CODE_SPACE, Executability::EXECUTABLE) {} |
2999 duration_(0.0), | |
3000 bytes_compacted_(0) {} | |
3001 | 3000 |
3002 CompactionSpace* Get(AllocationSpace space) { | 3001 CompactionSpace* Get(AllocationSpace space) { |
3003 switch (space) { | 3002 switch (space) { |
3004 case OLD_SPACE: | 3003 case OLD_SPACE: |
3005 return &old_space_; | 3004 return &old_space_; |
3006 case CODE_SPACE: | 3005 case CODE_SPACE: |
3007 return &code_space_; | 3006 return &code_space_; |
3008 default: | 3007 default: |
3009 UNREACHABLE(); | 3008 UNREACHABLE(); |
3010 } | 3009 } |
3011 UNREACHABLE(); | 3010 UNREACHABLE(); |
3012 return nullptr; | 3011 return nullptr; |
3013 } | 3012 } |
3014 | 3013 |
3015 void ReportCompactionProgress(double duration, intptr_t bytes_compacted) { | |
3016 duration_ += duration; | |
3017 bytes_compacted_ += bytes_compacted; | |
3018 } | |
3019 | |
3020 double duration() const { return duration_; } | |
3021 intptr_t bytes_compacted() const { return bytes_compacted_; } | |
3022 | |
3023 private: | 3014 private: |
3024 CompactionSpace old_space_; | 3015 CompactionSpace old_space_; |
3025 CompactionSpace code_space_; | 3016 CompactionSpace code_space_; |
3026 | |
3027 // Book keeping. | |
3028 double duration_; | |
3029 intptr_t bytes_compacted_; | |
3030 }; | 3017 }; |
3031 | 3018 |
3032 | 3019 |
3033 // ----------------------------------------------------------------------------- | 3020 // ----------------------------------------------------------------------------- |
3034 // Old object space (includes the old space of objects and code space) | 3021 // Old object space (includes the old space of objects and code space) |
3035 | 3022 |
3036 class OldSpace : public PagedSpace { | 3023 class OldSpace : public PagedSpace { |
3037 public: | 3024 public: |
3038 // Creates an old space object. The constructor does not allocate pages | 3025 // Creates an old space object. The constructor does not allocate pages |
3039 // from OS. | 3026 // from OS. |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3220 count = 0; | 3207 count = 0; |
3221 } | 3208 } |
3222 // Must be small, since an iteration is used for lookup. | 3209 // Must be small, since an iteration is used for lookup. |
3223 static const int kMaxComments = 64; | 3210 static const int kMaxComments = 64; |
3224 }; | 3211 }; |
3225 #endif | 3212 #endif |
3226 } // namespace internal | 3213 } // namespace internal |
3227 } // namespace v8 | 3214 } // namespace v8 |
3228 | 3215 |
3229 #endif // V8_HEAP_SPACES_H_ | 3216 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |