| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 V(space_symbol, " ") \ | 223 V(space_symbol, " ") \ |
| 224 V(exec_symbol, "exec") \ | 224 V(exec_symbol, "exec") \ |
| 225 V(zero_symbol, "0") \ | 225 V(zero_symbol, "0") \ |
| 226 V(global_eval_symbol, "GlobalEval") \ | 226 V(global_eval_symbol, "GlobalEval") \ |
| 227 V(identity_hash_symbol, "v8::IdentityHash") \ | 227 V(identity_hash_symbol, "v8::IdentityHash") \ |
| 228 V(closure_symbol, "(closure)") | 228 V(closure_symbol, "(closure)") |
| 229 | 229 |
| 230 | 230 |
| 231 // Forward declaration of the GCTracer class. | 231 // Forward declaration of the GCTracer class. |
| 232 class GCTracer; | 232 class GCTracer; |
| 233 class HeapStats; |
| 233 | 234 |
| 234 | 235 |
| 235 // The all static Heap captures the interface to the global object heap. | 236 // The all static Heap captures the interface to the global object heap. |
| 236 // All JavaScript contexts by this process share the same object heap. | 237 // All JavaScript contexts by this process share the same object heap. |
| 237 | 238 |
| 238 class Heap : public AllStatic { | 239 class Heap : public AllStatic { |
| 239 public: | 240 public: |
| 240 // Configure heap size before setup. Return false if the heap has been | 241 // Configure heap size before setup. Return false if the heap has been |
| 241 // setup already. | 242 // setup already. |
| 242 static bool ConfigureHeap(int max_semispace_size, int max_old_gen_size); | 243 static bool ConfigureHeap(int max_semispace_size, int max_old_gen_size); |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 kStrongRootListLength = kSymbolTableRootIndex, | 909 kStrongRootListLength = kSymbolTableRootIndex, |
| 909 kRootListLength | 910 kRootListLength |
| 910 }; | 911 }; |
| 911 | 912 |
| 912 static Object* NumberToString(Object* number); | 913 static Object* NumberToString(Object* number); |
| 913 | 914 |
| 914 static Map* MapForExternalArrayType(ExternalArrayType array_type); | 915 static Map* MapForExternalArrayType(ExternalArrayType array_type); |
| 915 static RootListIndex RootIndexForExternalArrayType( | 916 static RootListIndex RootIndexForExternalArrayType( |
| 916 ExternalArrayType array_type); | 917 ExternalArrayType array_type); |
| 917 | 918 |
| 919 static void RecordStats(HeapStats* stats); |
| 920 |
| 918 private: | 921 private: |
| 919 static int reserved_semispace_size_; | 922 static int reserved_semispace_size_; |
| 920 static int max_semispace_size_; | 923 static int max_semispace_size_; |
| 921 static int initial_semispace_size_; | 924 static int initial_semispace_size_; |
| 922 static int max_old_generation_size_; | 925 static int max_old_generation_size_; |
| 923 static size_t code_range_size_; | 926 static size_t code_range_size_; |
| 924 | 927 |
| 925 // For keeping track of how much data has survived | 928 // For keeping track of how much data has survived |
| 926 // scavenge since last new space expansion. | 929 // scavenge since last new space expansion. |
| 927 static int survived_since_last_expansion_; | 930 static int survived_since_last_expansion_; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 static const int kInitialSymbolTableSize = 2048; | 1143 static const int kInitialSymbolTableSize = 2048; |
| 1141 static const int kInitialEvalCacheSize = 64; | 1144 static const int kInitialEvalCacheSize = 64; |
| 1142 | 1145 |
| 1143 friend class Factory; | 1146 friend class Factory; |
| 1144 friend class DisallowAllocationFailure; | 1147 friend class DisallowAllocationFailure; |
| 1145 friend class AlwaysAllocateScope; | 1148 friend class AlwaysAllocateScope; |
| 1146 friend class LinearAllocationScope; | 1149 friend class LinearAllocationScope; |
| 1147 }; | 1150 }; |
| 1148 | 1151 |
| 1149 | 1152 |
| 1153 class HeapStats { |
| 1154 public: |
| 1155 int new_space_size; |
| 1156 int new_space_capacity; |
| 1157 int old_pointer_space_size; |
| 1158 int old_pointer_space_capacity; |
| 1159 int old_data_space_size; |
| 1160 int old_data_space_capacity; |
| 1161 int code_space_size; |
| 1162 int code_space_capacity; |
| 1163 int map_space_size; |
| 1164 int map_space_capacity; |
| 1165 int cell_space_size; |
| 1166 int cell_space_capacity; |
| 1167 int lo_space_size; |
| 1168 int global_handle_count; |
| 1169 int weak_global_handle_count; |
| 1170 int pending_global_handle_count; |
| 1171 int near_death_global_handle_count; |
| 1172 int destroyed_global_handle_count; |
| 1173 }; |
| 1174 |
| 1175 |
| 1150 class AlwaysAllocateScope { | 1176 class AlwaysAllocateScope { |
| 1151 public: | 1177 public: |
| 1152 AlwaysAllocateScope() { | 1178 AlwaysAllocateScope() { |
| 1153 // We shouldn't hit any nested scopes, because that requires | 1179 // We shouldn't hit any nested scopes, because that requires |
| 1154 // non-handle code to call handle code. The code still works but | 1180 // non-handle code to call handle code. The code still works but |
| 1155 // performance will degrade, so we want to catch this situation | 1181 // performance will degrade, so we want to catch this situation |
| 1156 // in debug mode. | 1182 // in debug mode. |
| 1157 ASSERT(Heap::always_allocate_scope_depth_ == 0); | 1183 ASSERT(Heap::always_allocate_scope_depth_ == 0); |
| 1158 Heap::always_allocate_scope_depth_++; | 1184 Heap::always_allocate_scope_depth_++; |
| 1159 } | 1185 } |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 } | 1664 } |
| 1639 static TranscendentalCache* caches_[kNumberOfCaches]; | 1665 static TranscendentalCache* caches_[kNumberOfCaches]; |
| 1640 Element elements_[kCacheSize]; | 1666 Element elements_[kCacheSize]; |
| 1641 Type type_; | 1667 Type type_; |
| 1642 }; | 1668 }; |
| 1643 | 1669 |
| 1644 | 1670 |
| 1645 } } // namespace v8::internal | 1671 } } // namespace v8::internal |
| 1646 | 1672 |
| 1647 #endif // V8_HEAP_H_ | 1673 #endif // V8_HEAP_H_ |
| OLD | NEW |