| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1847 SetTopAndLimit(NULL, NULL); | 1847 SetTopAndLimit(NULL, NULL); |
| 1848 } | 1848 } |
| 1849 | 1849 |
| 1850 void Allocate(int bytes) { | 1850 void Allocate(int bytes) { |
| 1851 accounting_stats_.AllocateBytes(bytes); | 1851 accounting_stats_.AllocateBytes(bytes); |
| 1852 } | 1852 } |
| 1853 | 1853 |
| 1854 void IncreaseCapacity(int size); | 1854 void IncreaseCapacity(int size); |
| 1855 | 1855 |
| 1856 // Releases an unused page and shrinks the space. | 1856 // Releases an unused page and shrinks the space. |
| 1857 void ReleasePage(Page* page, bool unlink); | 1857 void ReleasePage(Page* page); |
| 1858 | 1858 |
| 1859 // The dummy page that anchors the linked list of pages. | 1859 // The dummy page that anchors the linked list of pages. |
| 1860 Page* anchor() { return &anchor_; } | 1860 Page* anchor() { return &anchor_; } |
| 1861 | 1861 |
| 1862 #ifdef VERIFY_HEAP | 1862 #ifdef VERIFY_HEAP |
| 1863 // Verify integrity of this space. | 1863 // Verify integrity of this space. |
| 1864 virtual void Verify(ObjectVisitor* visitor); | 1864 virtual void Verify(ObjectVisitor* visitor); |
| 1865 | 1865 |
| 1866 // Overridden by subclasses to verify space-specific object | 1866 // Overridden by subclasses to verify space-specific object |
| 1867 // properties (e.g., only maps or free-list nodes are in map space). | 1867 // properties (e.g., only maps or free-list nodes are in map space). |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 void ResetUnsweptFreeBytes() { | 1913 void ResetUnsweptFreeBytes() { |
| 1914 unswept_free_bytes_ = 0; | 1914 unswept_free_bytes_ = 0; |
| 1915 } | 1915 } |
| 1916 | 1916 |
| 1917 // This function tries to steal size_in_bytes memory from the sweeper threads | 1917 // This function tries to steal size_in_bytes memory from the sweeper threads |
| 1918 // free-lists. If it does not succeed stealing enough memory, it will wait | 1918 // free-lists. If it does not succeed stealing enough memory, it will wait |
| 1919 // for the sweeper threads to finish sweeping. | 1919 // for the sweeper threads to finish sweeping. |
| 1920 // It returns true when sweeping is completed and false otherwise. | 1920 // It returns true when sweeping is completed and false otherwise. |
| 1921 bool EnsureSweeperProgress(intptr_t size_in_bytes); | 1921 bool EnsureSweeperProgress(intptr_t size_in_bytes); |
| 1922 | 1922 |
| 1923 void set_end_of_unswept_pages(Page* page) { |
| 1924 end_of_unswept_pages_ = page; |
| 1925 } |
| 1926 |
| 1927 Page* end_of_unswept_pages() { |
| 1928 return end_of_unswept_pages_; |
| 1929 } |
| 1930 |
| 1923 Page* FirstPage() { return anchor_.next_page(); } | 1931 Page* FirstPage() { return anchor_.next_page(); } |
| 1924 Page* LastPage() { return anchor_.prev_page(); } | 1932 Page* LastPage() { return anchor_.prev_page(); } |
| 1925 | 1933 |
| 1926 void EvictEvacuationCandidatesFromFreeLists(); | 1934 void EvictEvacuationCandidatesFromFreeLists(); |
| 1927 | 1935 |
| 1928 bool CanExpand(); | 1936 bool CanExpand(); |
| 1929 | 1937 |
| 1930 // Returns the number of total pages in this space. | 1938 // Returns the number of total pages in this space. |
| 1931 int CountTotalPages(); | 1939 int CountTotalPages(); |
| 1932 | 1940 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1957 // Normal allocation information. | 1965 // Normal allocation information. |
| 1958 AllocationInfo allocation_info_; | 1966 AllocationInfo allocation_info_; |
| 1959 | 1967 |
| 1960 bool was_swept_conservatively_; | 1968 bool was_swept_conservatively_; |
| 1961 | 1969 |
| 1962 // The number of free bytes which could be reclaimed by advancing the | 1970 // The number of free bytes which could be reclaimed by advancing the |
| 1963 // concurrent sweeper threads. This is only an estimation because concurrent | 1971 // concurrent sweeper threads. This is only an estimation because concurrent |
| 1964 // sweeping is done conservatively. | 1972 // sweeping is done conservatively. |
| 1965 intptr_t unswept_free_bytes_; | 1973 intptr_t unswept_free_bytes_; |
| 1966 | 1974 |
| 1975 Page* end_of_unswept_pages_; |
| 1976 |
| 1967 // Expands the space by allocating a fixed number of pages. Returns false if | 1977 // Expands the space by allocating a fixed number of pages. Returns false if |
| 1968 // it cannot allocate requested number of pages from OS, or if the hard heap | 1978 // it cannot allocate requested number of pages from OS, or if the hard heap |
| 1969 // size limit has been hit. | 1979 // size limit has been hit. |
| 1970 bool Expand(); | 1980 bool Expand(); |
| 1971 | 1981 |
| 1972 // Generic fast case allocation function that tries linear allocation at the | 1982 // Generic fast case allocation function that tries linear allocation at the |
| 1973 // address denoted by top in allocation_info_. | 1983 // address denoted by top in allocation_info_. |
| 1974 inline HeapObject* AllocateLinearly(int size_in_bytes); | 1984 inline HeapObject* AllocateLinearly(int size_in_bytes); |
| 1975 | 1985 |
| 1976 // Slow path of AllocateRaw. This function is space-dependent. | 1986 // Slow path of AllocateRaw. This function is space-dependent. |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2966 } | 2976 } |
| 2967 // Must be small, since an iteration is used for lookup. | 2977 // Must be small, since an iteration is used for lookup. |
| 2968 static const int kMaxComments = 64; | 2978 static const int kMaxComments = 64; |
| 2969 }; | 2979 }; |
| 2970 #endif | 2980 #endif |
| 2971 | 2981 |
| 2972 | 2982 |
| 2973 } } // namespace v8::internal | 2983 } } // namespace v8::internal |
| 2974 | 2984 |
| 2975 #endif // V8_SPACES_H_ | 2985 #endif // V8_SPACES_H_ |
| OLD | NEW |