OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 V(space_symbol, " ") \ | 212 V(space_symbol, " ") \ |
213 V(exec_symbol, "exec") \ | 213 V(exec_symbol, "exec") \ |
214 V(zero_symbol, "0") \ | 214 V(zero_symbol, "0") \ |
215 V(global_eval_symbol, "GlobalEval") \ | 215 V(global_eval_symbol, "GlobalEval") \ |
216 V(identity_hash_symbol, "v8::IdentityHash") \ | 216 V(identity_hash_symbol, "v8::IdentityHash") \ |
217 V(closure_symbol, "(closure)") | 217 V(closure_symbol, "(closure)") |
218 | 218 |
219 | 219 |
220 // Forward declaration of the GCTracer class. | 220 // Forward declaration of the GCTracer class. |
221 class GCTracer; | 221 class GCTracer; |
| 222 class HeapStats; |
222 | 223 |
223 | 224 |
224 // The all static Heap captures the interface to the global object heap. | 225 // The all static Heap captures the interface to the global object heap. |
225 // All JavaScript contexts by this process share the same object heap. | 226 // All JavaScript contexts by this process share the same object heap. |
226 | 227 |
227 class Heap : public AllStatic { | 228 class Heap : public AllStatic { |
228 public: | 229 public: |
229 // Configure heap size before setup. Return false if the heap has been | 230 // Configure heap size before setup. Return false if the heap has been |
230 // setup already. | 231 // setup already. |
231 static bool ConfigureHeap(int max_semispace_size, int max_old_gen_size); | 232 static bool ConfigureHeap(int max_semispace_size, int max_old_gen_size); |
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 kStrongRootListLength = kSymbolTableRootIndex, | 889 kStrongRootListLength = kSymbolTableRootIndex, |
889 kRootListLength | 890 kRootListLength |
890 }; | 891 }; |
891 | 892 |
892 static Object* NumberToString(Object* number); | 893 static Object* NumberToString(Object* number); |
893 | 894 |
894 static Map* MapForExternalArrayType(ExternalArrayType array_type); | 895 static Map* MapForExternalArrayType(ExternalArrayType array_type); |
895 static RootListIndex RootIndexForExternalArrayType( | 896 static RootListIndex RootIndexForExternalArrayType( |
896 ExternalArrayType array_type); | 897 ExternalArrayType array_type); |
897 | 898 |
| 899 static void RecordStats(HeapStats* stats); |
| 900 |
898 private: | 901 private: |
899 static int reserved_semispace_size_; | 902 static int reserved_semispace_size_; |
900 static int max_semispace_size_; | 903 static int max_semispace_size_; |
901 static int initial_semispace_size_; | 904 static int initial_semispace_size_; |
902 static int max_old_generation_size_; | 905 static int max_old_generation_size_; |
903 static size_t code_range_size_; | 906 static size_t code_range_size_; |
904 | 907 |
905 // For keeping track of how much data has survived | 908 // For keeping track of how much data has survived |
906 // scavenge since last new space expansion. | 909 // scavenge since last new space expansion. |
907 static int survived_since_last_expansion_; | 910 static int survived_since_last_expansion_; |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 static const int kInitialSymbolTableSize = 2048; | 1123 static const int kInitialSymbolTableSize = 2048; |
1121 static const int kInitialEvalCacheSize = 64; | 1124 static const int kInitialEvalCacheSize = 64; |
1122 | 1125 |
1123 friend class Factory; | 1126 friend class Factory; |
1124 friend class DisallowAllocationFailure; | 1127 friend class DisallowAllocationFailure; |
1125 friend class AlwaysAllocateScope; | 1128 friend class AlwaysAllocateScope; |
1126 friend class LinearAllocationScope; | 1129 friend class LinearAllocationScope; |
1127 }; | 1130 }; |
1128 | 1131 |
1129 | 1132 |
| 1133 struct HeapStats { |
| 1134 int new_space_size; |
| 1135 int new_space_capacity; |
| 1136 int old_pointer_space_size; |
| 1137 int old_pointer_space_capacity; |
| 1138 int old_data_space_size; |
| 1139 int old_data_space_capacity; |
| 1140 int code_space_size; |
| 1141 int code_space_capacity; |
| 1142 int map_space_size; |
| 1143 int map_space_capacity; |
| 1144 int cell_space_size; |
| 1145 int cell_space_capacity; |
| 1146 int lo_space_size; |
| 1147 int global_handle_count; |
| 1148 int weak_global_handle_count; |
| 1149 int pending_global_handle_count; |
| 1150 int near_death_global_handle_count; |
| 1151 int destroyed_global_handle_count; |
| 1152 }; |
| 1153 |
| 1154 |
1130 class AlwaysAllocateScope { | 1155 class AlwaysAllocateScope { |
1131 public: | 1156 public: |
1132 AlwaysAllocateScope() { | 1157 AlwaysAllocateScope() { |
1133 // We shouldn't hit any nested scopes, because that requires | 1158 // We shouldn't hit any nested scopes, because that requires |
1134 // non-handle code to call handle code. The code still works but | 1159 // non-handle code to call handle code. The code still works but |
1135 // performance will degrade, so we want to catch this situation | 1160 // performance will degrade, so we want to catch this situation |
1136 // in debug mode. | 1161 // in debug mode. |
1137 ASSERT(Heap::always_allocate_scope_depth_ == 0); | 1162 ASSERT(Heap::always_allocate_scope_depth_ == 0); |
1138 Heap::always_allocate_scope_depth_++; | 1163 Heap::always_allocate_scope_depth_++; |
1139 } | 1164 } |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 } | 1643 } |
1619 static TranscendentalCache* caches_[kNumberOfCaches]; | 1644 static TranscendentalCache* caches_[kNumberOfCaches]; |
1620 Element elements_[kCacheSize]; | 1645 Element elements_[kCacheSize]; |
1621 Type type_; | 1646 Type type_; |
1622 }; | 1647 }; |
1623 | 1648 |
1624 | 1649 |
1625 } } // namespace v8::internal | 1650 } } // namespace v8::internal |
1626 | 1651 |
1627 #endif // V8_HEAP_H_ | 1652 #endif // V8_HEAP_H_ |
OLD | NEW |