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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 // x64 and ia32 architectures. | 810 // x64 and ia32 architectures. |
811 static const int kMaxCodePageSize = 512 * MB; | 811 static const int kMaxCodePageSize = 512 * MB; |
812 | 812 |
813 private: | 813 private: |
814 static inline LargePage* Initialize(Heap* heap, MemoryChunk* chunk, | 814 static inline LargePage* Initialize(Heap* heap, MemoryChunk* chunk, |
815 Executability executable, Space* owner); | 815 Executability executable, Space* owner); |
816 | 816 |
817 friend class MemoryAllocator; | 817 friend class MemoryAllocator; |
818 }; | 818 }; |
819 | 819 |
| 820 |
820 // ---------------------------------------------------------------------------- | 821 // ---------------------------------------------------------------------------- |
821 // Space is the abstract superclass for all allocation spaces. | 822 // Space is the abstract superclass for all allocation spaces. |
822 class Space : public Malloced { | 823 class Space : public Malloced { |
823 public: | 824 public: |
824 Space(Heap* heap, AllocationSpace id, Executability executable) | 825 Space(Heap* heap, AllocationSpace id, Executability executable) |
825 : allocation_observers_(new List<AllocationObserver*>()), | 826 : allocation_observers_(new List<AllocationObserver*>()), |
826 allocation_observers_paused_(false), | 827 allocation_observers_paused_(false), |
827 heap_(heap), | 828 heap_(heap), |
828 id_(id), | 829 id_(id), |
829 executable_(executable), | 830 executable_(executable), |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 AllocationSpace id_; | 916 AllocationSpace id_; |
916 Executability executable_; | 917 Executability executable_; |
917 | 918 |
918 // Keeps track of committed memory in a space. | 919 // Keeps track of committed memory in a space. |
919 size_t committed_; | 920 size_t committed_; |
920 size_t max_committed_; | 921 size_t max_committed_; |
921 | 922 |
922 DISALLOW_COPY_AND_ASSIGN(Space); | 923 DISALLOW_COPY_AND_ASSIGN(Space); |
923 }; | 924 }; |
924 | 925 |
925 // An abstraction of allocation and relocation pointers in a page-structured | |
926 // space. | |
927 class AllocationInfo { | |
928 public: | |
929 AllocationInfo() : original_top_(nullptr), top_(nullptr), limit_(nullptr) {} | |
930 AllocationInfo(Address top, Address limit) | |
931 : original_top_(top), top_(top), limit_(limit) {} | |
932 | |
933 void Reset(Address top, Address limit) { | |
934 original_top_ = top; | |
935 set_top(top); | |
936 set_limit(limit); | |
937 } | |
938 | |
939 Address original_top() { | |
940 SLOW_DCHECK(top_ == NULL || | |
941 (reinterpret_cast<intptr_t>(top_) & kHeapObjectTagMask) == 0); | |
942 return original_top_; | |
943 } | |
944 | |
945 INLINE(void set_top(Address top)) { | |
946 SLOW_DCHECK(top == NULL || | |
947 (reinterpret_cast<intptr_t>(top) & kHeapObjectTagMask) == 0); | |
948 top_ = top; | |
949 } | |
950 | |
951 INLINE(Address top()) const { | |
952 SLOW_DCHECK(top_ == NULL || | |
953 (reinterpret_cast<intptr_t>(top_) & kHeapObjectTagMask) == 0); | |
954 return top_; | |
955 } | |
956 | |
957 Address* top_address() { return &top_; } | |
958 | |
959 INLINE(void set_limit(Address limit)) { limit_ = limit; } | |
960 | |
961 INLINE(Address limit()) const { return limit_; } | |
962 | |
963 Address* limit_address() { return &limit_; } | |
964 | |
965 #ifdef DEBUG | |
966 bool VerifyPagedAllocation() { | |
967 return (Page::FromAllocationAreaAddress(top_) == | |
968 Page::FromAllocationAreaAddress(limit_)) && | |
969 (top_ <= limit_); | |
970 } | |
971 #endif | |
972 | |
973 private: | |
974 // The original top address when the allocation info was initialized. | |
975 Address original_top_; | |
976 // Current allocation top. | |
977 Address top_; | |
978 // Current allocation limit. | |
979 Address limit_; | |
980 }; | |
981 | |
982 class SpaceWithInlineAllocationArea : public Space { | |
983 public: | |
984 SpaceWithInlineAllocationArea(Heap* heap, AllocationSpace id, | |
985 Executability executable) | |
986 : Space(heap, id, executable), allocation_info_(nullptr, nullptr) {} | |
987 | |
988 Address top() { return allocation_info_.top(); } | |
989 Address limit() { return allocation_info_.limit(); } | |
990 | |
991 Address* allocation_top_address() { return allocation_info_.top_address(); } | |
992 | |
993 Address* allocation_limit_address() { | |
994 return allocation_info_.limit_address(); | |
995 } | |
996 | |
997 protected: | |
998 AllocationInfo allocation_info_; | |
999 }; | |
1000 | 926 |
1001 class MemoryChunkValidator { | 927 class MemoryChunkValidator { |
1002 // Computed offsets should match the compiler generated ones. | 928 // Computed offsets should match the compiler generated ones. |
1003 STATIC_ASSERT(MemoryChunk::kSizeOffset == offsetof(MemoryChunk, size_)); | 929 STATIC_ASSERT(MemoryChunk::kSizeOffset == offsetof(MemoryChunk, size_)); |
1004 | 930 |
1005 // Validate our estimates on the header size. | 931 // Validate our estimates on the header size. |
1006 STATIC_ASSERT(sizeof(MemoryChunk) <= MemoryChunk::kHeaderSize); | 932 STATIC_ASSERT(sizeof(MemoryChunk) <= MemoryChunk::kHeaderSize); |
1007 STATIC_ASSERT(sizeof(LargePage) <= MemoryChunk::kHeaderSize); | 933 STATIC_ASSERT(sizeof(LargePage) <= MemoryChunk::kHeaderSize); |
1008 STATIC_ASSERT(sizeof(Page) <= MemoryChunk::kHeaderSize); | 934 STATIC_ASSERT(sizeof(Page) <= MemoryChunk::kHeaderSize); |
1009 }; | 935 }; |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1483 private: | 1409 private: |
1484 PAGE_TYPE* p_; | 1410 PAGE_TYPE* p_; |
1485 }; | 1411 }; |
1486 | 1412 |
1487 typedef PageIteratorImpl<Page> PageIterator; | 1413 typedef PageIteratorImpl<Page> PageIterator; |
1488 typedef PageIteratorImpl<LargePage> LargePageIterator; | 1414 typedef PageIteratorImpl<LargePage> LargePageIterator; |
1489 | 1415 |
1490 class PageRange { | 1416 class PageRange { |
1491 public: | 1417 public: |
1492 typedef PageIterator iterator; | 1418 typedef PageIterator iterator; |
1493 | 1419 PageRange(Page* begin, Page* end) : begin_(begin), end_(end) {} |
1494 explicit PageRange(Page* page) : PageRange(page, page->next_page()) {} | 1420 explicit PageRange(Page* page) : PageRange(page, page->next_page()) {} |
1495 PageRange(Page* begin, Page* end) : begin_(begin), end_(end) {} | |
1496 inline PageRange(Address start, Address limit); | |
1497 | |
1498 iterator begin() { return iterator(begin_); } | 1421 iterator begin() { return iterator(begin_); } |
1499 iterator end() { return iterator(end_); } | 1422 iterator end() { return iterator(end_); } |
1500 | 1423 |
1501 private: | 1424 private: |
1502 Page* begin_; | 1425 Page* begin_; |
1503 Page* end_; | 1426 Page* end_; |
1504 }; | 1427 }; |
1505 | 1428 |
1506 // ----------------------------------------------------------------------------- | 1429 // ----------------------------------------------------------------------------- |
1507 // Heap object iterator in new/old/map spaces. | 1430 // Heap object iterator in new/old/map spaces. |
1508 // | 1431 // |
1509 // A HeapObjectIterator iterates objects from the bottom of the given space | 1432 // A HeapObjectIterator iterates objects from the bottom of the given space |
1510 // to its top or from the bottom of the given page to its top. | 1433 // to its top or from the bottom of the given page to its top. |
1511 // | 1434 // |
1512 // If objects are allocated in the page during iteration the iterator may | 1435 // If objects are allocated in the page during iteration the iterator may |
1513 // or may not iterate over those objects. The caller must create a new | 1436 // or may not iterate over those objects. The caller must create a new |
1514 // iterator in order to be sure to visit these new objects. | 1437 // iterator in order to be sure to visit these new objects. |
1515 class V8_EXPORT_PRIVATE HeapObjectIterator : public ObjectIterator { | 1438 class V8_EXPORT_PRIVATE HeapObjectIterator : public ObjectIterator { |
1516 public: | 1439 public: |
| 1440 // Creates a new object iterator in a given space. |
1517 explicit HeapObjectIterator(PagedSpace* space); | 1441 explicit HeapObjectIterator(PagedSpace* space); |
1518 explicit HeapObjectIterator(NewSpace* space); | |
1519 explicit HeapObjectIterator(Page* page); | 1442 explicit HeapObjectIterator(Page* page); |
1520 | 1443 |
1521 // Advance to the next object, skipping free spaces and other fillers and | 1444 // Advance to the next object, skipping free spaces and other fillers and |
1522 // skipping the special garbage section of which there is one per space. | 1445 // skipping the special garbage section of which there is one per space. |
1523 // Returns nullptr when the iteration has ended. | 1446 // Returns nullptr when the iteration has ended. |
1524 inline HeapObject* Next() override; | 1447 inline HeapObject* Next() override; |
1525 | 1448 |
1526 private: | 1449 private: |
1527 inline Page* current_page() { return (*next_page_)->prev_page(); } | |
1528 // Fast (inlined) path of next(). | 1450 // Fast (inlined) path of next(). |
1529 inline HeapObject* FromCurrentPage(); | 1451 inline HeapObject* FromCurrentPage(); |
1530 | 1452 |
1531 // Slow path of next(), goes into the next page. Returns false if the | 1453 // Slow path of next(), goes into the next page. Returns false if the |
1532 // iteration has ended. | 1454 // iteration has ended. |
1533 bool AdvanceToNextPage(); | 1455 bool AdvanceToNextPage(); |
1534 | 1456 |
1535 Address cur_addr_; // Current iteration point. | 1457 Address cur_addr_; // Current iteration point. |
1536 Address cur_end_; // End iteration point. | 1458 Address cur_end_; // End iteration point. |
1537 SpaceWithInlineAllocationArea* space_; | 1459 PagedSpace* space_; |
1538 PageRange page_range_; | 1460 PageRange page_range_; |
1539 PageRange::iterator next_page_; | 1461 PageRange::iterator current_page_; |
1540 }; | 1462 }; |
1541 | 1463 |
| 1464 |
| 1465 // ----------------------------------------------------------------------------- |
| 1466 // A space has a circular list of pages. The next page can be accessed via |
| 1467 // Page::next_page() call. |
| 1468 |
| 1469 // An abstraction of allocation and relocation pointers in a page-structured |
| 1470 // space. |
| 1471 class AllocationInfo { |
| 1472 public: |
| 1473 AllocationInfo() : original_top_(nullptr), top_(nullptr), limit_(nullptr) {} |
| 1474 AllocationInfo(Address top, Address limit) |
| 1475 : original_top_(top), top_(top), limit_(limit) {} |
| 1476 |
| 1477 void Reset(Address top, Address limit) { |
| 1478 original_top_ = top; |
| 1479 set_top(top); |
| 1480 set_limit(limit); |
| 1481 } |
| 1482 |
| 1483 Address original_top() { |
| 1484 SLOW_DCHECK(top_ == NULL || |
| 1485 (reinterpret_cast<intptr_t>(top_) & kHeapObjectTagMask) == 0); |
| 1486 return original_top_; |
| 1487 } |
| 1488 |
| 1489 INLINE(void set_top(Address top)) { |
| 1490 SLOW_DCHECK(top == NULL || |
| 1491 (reinterpret_cast<intptr_t>(top) & kHeapObjectTagMask) == 0); |
| 1492 top_ = top; |
| 1493 } |
| 1494 |
| 1495 INLINE(Address top()) const { |
| 1496 SLOW_DCHECK(top_ == NULL || |
| 1497 (reinterpret_cast<intptr_t>(top_) & kHeapObjectTagMask) == 0); |
| 1498 return top_; |
| 1499 } |
| 1500 |
| 1501 Address* top_address() { return &top_; } |
| 1502 |
| 1503 INLINE(void set_limit(Address limit)) { |
| 1504 limit_ = limit; |
| 1505 } |
| 1506 |
| 1507 INLINE(Address limit()) const { |
| 1508 return limit_; |
| 1509 } |
| 1510 |
| 1511 Address* limit_address() { return &limit_; } |
| 1512 |
| 1513 #ifdef DEBUG |
| 1514 bool VerifyPagedAllocation() { |
| 1515 return (Page::FromAllocationAreaAddress(top_) == |
| 1516 Page::FromAllocationAreaAddress(limit_)) && |
| 1517 (top_ <= limit_); |
| 1518 } |
| 1519 #endif |
| 1520 |
| 1521 private: |
| 1522 // The original top address when the allocation info was initialized. |
| 1523 Address original_top_; |
| 1524 // Current allocation top. |
| 1525 Address top_; |
| 1526 // Current allocation limit. |
| 1527 Address limit_; |
| 1528 }; |
| 1529 |
| 1530 |
1542 // An abstraction of the accounting statistics of a page-structured space. | 1531 // An abstraction of the accounting statistics of a page-structured space. |
1543 // | 1532 // |
1544 // The stats are only set by functions that ensure they stay balanced. These | 1533 // The stats are only set by functions that ensure they stay balanced. These |
1545 // functions increase or decrease one of the non-capacity stats in conjunction | 1534 // functions increase or decrease one of the non-capacity stats in conjunction |
1546 // with capacity, or else they always balance increases and decreases to the | 1535 // with capacity, or else they always balance increases and decreases to the |
1547 // non-capacity stats. | 1536 // non-capacity stats. |
1548 class AllocationStats BASE_EMBEDDED { | 1537 class AllocationStats BASE_EMBEDDED { |
1549 public: | 1538 public: |
1550 AllocationStats() { Clear(); } | 1539 AllocationStats() { Clear(); } |
1551 | 1540 |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1881 | 1870 |
1882 private: | 1871 private: |
1883 LocalAllocationBuffer(Heap* heap, AllocationInfo allocation_info); | 1872 LocalAllocationBuffer(Heap* heap, AllocationInfo allocation_info); |
1884 | 1873 |
1885 void Close(); | 1874 void Close(); |
1886 | 1875 |
1887 Heap* heap_; | 1876 Heap* heap_; |
1888 AllocationInfo allocation_info_; | 1877 AllocationInfo allocation_info_; |
1889 }; | 1878 }; |
1890 | 1879 |
1891 class PagedSpace : public SpaceWithInlineAllocationArea { | 1880 class NewSpacePageRange { |
| 1881 public: |
| 1882 typedef PageRange::iterator iterator; |
| 1883 inline NewSpacePageRange(Address start, Address limit); |
| 1884 iterator begin() { return range_.begin(); } |
| 1885 iterator end() { return range_.end(); } |
| 1886 |
| 1887 private: |
| 1888 PageRange range_; |
| 1889 }; |
| 1890 |
| 1891 class PagedSpace : public Space { |
1892 public: | 1892 public: |
1893 typedef PageIterator iterator; | 1893 typedef PageIterator iterator; |
1894 | 1894 |
1895 static const intptr_t kCompactionMemoryWanted = 500 * KB; | 1895 static const intptr_t kCompactionMemoryWanted = 500 * KB; |
1896 | 1896 |
1897 // Creates a space with an id. | 1897 // Creates a space with an id. |
1898 PagedSpace(Heap* heap, AllocationSpace id, Executability executable); | 1898 PagedSpace(Heap* heap, AllocationSpace id, Executability executable); |
1899 | 1899 |
1900 ~PagedSpace() override { TearDown(); } | 1900 ~PagedSpace() override { TearDown(); } |
1901 | 1901 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 size_t Size() override { return accounting_stats_.Size(); } | 1959 size_t Size() override { return accounting_stats_.Size(); } |
1960 | 1960 |
1961 // As size, but the bytes in lazily swept pages are estimated and the bytes | 1961 // As size, but the bytes in lazily swept pages are estimated and the bytes |
1962 // in the current linear allocation area are not included. | 1962 // in the current linear allocation area are not included. |
1963 size_t SizeOfObjects() override; | 1963 size_t SizeOfObjects() override; |
1964 | 1964 |
1965 // Wasted bytes in this space. These are just the bytes that were thrown away | 1965 // Wasted bytes in this space. These are just the bytes that were thrown away |
1966 // due to being too small to use for allocation. | 1966 // due to being too small to use for allocation. |
1967 virtual size_t Waste() { return free_list_.wasted_bytes(); } | 1967 virtual size_t Waste() { return free_list_.wasted_bytes(); } |
1968 | 1968 |
| 1969 // Returns the allocation pointer in this space. |
| 1970 Address top() { return allocation_info_.top(); } |
| 1971 Address limit() { return allocation_info_.limit(); } |
| 1972 |
| 1973 // The allocation top address. |
| 1974 Address* allocation_top_address() { return allocation_info_.top_address(); } |
| 1975 |
| 1976 // The allocation limit address. |
| 1977 Address* allocation_limit_address() { |
| 1978 return allocation_info_.limit_address(); |
| 1979 } |
| 1980 |
1969 enum UpdateSkipList { UPDATE_SKIP_LIST, IGNORE_SKIP_LIST }; | 1981 enum UpdateSkipList { UPDATE_SKIP_LIST, IGNORE_SKIP_LIST }; |
1970 | 1982 |
1971 // Allocate the requested number of bytes in the space if possible, return a | 1983 // Allocate the requested number of bytes in the space if possible, return a |
1972 // failure object if not. Only use IGNORE_SKIP_LIST if the skip list is going | 1984 // failure object if not. Only use IGNORE_SKIP_LIST if the skip list is going |
1973 // to be manually updated later. | 1985 // to be manually updated later. |
1974 MUST_USE_RESULT inline AllocationResult AllocateRawUnaligned( | 1986 MUST_USE_RESULT inline AllocationResult AllocateRawUnaligned( |
1975 int size_in_bytes, UpdateSkipList update_skip_list = UPDATE_SKIP_LIST); | 1987 int size_in_bytes, UpdateSkipList update_skip_list = UPDATE_SKIP_LIST); |
1976 | 1988 |
1977 MUST_USE_RESULT inline AllocationResult AllocateRawUnalignedSynchronized( | 1989 MUST_USE_RESULT inline AllocationResult AllocateRawUnalignedSynchronized( |
1978 int size_in_bytes); | 1990 int size_in_bytes); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2131 | 2143 |
2132 // Accounting information for this space. | 2144 // Accounting information for this space. |
2133 AllocationStats accounting_stats_; | 2145 AllocationStats accounting_stats_; |
2134 | 2146 |
2135 // The dummy page that anchors the double linked list of pages. | 2147 // The dummy page that anchors the double linked list of pages. |
2136 Page anchor_; | 2148 Page anchor_; |
2137 | 2149 |
2138 // The space's free list. | 2150 // The space's free list. |
2139 FreeList free_list_; | 2151 FreeList free_list_; |
2140 | 2152 |
| 2153 // Normal allocation information. |
| 2154 AllocationInfo allocation_info_; |
| 2155 |
2141 // Mutex guarding any concurrent access to the space. | 2156 // Mutex guarding any concurrent access to the space. |
2142 base::Mutex space_mutex_; | 2157 base::Mutex space_mutex_; |
2143 | 2158 |
2144 friend class IncrementalMarking; | 2159 friend class IncrementalMarking; |
2145 friend class MarkCompactCollector; | 2160 friend class MarkCompactCollector; |
2146 | 2161 |
2147 // Used in cctest. | 2162 // Used in cctest. |
2148 friend class HeapTester; | 2163 friend class HeapTester; |
2149 }; | 2164 }; |
2150 | 2165 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2345 // The end of iteration. | 2360 // The end of iteration. |
2346 Address limit_; | 2361 Address limit_; |
2347 }; | 2362 }; |
2348 | 2363 |
2349 // ----------------------------------------------------------------------------- | 2364 // ----------------------------------------------------------------------------- |
2350 // The young generation space. | 2365 // The young generation space. |
2351 // | 2366 // |
2352 // The new space consists of a contiguous pair of semispaces. It simply | 2367 // The new space consists of a contiguous pair of semispaces. It simply |
2353 // forwards most functions to the appropriate semispace. | 2368 // forwards most functions to the appropriate semispace. |
2354 | 2369 |
2355 class NewSpace : public SpaceWithInlineAllocationArea { | 2370 class NewSpace : public Space { |
2356 public: | 2371 public: |
2357 typedef PageIterator iterator; | 2372 typedef PageIterator iterator; |
2358 | 2373 |
2359 explicit NewSpace(Heap* heap) | 2374 explicit NewSpace(Heap* heap) |
2360 : SpaceWithInlineAllocationArea(heap, NEW_SPACE, NOT_EXECUTABLE), | 2375 : Space(heap, NEW_SPACE, NOT_EXECUTABLE), |
2361 to_space_(heap, kToSpace), | 2376 to_space_(heap, kToSpace), |
2362 from_space_(heap, kFromSpace), | 2377 from_space_(heap, kFromSpace), |
2363 reservation_(), | 2378 reservation_(), |
2364 top_on_previous_step_(0), | 2379 top_on_previous_step_(0), |
2365 allocated_histogram_(nullptr), | 2380 allocated_histogram_(nullptr), |
2366 promoted_histogram_(nullptr) {} | 2381 promoted_histogram_(nullptr) {} |
2367 | 2382 |
2368 inline bool Contains(HeapObject* o); | 2383 inline bool Contains(HeapObject* o); |
2369 inline bool ContainsSlow(Address a); | 2384 inline bool ContainsSlow(Address a); |
2370 inline bool Contains(Object* o); | 2385 inline bool Contains(Object* o); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2486 } | 2501 } |
2487 | 2502 |
2488 bool IsAtMaximumCapacity() { return TotalCapacity() == MaximumCapacity(); } | 2503 bool IsAtMaximumCapacity() { return TotalCapacity() == MaximumCapacity(); } |
2489 | 2504 |
2490 // Returns the initial capacity of a semispace. | 2505 // Returns the initial capacity of a semispace. |
2491 size_t InitialTotalCapacity() { | 2506 size_t InitialTotalCapacity() { |
2492 DCHECK(to_space_.minimum_capacity() == from_space_.minimum_capacity()); | 2507 DCHECK(to_space_.minimum_capacity() == from_space_.minimum_capacity()); |
2493 return to_space_.minimum_capacity(); | 2508 return to_space_.minimum_capacity(); |
2494 } | 2509 } |
2495 | 2510 |
| 2511 // Return the address of the allocation pointer in the active semispace. |
| 2512 Address top() { |
| 2513 DCHECK(to_space_.current_page()->ContainsLimit(allocation_info_.top())); |
| 2514 return allocation_info_.top(); |
| 2515 } |
| 2516 |
| 2517 // Return the address of the allocation pointer limit in the active semispace. |
| 2518 Address limit() { |
| 2519 DCHECK(to_space_.current_page()->ContainsLimit(allocation_info_.limit())); |
| 2520 return allocation_info_.limit(); |
| 2521 } |
| 2522 |
2496 // Return the address of the first object in the active semispace. | 2523 // Return the address of the first object in the active semispace. |
2497 Address bottom() { return to_space_.space_start(); } | 2524 Address bottom() { return to_space_.space_start(); } |
2498 | 2525 |
2499 // Get the age mark of the inactive semispace. | 2526 // Get the age mark of the inactive semispace. |
2500 Address age_mark() { return from_space_.age_mark(); } | 2527 Address age_mark() { return from_space_.age_mark(); } |
2501 // Set the age mark in the active semispace. | 2528 // Set the age mark in the active semispace. |
2502 void set_age_mark(Address mark) { to_space_.set_age_mark(mark); } | 2529 void set_age_mark(Address mark) { to_space_.set_age_mark(mark); } |
2503 | 2530 |
| 2531 // The allocation top and limit address. |
| 2532 Address* allocation_top_address() { return allocation_info_.top_address(); } |
| 2533 |
| 2534 // The allocation limit address. |
| 2535 Address* allocation_limit_address() { |
| 2536 return allocation_info_.limit_address(); |
| 2537 } |
| 2538 |
2504 MUST_USE_RESULT INLINE(AllocationResult AllocateRawAligned( | 2539 MUST_USE_RESULT INLINE(AllocationResult AllocateRawAligned( |
2505 int size_in_bytes, AllocationAlignment alignment)); | 2540 int size_in_bytes, AllocationAlignment alignment)); |
2506 | 2541 |
2507 MUST_USE_RESULT INLINE( | 2542 MUST_USE_RESULT INLINE( |
2508 AllocationResult AllocateRawUnaligned(int size_in_bytes)); | 2543 AllocationResult AllocateRawUnaligned(int size_in_bytes)); |
2509 | 2544 |
2510 MUST_USE_RESULT INLINE(AllocationResult AllocateRaw( | 2545 MUST_USE_RESULT INLINE(AllocationResult AllocateRaw( |
2511 int size_in_bytes, AllocationAlignment alignment)); | 2546 int size_in_bytes, AllocationAlignment alignment)); |
2512 | 2547 |
2513 MUST_USE_RESULT inline AllocationResult AllocateRawSynchronized( | 2548 MUST_USE_RESULT inline AllocationResult AllocateRawSynchronized( |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2610 // Update allocation info to match the current to-space page. | 2645 // Update allocation info to match the current to-space page. |
2611 void UpdateAllocationInfo(); | 2646 void UpdateAllocationInfo(); |
2612 | 2647 |
2613 base::Mutex mutex_; | 2648 base::Mutex mutex_; |
2614 | 2649 |
2615 // The semispaces. | 2650 // The semispaces. |
2616 SemiSpace to_space_; | 2651 SemiSpace to_space_; |
2617 SemiSpace from_space_; | 2652 SemiSpace from_space_; |
2618 base::VirtualMemory reservation_; | 2653 base::VirtualMemory reservation_; |
2619 | 2654 |
| 2655 // Allocation pointer and limit for normal allocation and allocation during |
| 2656 // mark-compact collection. |
| 2657 AllocationInfo allocation_info_; |
| 2658 |
2620 Address top_on_previous_step_; | 2659 Address top_on_previous_step_; |
2621 | 2660 |
2622 HistogramInfo* allocated_histogram_; | 2661 HistogramInfo* allocated_histogram_; |
2623 HistogramInfo* promoted_histogram_; | 2662 HistogramInfo* promoted_histogram_; |
2624 | 2663 |
2625 bool EnsureAllocation(int size_in_bytes, AllocationAlignment alignment); | 2664 bool EnsureAllocation(int size_in_bytes, AllocationAlignment alignment); |
2626 | 2665 |
2627 // If we are doing inline allocation in steps, this method performs the 'step' | 2666 // If we are doing inline allocation in steps, this method performs the 'step' |
2628 // operation. top is the memory address of the bump pointer at the last | 2667 // operation. top is the memory address of the bump pointer at the last |
2629 // inline allocation (i.e. it determines the numbers of bytes actually | 2668 // inline allocation (i.e. it determines the numbers of bytes actually |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2877 PageIterator old_iterator_; | 2916 PageIterator old_iterator_; |
2878 PageIterator code_iterator_; | 2917 PageIterator code_iterator_; |
2879 PageIterator map_iterator_; | 2918 PageIterator map_iterator_; |
2880 LargePageIterator lo_iterator_; | 2919 LargePageIterator lo_iterator_; |
2881 }; | 2920 }; |
2882 | 2921 |
2883 } // namespace internal | 2922 } // namespace internal |
2884 } // namespace v8 | 2923 } // namespace v8 |
2885 | 2924 |
2886 #endif // V8_HEAP_SPACES_H_ | 2925 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |