Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: src/spaces.h

Issue 431563002: Use emergency memory in the case of out of memory during evacuation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mark-compact.cc ('k') | src/spaces.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1962 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 bool CanExpand(); 1973 bool CanExpand();
1974 1974
1975 // Returns the number of total pages in this space. 1975 // Returns the number of total pages in this space.
1976 int CountTotalPages(); 1976 int CountTotalPages();
1977 1977
1978 // Return size of allocatable area on a page in this space. 1978 // Return size of allocatable area on a page in this space.
1979 inline int AreaSize() { 1979 inline int AreaSize() {
1980 return area_size_; 1980 return area_size_;
1981 } 1981 }
1982 1982
1983 void CreateEmergencyMemory();
1984 void FreeEmergencyMemory();
1985 void UseEmergencyMemory();
1986
1987 bool HasEmergencyMemory() { return emergency_memory_ != NULL; }
1988
1983 protected: 1989 protected:
1984 FreeList* free_list() { return &free_list_; } 1990 FreeList* free_list() { return &free_list_; }
1985 1991
1986 int area_size_; 1992 int area_size_;
1987 1993
1988 // Maximum capacity of this space. 1994 // Maximum capacity of this space.
1989 intptr_t max_capacity_; 1995 intptr_t max_capacity_;
1990 1996
1991 intptr_t SizeOfFirstPage(); 1997 intptr_t SizeOfFirstPage();
1992 1998
(...skipping 15 matching lines...) Expand all
2008 // The number of free bytes which could be reclaimed by advancing the 2014 // The number of free bytes which could be reclaimed by advancing the
2009 // concurrent sweeper threads. This is only an estimation because concurrent 2015 // concurrent sweeper threads. This is only an estimation because concurrent
2010 // sweeping is done conservatively. 2016 // sweeping is done conservatively.
2011 intptr_t unswept_free_bytes_; 2017 intptr_t unswept_free_bytes_;
2012 2018
2013 // The sweeper threads iterate over the list of pointer and data space pages 2019 // The sweeper threads iterate over the list of pointer and data space pages
2014 // and sweep these pages concurrently. They will stop sweeping after the 2020 // and sweep these pages concurrently. They will stop sweeping after the
2015 // end_of_unswept_pages_ page. 2021 // end_of_unswept_pages_ page.
2016 Page* end_of_unswept_pages_; 2022 Page* end_of_unswept_pages_;
2017 2023
2024 // Emergency memory is the memory of a full page for a given space, allocated
2025 // conservatively before evacuating a page. If compaction fails due to out
2026 // of memory error the emergency memory can be used to complete compaction.
2027 // If not used, the emergency memory is released after compaction.
2028 MemoryChunk* emergency_memory_;
2029
2018 // Expands the space by allocating a fixed number of pages. Returns false if 2030 // Expands the space by allocating a fixed number of pages. Returns false if
2019 // it cannot allocate requested number of pages from OS, or if the hard heap 2031 // it cannot allocate requested number of pages from OS, or if the hard heap
2020 // size limit has been hit. 2032 // size limit has been hit.
2021 bool Expand(); 2033 bool Expand();
2022 2034
2023 // Generic fast case allocation function that tries linear allocation at the 2035 // Generic fast case allocation function that tries linear allocation at the
2024 // address denoted by top in allocation_info_. 2036 // address denoted by top in allocation_info_.
2025 inline HeapObject* AllocateLinearly(int size_in_bytes); 2037 inline HeapObject* AllocateLinearly(int size_in_bytes);
2026 2038
2027 // If sweeping is still in progress try to sweep unswept pages. If that is 2039 // If sweeping is still in progress try to sweep unswept pages. If that is
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
3027 } 3039 }
3028 // Must be small, since an iteration is used for lookup. 3040 // Must be small, since an iteration is used for lookup.
3029 static const int kMaxComments = 64; 3041 static const int kMaxComments = 64;
3030 }; 3042 };
3031 #endif 3043 #endif
3032 3044
3033 3045
3034 } } // namespace v8::internal 3046 } } // namespace v8::internal
3035 3047
3036 #endif // V8_SPACES_H_ 3048 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/spaces.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698