| 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 <list> | 8 #include <list> |
| 9 #include <memory> |
| 9 | 10 |
| 10 #include "src/allocation.h" | 11 #include "src/allocation.h" |
| 11 #include "src/base/atomic-utils.h" | 12 #include "src/base/atomic-utils.h" |
| 12 #include "src/base/atomicops.h" | 13 #include "src/base/atomicops.h" |
| 13 #include "src/base/bits.h" | 14 #include "src/base/bits.h" |
| 14 #include "src/base/hashmap.h" | 15 #include "src/base/hashmap.h" |
| 15 #include "src/base/platform/mutex.h" | 16 #include "src/base/platform/mutex.h" |
| 16 #include "src/flags.h" | 17 #include "src/flags.h" |
| 17 #include "src/heap/marking.h" | 18 #include "src/heap/marking.h" |
| 18 #include "src/list.h" | 19 #include "src/list.h" |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 DCHECK_GE(bytes, 0); | 922 DCHECK_GE(bytes, 0); |
| 922 committed_ -= bytes; | 923 committed_ -= bytes; |
| 923 DCHECK_GE(committed_, 0); | 924 DCHECK_GE(committed_, 0); |
| 924 } | 925 } |
| 925 | 926 |
| 926 #ifdef DEBUG | 927 #ifdef DEBUG |
| 927 virtual void Print() = 0; | 928 virtual void Print() = 0; |
| 928 #endif | 929 #endif |
| 929 | 930 |
| 930 protected: | 931 protected: |
| 931 v8::base::SmartPointer<List<AllocationObserver*>> allocation_observers_; | 932 std::unique_ptr<List<AllocationObserver*>> allocation_observers_; |
| 932 bool allocation_observers_paused_; | 933 bool allocation_observers_paused_; |
| 933 | 934 |
| 934 private: | 935 private: |
| 935 Heap* heap_; | 936 Heap* heap_; |
| 936 AllocationSpace id_; | 937 AllocationSpace id_; |
| 937 Executability executable_; | 938 Executability executable_; |
| 938 | 939 |
| 939 // Keeps track of committed memory in a space. | 940 // Keeps track of committed memory in a space. |
| 940 intptr_t committed_; | 941 intptr_t committed_; |
| 941 intptr_t max_committed_; | 942 intptr_t max_committed_; |
| 943 |
| 944 DISALLOW_COPY_AND_ASSIGN(Space); |
| 942 }; | 945 }; |
| 943 | 946 |
| 944 | 947 |
| 945 class MemoryChunkValidator { | 948 class MemoryChunkValidator { |
| 946 // Computed offsets should match the compiler generated ones. | 949 // Computed offsets should match the compiler generated ones. |
| 947 STATIC_ASSERT(MemoryChunk::kSizeOffset == offsetof(MemoryChunk, size_)); | 950 STATIC_ASSERT(MemoryChunk::kSizeOffset == offsetof(MemoryChunk, size_)); |
| 948 STATIC_ASSERT(MemoryChunk::kLiveBytesOffset == | 951 STATIC_ASSERT(MemoryChunk::kLiveBytesOffset == |
| 949 offsetof(MemoryChunk, live_byte_count_)); | 952 offsetof(MemoryChunk, live_byte_count_)); |
| 950 STATIC_ASSERT(MemoryChunk::kOldToNewSlotsOffset == | 953 STATIC_ASSERT(MemoryChunk::kOldToNewSlotsOffset == |
| 951 offsetof(MemoryChunk, old_to_new_slots_)); | 954 offsetof(MemoryChunk, old_to_new_slots_)); |
| (...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2982 count = 0; | 2985 count = 0; |
| 2983 } | 2986 } |
| 2984 // Must be small, since an iteration is used for lookup. | 2987 // Must be small, since an iteration is used for lookup. |
| 2985 static const int kMaxComments = 64; | 2988 static const int kMaxComments = 64; |
| 2986 }; | 2989 }; |
| 2987 #endif | 2990 #endif |
| 2988 } // namespace internal | 2991 } // namespace internal |
| 2989 } // namespace v8 | 2992 } // namespace v8 |
| 2990 | 2993 |
| 2991 #endif // V8_HEAP_SPACES_H_ | 2994 #endif // V8_HEAP_SPACES_H_ |
| OLD | NEW |