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); | 1084 if (sizeof(int) < sizeof(int64_t) && total > kMaxInt) { |
Jakob Kummerow
2015/05/19 14:23:25
Isn't "sizeof(int) < sizeof(int64_t)" true on all
Sven Panne
2015/05/19 14:41:46
Currently, yes (see http://www.unix.org/whitepaper
Erik Corry Chromium.org
2015/05/19 15:04:18
Oh yeah, good point.
Erik Corry Chromium.org
2015/05/19 15:04:18
Yes, see the TODO. There's no difference between
| |
1085 // TODO(erikcorry): Use uintptr_t everywhere we do heap size calculations. | |
1086 return static_cast<intptr_t>(kMaxInt); | |
1087 } | |
1085 if (total < 0) return 0; | 1088 if (total < 0) return 0; |
1086 return static_cast<intptr_t>(total); | 1089 return static_cast<intptr_t>(total); |
1087 } | 1090 } |
1088 | 1091 |
1089 inline intptr_t OldGenerationSpaceAvailable() { | 1092 inline intptr_t OldGenerationSpaceAvailable() { |
1090 return old_generation_allocation_limit_ - PromotedTotalSize(); | 1093 return old_generation_allocation_limit_ - PromotedTotalSize(); |
1091 } | 1094 } |
1092 | 1095 |
1093 inline intptr_t OldGenerationCapacityAvailable() { | 1096 inline intptr_t OldGenerationCapacityAvailable() { |
1094 return max_old_generation_size_ - PromotedTotalSize(); | 1097 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. | 2640 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2638 | 2641 |
2639 private: | 2642 private: |
2640 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2643 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2641 }; | 2644 }; |
2642 #endif // DEBUG | 2645 #endif // DEBUG |
2643 } | 2646 } |
2644 } // namespace v8::internal | 2647 } // namespace v8::internal |
2645 | 2648 |
2646 #endif // V8_HEAP_HEAP_H_ | 2649 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |