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 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1074 bool ReserveSpace(Reservation* reservations); | 1074 bool ReserveSpace(Reservation* reservations); |
1075 | 1075 |
1076 // | 1076 // |
1077 // Support for the API. | 1077 // Support for the API. |
1078 // | 1078 // |
1079 | 1079 |
1080 void CreateApiObjects(); | 1080 void CreateApiObjects(); |
1081 | 1081 |
1082 inline intptr_t PromotedTotalSize() { | 1082 inline intptr_t PromotedTotalSize() { |
1083 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); | 1083 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); |
1084 if (total > kMaxInt) return static_cast<intptr_t>(kMaxInt); | |
Hannes Payer (out of office)
2015/05/15 15:08:19
Unfortunatly, an overflow is possible here. jkumme
| |
1085 if (total < 0) return 0; | 1084 if (total < 0) return 0; |
1086 return static_cast<intptr_t>(total); | 1085 return static_cast<intptr_t>(total); |
1087 } | 1086 } |
1088 | 1087 |
1089 inline intptr_t OldGenerationSpaceAvailable() { | 1088 inline intptr_t OldGenerationSpaceAvailable() { |
1090 return old_generation_allocation_limit_ - PromotedTotalSize(); | 1089 return old_generation_allocation_limit_ - PromotedTotalSize(); |
1091 } | 1090 } |
1092 | 1091 |
1093 inline intptr_t OldGenerationCapacityAvailable() { | 1092 inline intptr_t OldGenerationCapacityAvailable() { |
1094 return max_old_generation_size_ - PromotedTotalSize(); | 1093 return max_old_generation_size_ - PromotedTotalSize(); |
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2637 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2636 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2638 | 2637 |
2639 private: | 2638 private: |
2640 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2639 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2641 }; | 2640 }; |
2642 #endif // DEBUG | 2641 #endif // DEBUG |
2643 } | 2642 } |
2644 } // namespace v8::internal | 2643 } // namespace v8::internal |
2645 | 2644 |
2646 #endif // V8_HEAP_HEAP_H_ | 2645 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |