| 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 #include <memory> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 // ----------------------------------------------------------------------------- | 1463 // ----------------------------------------------------------------------------- |
| 1464 // A space has a circular list of pages. The next page can be accessed via | 1464 // A space has a circular list of pages. The next page can be accessed via |
| 1465 // Page::next_page() call. | 1465 // Page::next_page() call. |
| 1466 | 1466 |
| 1467 // An abstraction of allocation and relocation pointers in a page-structured | 1467 // An abstraction of allocation and relocation pointers in a page-structured |
| 1468 // space. | 1468 // space. |
| 1469 class AllocationInfo { | 1469 class AllocationInfo { |
| 1470 public: | 1470 public: |
| 1471 AllocationInfo() : original_top_(nullptr), top_(nullptr), limit_(nullptr) {} | 1471 AllocationInfo() : original_top_(nullptr), top_(nullptr), limit_(nullptr) {} |
| 1472 AllocationInfo(Address top, Address limit) | 1472 AllocationInfo(Address top, Address limit) |
| 1473 : original_top_(top), top_(top), limit_(limit) {} | 1473 : original_top_(top), top_(top), limit_(limit) { |
| 1474 DCHECK_LE(top_, limit_); |
| 1475 } |
| 1474 | 1476 |
| 1475 void Reset(Address top, Address limit) { | 1477 void Reset(Address top, Address limit) { |
| 1478 DCHECK_LE(top, limit); |
| 1476 original_top_ = top; | 1479 original_top_ = top; |
| 1477 set_top(top); | 1480 set_top(top); |
| 1478 set_limit(limit); | 1481 set_limit(limit); |
| 1479 } | 1482 } |
| 1480 | 1483 |
| 1481 Address original_top() { | 1484 Address original_top() { |
| 1482 SLOW_DCHECK(top_ == NULL || | 1485 SLOW_DCHECK(top_ == NULL || |
| 1483 (reinterpret_cast<intptr_t>(top_) & kHeapObjectTagMask) == 0); | 1486 (reinterpret_cast<intptr_t>(top_) & kHeapObjectTagMask) == 0); |
| 1484 return original_top_; | 1487 return original_top_; |
| 1485 } | 1488 } |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2115 | 2118 |
| 2116 // Expands the space by allocating a fixed number of pages. Returns false if | 2119 // Expands the space by allocating a fixed number of pages. Returns false if |
| 2117 // it cannot allocate requested number of pages from OS, or if the hard heap | 2120 // it cannot allocate requested number of pages from OS, or if the hard heap |
| 2118 // size limit has been hit. | 2121 // size limit has been hit. |
| 2119 bool Expand(); | 2122 bool Expand(); |
| 2120 | 2123 |
| 2121 // Generic fast case allocation function that tries linear allocation at the | 2124 // Generic fast case allocation function that tries linear allocation at the |
| 2122 // address denoted by top in allocation_info_. | 2125 // address denoted by top in allocation_info_. |
| 2123 inline HeapObject* AllocateLinearly(int size_in_bytes); | 2126 inline HeapObject* AllocateLinearly(int size_in_bytes); |
| 2124 | 2127 |
| 2128 void PrintStackFramesAndDie(); |
| 2129 |
| 2125 // Generic fast case allocation function that tries aligned linear allocation | 2130 // Generic fast case allocation function that tries aligned linear allocation |
| 2126 // at the address denoted by top in allocation_info_. Writes the aligned | 2131 // at the address denoted by top in allocation_info_. Writes the aligned |
| 2127 // allocation size, which includes the filler size, to size_in_bytes. | 2132 // allocation size, which includes the filler size, to size_in_bytes. |
| 2128 inline HeapObject* AllocateLinearlyAligned(int* size_in_bytes, | 2133 inline HeapObject* AllocateLinearlyAligned(int* size_in_bytes, |
| 2129 AllocationAlignment alignment); | 2134 AllocationAlignment alignment); |
| 2130 | 2135 |
| 2131 // If sweeping is still in progress try to sweep unswept pages. If that is | 2136 // If sweeping is still in progress try to sweep unswept pages. If that is |
| 2132 // not successful, wait for the sweeper threads and re-try free-list | 2137 // not successful, wait for the sweeper threads and re-try free-list |
| 2133 // allocation. | 2138 // allocation. |
| 2134 MUST_USE_RESULT virtual HeapObject* SweepAndRetryAllocation( | 2139 MUST_USE_RESULT virtual HeapObject* SweepAndRetryAllocation( |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2901 PageIterator old_iterator_; | 2906 PageIterator old_iterator_; |
| 2902 PageIterator code_iterator_; | 2907 PageIterator code_iterator_; |
| 2903 PageIterator map_iterator_; | 2908 PageIterator map_iterator_; |
| 2904 LargePageIterator lo_iterator_; | 2909 LargePageIterator lo_iterator_; |
| 2905 }; | 2910 }; |
| 2906 | 2911 |
| 2907 } // namespace internal | 2912 } // namespace internal |
| 2908 } // namespace v8 | 2913 } // namespace v8 |
| 2909 | 2914 |
| 2910 #endif // V8_HEAP_SPACES_H_ | 2915 #endif // V8_HEAP_SPACES_H_ |
| OLD | NEW |