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 2103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2114 | 2114 |
2115 // Generic fast case allocation function that tries aligned linear allocation | 2115 // Generic fast case allocation function that tries aligned linear allocation |
2116 // at the address denoted by top in allocation_info_. Writes the aligned | 2116 // at the address denoted by top in allocation_info_. Writes the aligned |
2117 // allocation size, which includes the filler size, to size_in_bytes. | 2117 // allocation size, which includes the filler size, to size_in_bytes. |
2118 inline HeapObject* AllocateLinearlyAligned(int* size_in_bytes, | 2118 inline HeapObject* AllocateLinearlyAligned(int* size_in_bytes, |
2119 AllocationAlignment alignment); | 2119 AllocationAlignment alignment); |
2120 | 2120 |
2121 // If sweeping is still in progress try to sweep unswept pages. If that is | 2121 // If sweeping is still in progress try to sweep unswept pages. If that is |
2122 // not successful, wait for the sweeper threads and re-try free-list | 2122 // not successful, wait for the sweeper threads and re-try free-list |
2123 // allocation. | 2123 // allocation. |
2124 MUST_USE_RESULT HeapObject* WaitForSweeperThreadsAndRetryAllocation( | 2124 MUST_USE_RESULT virtual HeapObject* SweepAndRetry(int size_in_bytes); |
2125 int size_in_bytes); | |
2126 | 2125 |
2127 // Slow path of AllocateRaw. This function is space-dependent. | 2126 // Slow path of AllocateRaw. This function is space-dependent. |
2128 MUST_USE_RESULT HeapObject* SlowAllocateRaw(int size_in_bytes); | 2127 MUST_USE_RESULT HeapObject* SlowAllocateRaw(int size_in_bytes); |
2129 | 2128 |
2130 int area_size_; | 2129 int area_size_; |
2131 | 2130 |
2132 // Accounting information for this space. | 2131 // Accounting information for this space. |
2133 AllocationStats accounting_stats_; | 2132 AllocationStats accounting_stats_; |
2134 | 2133 |
2135 // The dummy page that anchors the double linked list of pages. | 2134 // The dummy page that anchors the double linked list of pages. |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2831 Free(start, size_in_bytes); | 2830 Free(start, size_in_bytes); |
2832 } | 2831 } |
2833 | 2832 |
2834 virtual bool is_local() override { return true; } | 2833 virtual bool is_local() override { return true; } |
2835 | 2834 |
2836 virtual void RefillFreeList() override; | 2835 virtual void RefillFreeList() override; |
2837 | 2836 |
2838 protected: | 2837 protected: |
2839 // The space is temporary and not included in any snapshots. | 2838 // The space is temporary and not included in any snapshots. |
2840 virtual bool snapshotable() override { return false; } | 2839 virtual bool snapshotable() override { return false; } |
| 2840 |
| 2841 MUST_USE_RESULT virtual HeapObject* SweepAndRetry(int size_in_bytes) override; |
2841 }; | 2842 }; |
2842 | 2843 |
2843 | 2844 |
2844 // A collection of |CompactionSpace|s used by a single compaction task. | 2845 // A collection of |CompactionSpace|s used by a single compaction task. |
2845 class CompactionSpaceCollection : public Malloced { | 2846 class CompactionSpaceCollection : public Malloced { |
2846 public: | 2847 public: |
2847 explicit CompactionSpaceCollection(Heap* heap) | 2848 explicit CompactionSpaceCollection(Heap* heap) |
2848 : old_space_(heap, OLD_SPACE, Executability::NOT_EXECUTABLE), | 2849 : old_space_(heap, OLD_SPACE, Executability::NOT_EXECUTABLE), |
2849 code_space_(heap, CODE_SPACE, Executability::EXECUTABLE) {} | 2850 code_space_(heap, CODE_SPACE, Executability::EXECUTABLE) {} |
2850 | 2851 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3056 count = 0; | 3057 count = 0; |
3057 } | 3058 } |
3058 // Must be small, since an iteration is used for lookup. | 3059 // Must be small, since an iteration is used for lookup. |
3059 static const int kMaxComments = 64; | 3060 static const int kMaxComments = 64; |
3060 }; | 3061 }; |
3061 #endif | 3062 #endif |
3062 } // namespace internal | 3063 } // namespace internal |
3063 } // namespace v8 | 3064 } // namespace v8 |
3064 | 3065 |
3065 #endif // V8_HEAP_SPACES_H_ | 3066 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |