OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 inline intptr_t PromotedTotalSize() { | 1251 inline intptr_t PromotedTotalSize() { |
1252 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); | 1252 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); |
1253 if (total > std::numeric_limits<intptr_t>::max()) { | 1253 if (total > std::numeric_limits<intptr_t>::max()) { |
1254 // TODO(erikcorry): Use uintptr_t everywhere we do heap size calculations. | 1254 // TODO(erikcorry): Use uintptr_t everywhere we do heap size calculations. |
1255 return std::numeric_limits<intptr_t>::max(); | 1255 return std::numeric_limits<intptr_t>::max(); |
1256 } | 1256 } |
1257 if (total < 0) return 0; | 1257 if (total < 0) return 0; |
1258 return static_cast<intptr_t>(total); | 1258 return static_cast<intptr_t>(total); |
1259 } | 1259 } |
1260 | 1260 |
1261 V8_INLINE void UpdateNewSpaceAllocationCounter(); | 1261 void UpdateNewSpaceAllocationCounter() { |
1262 V8_INLINE size_t NewSpaceAllocationCounter(); | 1262 new_space_allocation_counter_ = NewSpaceAllocationCounter(); |
| 1263 } |
| 1264 |
| 1265 size_t NewSpaceAllocationCounter() { |
| 1266 return new_space_allocation_counter_ + new_space()->AllocatedSinceLastGC(); |
| 1267 } |
1263 | 1268 |
1264 // This should be used only for testing. | 1269 // This should be used only for testing. |
1265 void set_new_space_allocation_counter(size_t new_value) { | 1270 void set_new_space_allocation_counter(size_t new_value) { |
1266 new_space_allocation_counter_ = new_value; | 1271 new_space_allocation_counter_ = new_value; |
1267 } | 1272 } |
1268 | 1273 |
1269 void UpdateOldGenerationAllocationCounter() { | 1274 void UpdateOldGenerationAllocationCounter() { |
1270 old_generation_allocation_counter_ = OldGenerationAllocationCounter(); | 1275 old_generation_allocation_counter_ = OldGenerationAllocationCounter(); |
1271 } | 1276 } |
1272 | 1277 |
(...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 friend class LargeObjectSpace; | 2656 friend class LargeObjectSpace; |
2652 friend class NewSpace; | 2657 friend class NewSpace; |
2653 friend class PagedSpace; | 2658 friend class PagedSpace; |
2654 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2659 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
2655 }; | 2660 }; |
2656 | 2661 |
2657 } // namespace internal | 2662 } // namespace internal |
2658 } // namespace v8 | 2663 } // namespace v8 |
2659 | 2664 |
2660 #endif // V8_HEAP_HEAP_H_ | 2665 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |