OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 void ClearRSet(); | 855 void ClearRSet(); |
856 | 856 |
857 // Prepares for a mark-compact GC. | 857 // Prepares for a mark-compact GC. |
858 virtual void PrepareForMarkCompact(bool will_compact) = 0; | 858 virtual void PrepareForMarkCompact(bool will_compact) = 0; |
859 | 859 |
860 virtual Address PageAllocationTop(Page* page) = 0; | 860 virtual Address PageAllocationTop(Page* page) = 0; |
861 | 861 |
862 // Current capacity without growing (Size() + Available() + Waste()). | 862 // Current capacity without growing (Size() + Available() + Waste()). |
863 int Capacity() { return accounting_stats_.Capacity(); } | 863 int Capacity() { return accounting_stats_.Capacity(); } |
864 | 864 |
| 865 // Total amount of memory committed for this space. For paged |
| 866 // spaces this equals the capacity. |
| 867 int CommittedMemory() { return Capacity(); } |
| 868 |
865 // Available bytes without growing. | 869 // Available bytes without growing. |
866 int Available() { return accounting_stats_.Available(); } | 870 int Available() { return accounting_stats_.Available(); } |
867 | 871 |
868 // Allocated bytes in this space. | 872 // Allocated bytes in this space. |
869 virtual int Size() { return accounting_stats_.Size(); } | 873 virtual int Size() { return accounting_stats_.Size(); } |
870 | 874 |
871 // Wasted bytes due to fragmentation and not recoverable until the | 875 // Wasted bytes due to fragmentation and not recoverable until the |
872 // next GC of this space. | 876 // next GC of this space. |
873 int Waste() { return accounting_stats_.Waste(); } | 877 int Waste() { return accounting_stats_.Waste(); } |
874 | 878 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 bool Contains(Address a) { | 1249 bool Contains(Address a) { |
1246 return (reinterpret_cast<uintptr_t>(a) & address_mask_) | 1250 return (reinterpret_cast<uintptr_t>(a) & address_mask_) |
1247 == reinterpret_cast<uintptr_t>(start_); | 1251 == reinterpret_cast<uintptr_t>(start_); |
1248 } | 1252 } |
1249 bool Contains(Object* o) { | 1253 bool Contains(Object* o) { |
1250 return (reinterpret_cast<uintptr_t>(o) & object_mask_) == object_expected_; | 1254 return (reinterpret_cast<uintptr_t>(o) & object_mask_) == object_expected_; |
1251 } | 1255 } |
1252 | 1256 |
1253 // Return the allocated bytes in the active semispace. | 1257 // Return the allocated bytes in the active semispace. |
1254 virtual int Size() { return top() - bottom(); } | 1258 virtual int Size() { return top() - bottom(); } |
| 1259 |
1255 // Return the current capacity of a semispace. | 1260 // Return the current capacity of a semispace. |
1256 int Capacity() { | 1261 int Capacity() { |
1257 ASSERT(to_space_.Capacity() == from_space_.Capacity()); | 1262 ASSERT(to_space_.Capacity() == from_space_.Capacity()); |
1258 return to_space_.Capacity(); | 1263 return to_space_.Capacity(); |
1259 } | 1264 } |
| 1265 |
| 1266 // Return the total amount of memory committed for new space. |
| 1267 int CommittedMemory() { |
| 1268 if (from_space_.is_committed()) return 2 * Capacity(); |
| 1269 return Capacity(); |
| 1270 } |
| 1271 |
1260 // Return the available bytes without growing in the active semispace. | 1272 // Return the available bytes without growing in the active semispace. |
1261 int Available() { return Capacity() - Size(); } | 1273 int Available() { return Capacity() - Size(); } |
1262 | 1274 |
1263 // Return the maximum capacity of a semispace. | 1275 // Return the maximum capacity of a semispace. |
1264 int MaximumCapacity() { | 1276 int MaximumCapacity() { |
1265 ASSERT(to_space_.MaximumCapacity() == from_space_.MaximumCapacity()); | 1277 ASSERT(to_space_.MaximumCapacity() == from_space_.MaximumCapacity()); |
1266 return to_space_.MaximumCapacity(); | 1278 return to_space_.MaximumCapacity(); |
1267 } | 1279 } |
1268 | 1280 |
1269 // Returns the initial capacity of a semispace. | 1281 // Returns the initial capacity of a semispace. |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 | 1945 |
1934 private: | 1946 private: |
1935 LargeObjectChunk* current_; | 1947 LargeObjectChunk* current_; |
1936 HeapObjectCallback size_func_; | 1948 HeapObjectCallback size_func_; |
1937 }; | 1949 }; |
1938 | 1950 |
1939 | 1951 |
1940 } } // namespace v8::internal | 1952 } } // namespace v8::internal |
1941 | 1953 |
1942 #endif // V8_SPACES_H_ | 1954 #endif // V8_SPACES_H_ |
OLD | NEW |