| 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_SPACES_H_ | 5 #ifndef V8_SPACES_H_ |
| 6 #define V8_SPACES_H_ | 6 #define V8_SPACES_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
| 10 #include "src/base/platform/mutex.h" | 10 #include "src/base/platform/mutex.h" |
| (...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 | 1898 |
| 1899 // Report code object related statistics | 1899 // Report code object related statistics |
| 1900 void CollectCodeStatistics(); | 1900 void CollectCodeStatistics(); |
| 1901 static void ReportCodeStatistics(Isolate* isolate); | 1901 static void ReportCodeStatistics(Isolate* isolate); |
| 1902 static void ResetCodeStatistics(Isolate* isolate); | 1902 static void ResetCodeStatistics(Isolate* isolate); |
| 1903 #endif | 1903 #endif |
| 1904 | 1904 |
| 1905 bool is_iterable() { return is_iterable_; } | 1905 bool is_iterable() { return is_iterable_; } |
| 1906 void set_is_iterable(bool b) { is_iterable_ = b; } | 1906 void set_is_iterable(bool b) { is_iterable_ = b; } |
| 1907 | 1907 |
| 1908 bool is_swept_concurrently() { return is_swept_concurrently_; } |
| 1909 void set_is_swept_concurrently(bool b) { is_swept_concurrently_ = b; } |
| 1910 |
| 1908 // Evacuation candidates are swept by evacuator. Needs to return a valid | 1911 // Evacuation candidates are swept by evacuator. Needs to return a valid |
| 1909 // result before _and_ after evacuation has finished. | 1912 // result before _and_ after evacuation has finished. |
| 1910 static bool ShouldBeSweptBySweeperThreads(Page* p) { | 1913 static bool ShouldBeSweptBySweeperThreads(Page* p) { |
| 1911 return !p->IsEvacuationCandidate() && | 1914 return !p->IsEvacuationCandidate() && |
| 1912 !p->IsFlagSet(Page::RESCAN_ON_EVACUATION) && | 1915 !p->IsFlagSet(Page::RESCAN_ON_EVACUATION) && |
| 1913 !p->WasSweptPrecisely(); | 1916 !p->WasSweptPrecisely(); |
| 1914 } | 1917 } |
| 1915 | 1918 |
| 1916 void IncrementUnsweptFreeBytes(intptr_t by) { | 1919 void IncrementUnsweptFreeBytes(intptr_t by) { |
| 1917 unswept_free_bytes_ += by; | 1920 unswept_free_bytes_ += by; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1982 | 1985 |
| 1983 // The space's free list. | 1986 // The space's free list. |
| 1984 FreeList free_list_; | 1987 FreeList free_list_; |
| 1985 | 1988 |
| 1986 // Normal allocation information. | 1989 // Normal allocation information. |
| 1987 AllocationInfo allocation_info_; | 1990 AllocationInfo allocation_info_; |
| 1988 | 1991 |
| 1989 // This space was swept precisely, hence it is iterable. | 1992 // This space was swept precisely, hence it is iterable. |
| 1990 bool is_iterable_; | 1993 bool is_iterable_; |
| 1991 | 1994 |
| 1995 // This space is currently swept by sweeper threads. |
| 1996 bool is_swept_concurrently_; |
| 1997 |
| 1992 // The number of free bytes which could be reclaimed by advancing the | 1998 // The number of free bytes which could be reclaimed by advancing the |
| 1993 // concurrent sweeper threads. This is only an estimation because concurrent | 1999 // concurrent sweeper threads. This is only an estimation because concurrent |
| 1994 // sweeping is done conservatively. | 2000 // sweeping is done conservatively. |
| 1995 intptr_t unswept_free_bytes_; | 2001 intptr_t unswept_free_bytes_; |
| 1996 | 2002 |
| 1997 // The sweeper threads iterate over the list of pointer and data space pages | 2003 // The sweeper threads iterate over the list of pointer and data space pages |
| 1998 // and sweep these pages concurrently. They will stop sweeping after the | 2004 // and sweep these pages concurrently. They will stop sweeping after the |
| 1999 // end_of_unswept_pages_ page. | 2005 // end_of_unswept_pages_ page. |
| 2000 Page* end_of_unswept_pages_; | 2006 Page* end_of_unswept_pages_; |
| 2001 | 2007 |
| 2002 // Expands the space by allocating a fixed number of pages. Returns false if | 2008 // Expands the space by allocating a fixed number of pages. Returns false if |
| 2003 // it cannot allocate requested number of pages from OS, or if the hard heap | 2009 // it cannot allocate requested number of pages from OS, or if the hard heap |
| 2004 // size limit has been hit. | 2010 // size limit has been hit. |
| 2005 bool Expand(); | 2011 bool Expand(); |
| 2006 | 2012 |
| 2007 // Generic fast case allocation function that tries linear allocation at the | 2013 // Generic fast case allocation function that tries linear allocation at the |
| 2008 // address denoted by top in allocation_info_. | 2014 // address denoted by top in allocation_info_. |
| 2009 inline HeapObject* AllocateLinearly(int size_in_bytes); | 2015 inline HeapObject* AllocateLinearly(int size_in_bytes); |
| 2010 | 2016 |
| 2011 // If sweeping is still in progress try to sweep unswept pages. If that is | 2017 // If sweeping is still in progress try to sweep unswept pages. If that is |
| 2012 // not successful, wait for the sweeper threads and re-try free-list | 2018 // not successful, wait for the sweeper threads and re-try free-list |
| 2013 // allocation. | 2019 // allocation. |
| 2014 MUST_USE_RESULT HeapObject* WaitForSweeperThreadsAndRetryAllocation( | 2020 MUST_USE_RESULT HeapObject* EnsureSweepingProgress(int size_in_bytes); |
| 2015 int size_in_bytes); | |
| 2016 | 2021 |
| 2017 // Slow path of AllocateRaw. This function is space-dependent. | 2022 // Slow path of AllocateRaw. This function is space-dependent. |
| 2018 MUST_USE_RESULT HeapObject* SlowAllocateRaw(int size_in_bytes); | 2023 MUST_USE_RESULT HeapObject* SlowAllocateRaw(int size_in_bytes); |
| 2019 | 2024 |
| 2020 friend class PageIterator; | 2025 friend class PageIterator; |
| 2021 friend class MarkCompactCollector; | 2026 friend class MarkCompactCollector; |
| 2022 }; | 2027 }; |
| 2023 | 2028 |
| 2024 | 2029 |
| 2025 class NumberAndSizeInfo BASE_EMBEDDED { | 2030 class NumberAndSizeInfo BASE_EMBEDDED { |
| (...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3011 } | 3016 } |
| 3012 // Must be small, since an iteration is used for lookup. | 3017 // Must be small, since an iteration is used for lookup. |
| 3013 static const int kMaxComments = 64; | 3018 static const int kMaxComments = 64; |
| 3014 }; | 3019 }; |
| 3015 #endif | 3020 #endif |
| 3016 | 3021 |
| 3017 | 3022 |
| 3018 } } // namespace v8::internal | 3023 } } // namespace v8::internal |
| 3019 | 3024 |
| 3020 #endif // V8_SPACES_H_ | 3025 #endif // V8_SPACES_H_ |
| OLD | NEW |