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

Side by Side Diff: src/spaces.h

Issue 12177017: Fixed IsSweepingComplete and EnsureSweeperProgress helper functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 // 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 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 intptr_t Available() { return free_list_.available(); } 1637 intptr_t Available() { return free_list_.available(); }
1638 1638
1639 // Allocated bytes in this space. Garbage bytes that were not found due to 1639 // Allocated bytes in this space. Garbage bytes that were not found due to
1640 // lazy sweeping are counted as being allocated! The bytes in the current 1640 // lazy sweeping are counted as being allocated! The bytes in the current
1641 // linear allocation area (between top and limit) are also counted here. 1641 // linear allocation area (between top and limit) are also counted here.
1642 virtual intptr_t Size() { return accounting_stats_.Size(); } 1642 virtual intptr_t Size() { return accounting_stats_.Size(); }
1643 1643
1644 // As size, but the bytes in lazily swept pages are estimated and the bytes 1644 // As size, but the bytes in lazily swept pages are estimated and the bytes
1645 // in the current linear allocation area are not included. 1645 // in the current linear allocation area are not included.
1646 virtual intptr_t SizeOfObjects() { 1646 virtual intptr_t SizeOfObjects() {
1647 ASSERT(!IsSweepingComplete() || (unswept_free_bytes_ == 0)); 1647 // TODO(hpayer): broken when concurrent sweeping turned on
1648 ASSERT(!IsLazySweepingComplete() || (unswept_free_bytes_ == 0));
1648 return Size() - unswept_free_bytes_ - (limit() - top()); 1649 return Size() - unswept_free_bytes_ - (limit() - top());
1649 } 1650 }
1650 1651
1651 // Wasted bytes in this space. These are just the bytes that were thrown away 1652 // Wasted bytes in this space. These are just the bytes that were thrown away
1652 // due to being too small to use for allocation. They do not include the 1653 // due to being too small to use for allocation. They do not include the
1653 // free bytes that were not found at all due to lazy sweeping. 1654 // free bytes that were not found at all due to lazy sweeping.
1654 virtual intptr_t Waste() { return accounting_stats_.Waste(); } 1655 virtual intptr_t Waste() { return accounting_stats_.Waste(); }
1655 1656
1656 // Returns the allocation pointer in this space. 1657 // Returns the allocation pointer in this space.
1657 Address top() { return allocation_info_.top; } 1658 Address top() { return allocation_info_.top; }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1756 unswept_free_bytes_ -= (p->area_size() - p->LiveBytes()); 1757 unswept_free_bytes_ -= (p->area_size() - p->LiveBytes());
1757 } 1758 }
1758 1759
1759 bool AdvanceSweeper(intptr_t bytes_to_sweep); 1760 bool AdvanceSweeper(intptr_t bytes_to_sweep);
1760 1761
1761 // When parallel sweeper threads are active this function waits 1762 // When parallel sweeper threads are active this function waits
1762 // for them to complete, otherwise AdvanceSweeper with size_in_bytes 1763 // for them to complete, otherwise AdvanceSweeper with size_in_bytes
1763 // is called. 1764 // is called.
1764 bool EnsureSweeperProgress(intptr_t size_in_bytes); 1765 bool EnsureSweeperProgress(intptr_t size_in_bytes);
1765 1766
1766 bool IsSweepingComplete() { 1767 bool IsLazySweepingComplete() {
1767 return !first_unswept_page_->is_valid(); 1768 return !first_unswept_page_->is_valid();
1768 } 1769 }
1769 1770
1770 Page* FirstPage() { return anchor_.next_page(); } 1771 Page* FirstPage() { return anchor_.next_page(); }
1771 Page* LastPage() { return anchor_.prev_page(); } 1772 Page* LastPage() { return anchor_.prev_page(); }
1772 1773
1773 void CountFreeListItems(Page* p, FreeList::SizeStats* sizes) { 1774 void CountFreeListItems(Page* p, FreeList::SizeStats* sizes) {
1774 free_list_.CountFreeListItems(p, sizes); 1775 free_list_.CountFreeListItems(p, sizes);
1775 } 1776 }
1776 1777
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
2820 } 2821 }
2821 // Must be small, since an iteration is used for lookup. 2822 // Must be small, since an iteration is used for lookup.
2822 static const int kMaxComments = 64; 2823 static const int kMaxComments = 64;
2823 }; 2824 };
2824 #endif 2825 #endif
2825 2826
2826 2827
2827 } } // namespace v8::internal 2828 } } // namespace v8::internal
2828 2829
2829 #endif // V8_SPACES_H_ 2830 #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