| 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 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 bool ReserveSpace(Reservation* reservations); | 1085 bool ReserveSpace(Reservation* reservations); |
| 1086 | 1086 |
| 1087 // | 1087 // |
| 1088 // Support for the API. | 1088 // Support for the API. |
| 1089 // | 1089 // |
| 1090 | 1090 |
| 1091 void CreateApiObjects(); | 1091 void CreateApiObjects(); |
| 1092 | 1092 |
| 1093 inline intptr_t PromotedTotalSize() { | 1093 inline intptr_t PromotedTotalSize() { |
| 1094 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); | 1094 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); |
| 1095 if (total > kMaxInt) return static_cast<intptr_t>(kMaxInt); | 1095 if (total > std::numeric_limits<intptr_t>::max()) { |
| 1096 // TODO(erikcorry): Use uintptr_t everywhere we do heap size calculations. |
| 1097 return std::numeric_limits<intptr_t>::max(); |
| 1098 } |
| 1096 if (total < 0) return 0; | 1099 if (total < 0) return 0; |
| 1097 return static_cast<intptr_t>(total); | 1100 return static_cast<intptr_t>(total); |
| 1098 } | 1101 } |
| 1099 | 1102 |
| 1100 inline intptr_t OldGenerationSpaceAvailable() { | 1103 inline intptr_t OldGenerationSpaceAvailable() { |
| 1101 return old_generation_allocation_limit_ - PromotedTotalSize(); | 1104 return old_generation_allocation_limit_ - PromotedTotalSize(); |
| 1102 } | 1105 } |
| 1103 | 1106 |
| 1104 inline intptr_t OldGenerationCapacityAvailable() { | 1107 inline intptr_t OldGenerationCapacityAvailable() { |
| 1105 return max_old_generation_size_ - PromotedTotalSize(); | 1108 return max_old_generation_size_ - PromotedTotalSize(); |
| (...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2655 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2658 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2656 | 2659 |
| 2657 private: | 2660 private: |
| 2658 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2661 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2659 }; | 2662 }; |
| 2660 #endif // DEBUG | 2663 #endif // DEBUG |
| 2661 } | 2664 } |
| 2662 } // namespace v8::internal | 2665 } // namespace v8::internal |
| 2663 | 2666 |
| 2664 #endif // V8_HEAP_HEAP_H_ | 2667 #endif // V8_HEAP_HEAP_H_ |
| OLD | NEW |