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

Side by Side Diff: src/spaces.h

Issue 12184016: Set unswept free bytes for concurent sweeper. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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/sweeper-thread.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 // 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 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 1742
1743 void IncrementUnsweptFreeBytes(int by) { 1743 void IncrementUnsweptFreeBytes(int by) {
1744 unswept_free_bytes_ += by; 1744 unswept_free_bytes_ += by;
1745 } 1745 }
1746 1746
1747 void IncreaseUnsweptFreeBytes(Page* p) { 1747 void IncreaseUnsweptFreeBytes(Page* p) {
1748 ASSERT(ShouldBeSweptLazily(p)); 1748 ASSERT(ShouldBeSweptLazily(p));
1749 unswept_free_bytes_ += (p->area_size() - p->LiveBytes()); 1749 unswept_free_bytes_ += (p->area_size() - p->LiveBytes());
1750 } 1750 }
1751 1751
1752 void DecrementUnsweptFreeBytes(int by) {
1753 unswept_free_bytes_ -= by;
1754 }
1755
1752 void DecreaseUnsweptFreeBytes(Page* p) { 1756 void DecreaseUnsweptFreeBytes(Page* p) {
1753 ASSERT(ShouldBeSweptLazily(p)); 1757 ASSERT(ShouldBeSweptLazily(p));
1754 unswept_free_bytes_ -= (p->area_size() - p->LiveBytes()); 1758 unswept_free_bytes_ -= (p->area_size() - p->LiveBytes());
1755 } 1759 }
1756 1760
1761 void ResetUnsweptFreeBytes() {
1762 unswept_free_bytes_ = 0;
1763 }
1764
1757 bool AdvanceSweeper(intptr_t bytes_to_sweep); 1765 bool AdvanceSweeper(intptr_t bytes_to_sweep);
1758 1766
1759 // When parallel sweeper threads are active this function waits 1767 // When parallel sweeper threads are active this function waits
1760 // for them to complete, otherwise AdvanceSweeper with size_in_bytes 1768 // for them to complete, otherwise AdvanceSweeper with size_in_bytes
1761 // is called. 1769 // is called.
1762 bool EnsureSweeperProgress(intptr_t size_in_bytes); 1770 bool EnsureSweeperProgress(intptr_t size_in_bytes);
1763 1771
1764 bool IsLazySweepingComplete() { 1772 bool IsLazySweepingComplete() {
1765 return !first_unswept_page_->is_valid(); 1773 return !first_unswept_page_->is_valid();
1766 } 1774 }
(...skipping 10 matching lines...) Expand all
1777 bool CanExpand(); 1785 bool CanExpand();
1778 1786
1779 // Returns the number of total pages in this space. 1787 // Returns the number of total pages in this space.
1780 int CountTotalPages(); 1788 int CountTotalPages();
1781 1789
1782 // Return size of allocatable area on a page in this space. 1790 // Return size of allocatable area on a page in this space.
1783 inline int AreaSize() { 1791 inline int AreaSize() {
1784 return area_size_; 1792 return area_size_;
1785 } 1793 }
1786 1794
1795 void AddToAccountingStats(intptr_t bytes) {
Michael Starzinger 2013/02/28 14:49:53 Since this is no longer protected, let's move it u
Hannes Payer (out of office) 2013/02/28 15:07:15 Done.
1796 accounting_stats_.DeallocateBytes(bytes);
1797 }
1798
1787 protected: 1799 protected:
1788 FreeList* free_list() { return &free_list_; } 1800 FreeList* free_list() { return &free_list_; }
1789 1801
1790 void AddToAccountingStats(intptr_t bytes) {
1791 accounting_stats_.DeallocateBytes(bytes);
1792 }
1793
1794 int area_size_; 1802 int area_size_;
1795 1803
1796 // Maximum capacity of this space. 1804 // Maximum capacity of this space.
1797 intptr_t max_capacity_; 1805 intptr_t max_capacity_;
1798 1806
1799 intptr_t SizeOfFirstPage(); 1807 intptr_t SizeOfFirstPage();
1800 1808
1801 // Accounting information for this space. 1809 // Accounting information for this space.
1802 AllocationStats accounting_stats_; 1810 AllocationStats accounting_stats_;
1803 1811
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after
2818 } 2826 }
2819 // Must be small, since an iteration is used for lookup. 2827 // Must be small, since an iteration is used for lookup.
2820 static const int kMaxComments = 64; 2828 static const int kMaxComments = 64;
2821 }; 2829 };
2822 #endif 2830 #endif
2823 2831
2824 2832
2825 } } // namespace v8::internal 2833 } } // namespace v8::internal
2826 2834
2827 #endif // V8_SPACES_H_ 2835 #endif // V8_SPACES_H_
OLDNEW
« no previous file with comments | « src/mark-compact.cc ('k') | src/sweeper-thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698