| 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 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 inline intptr_t PromotedTotalSize() { | 1248 inline intptr_t PromotedTotalSize() { |
| 1249 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); | 1249 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); |
| 1250 if (total > std::numeric_limits<intptr_t>::max()) { | 1250 if (total > std::numeric_limits<intptr_t>::max()) { |
| 1251 // TODO(erikcorry): Use uintptr_t everywhere we do heap size calculations. | 1251 // TODO(erikcorry): Use uintptr_t everywhere we do heap size calculations. |
| 1252 return std::numeric_limits<intptr_t>::max(); | 1252 return std::numeric_limits<intptr_t>::max(); |
| 1253 } | 1253 } |
| 1254 if (total < 0) return 0; | 1254 if (total < 0) return 0; |
| 1255 return static_cast<intptr_t>(total); | 1255 return static_cast<intptr_t>(total); |
| 1256 } | 1256 } |
| 1257 | 1257 |
| 1258 void UpdateNewSpaceAllocationCounter() { | 1258 inline void UpdateNewSpaceAllocationCounter(); |
| 1259 new_space_allocation_counter_ = NewSpaceAllocationCounter(); | 1259 inline size_t NewSpaceAllocationCounter(); |
| 1260 } | |
| 1261 | |
| 1262 size_t NewSpaceAllocationCounter() { | |
| 1263 return new_space_allocation_counter_ + new_space()->AllocatedSinceLastGC(); | |
| 1264 } | |
| 1265 | 1260 |
| 1266 // This should be used only for testing. | 1261 // This should be used only for testing. |
| 1267 void set_new_space_allocation_counter(size_t new_value) { | 1262 void set_new_space_allocation_counter(size_t new_value) { |
| 1268 new_space_allocation_counter_ = new_value; | 1263 new_space_allocation_counter_ = new_value; |
| 1269 } | 1264 } |
| 1270 | 1265 |
| 1271 void UpdateOldGenerationAllocationCounter() { | 1266 void UpdateOldGenerationAllocationCounter() { |
| 1272 old_generation_allocation_counter_ = OldGenerationAllocationCounter(); | 1267 old_generation_allocation_counter_ = OldGenerationAllocationCounter(); |
| 1273 } | 1268 } |
| 1274 | 1269 |
| (...skipping 1378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2653 friend class LargeObjectSpace; | 2648 friend class LargeObjectSpace; |
| 2654 friend class NewSpace; | 2649 friend class NewSpace; |
| 2655 friend class PagedSpace; | 2650 friend class PagedSpace; |
| 2656 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); | 2651 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); |
| 2657 }; | 2652 }; |
| 2658 | 2653 |
| 2659 } // namespace internal | 2654 } // namespace internal |
| 2660 } // namespace v8 | 2655 } // namespace v8 |
| 2661 | 2656 |
| 2662 #endif // V8_HEAP_HEAP_H_ | 2657 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |