| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 V(space_symbol, " ") \ | 182 V(space_symbol, " ") \ |
| 183 V(exec_symbol, "exec") \ | 183 V(exec_symbol, "exec") \ |
| 184 V(zero_symbol, "0") \ | 184 V(zero_symbol, "0") \ |
| 185 V(global_eval_symbol, "GlobalEval") \ | 185 V(global_eval_symbol, "GlobalEval") \ |
| 186 V(identity_hash_symbol, "v8::IdentityHash") \ | 186 V(identity_hash_symbol, "v8::IdentityHash") \ |
| 187 V(closure_symbol, "(closure)") | 187 V(closure_symbol, "(closure)") |
| 188 | 188 |
| 189 | 189 |
| 190 // Forward declaration of the GCTracer class. | 190 // Forward declaration of the GCTracer class. |
| 191 class GCTracer; | 191 class GCTracer; |
| 192 class HeapStats; |
| 192 | 193 |
| 193 | 194 |
| 194 // The all static Heap captures the interface to the global object heap. | 195 // The all static Heap captures the interface to the global object heap. |
| 195 // All JavaScript contexts by this process share the same object heap. | 196 // All JavaScript contexts by this process share the same object heap. |
| 196 | 197 |
| 197 class Heap : public AllStatic { | 198 class Heap : public AllStatic { |
| 198 public: | 199 public: |
| 199 // Configure heap size before setup. Return false if the heap has been | 200 // Configure heap size before setup. Return false if the heap has been |
| 200 // setup already. | 201 // setup already. |
| 201 static bool ConfigureHeap(int max_semispace_size, int max_old_gen_size); | 202 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... |
| 858 kStrongRootListLength = kSymbolTableRootIndex, | 859 kStrongRootListLength = kSymbolTableRootIndex, |
| 859 kRootListLength | 860 kRootListLength |
| 860 }; | 861 }; |
| 861 | 862 |
| 862 static Object* NumberToString(Object* number); | 863 static Object* NumberToString(Object* number); |
| 863 | 864 |
| 864 static Map* MapForExternalArrayType(ExternalArrayType array_type); | 865 static Map* MapForExternalArrayType(ExternalArrayType array_type); |
| 865 static RootListIndex RootIndexForExternalArrayType( | 866 static RootListIndex RootIndexForExternalArrayType( |
| 866 ExternalArrayType array_type); | 867 ExternalArrayType array_type); |
| 867 | 868 |
| 869 static void RecordStats(HeapStats* stats); |
| 870 |
| 868 private: | 871 private: |
| 869 static int reserved_semispace_size_; | 872 static int reserved_semispace_size_; |
| 870 static int max_semispace_size_; | 873 static int max_semispace_size_; |
| 871 static int initial_semispace_size_; | 874 static int initial_semispace_size_; |
| 872 static int max_old_generation_size_; | 875 static int max_old_generation_size_; |
| 873 static size_t code_range_size_; | 876 static size_t code_range_size_; |
| 874 | 877 |
| 875 // For keeping track of how much data has survived | 878 // For keeping track of how much data has survived |
| 876 // scavenge since last new space expansion. | 879 // scavenge since last new space expansion. |
| 877 static int survived_since_last_expansion_; | 880 static int survived_since_last_expansion_; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 static const int kInitialSymbolTableSize = 2048; | 1096 static const int kInitialSymbolTableSize = 2048; |
| 1094 static const int kInitialEvalCacheSize = 64; | 1097 static const int kInitialEvalCacheSize = 64; |
| 1095 | 1098 |
| 1096 friend class Factory; | 1099 friend class Factory; |
| 1097 friend class DisallowAllocationFailure; | 1100 friend class DisallowAllocationFailure; |
| 1098 friend class AlwaysAllocateScope; | 1101 friend class AlwaysAllocateScope; |
| 1099 friend class LinearAllocationScope; | 1102 friend class LinearAllocationScope; |
| 1100 }; | 1103 }; |
| 1101 | 1104 |
| 1102 | 1105 |
| 1106 struct HeapStats { |
| 1107 int new_space_size; |
| 1108 int new_space_capacity; |
| 1109 int old_pointer_space_size; |
| 1110 int old_pointer_space_capacity; |
| 1111 int old_data_space_size; |
| 1112 int old_data_space_capacity; |
| 1113 int code_space_size; |
| 1114 int code_space_capacity; |
| 1115 int map_space_size; |
| 1116 int map_space_capacity; |
| 1117 int cell_space_size; |
| 1118 int cell_space_capacity; |
| 1119 int lo_space_size; |
| 1120 int global_handle_count; |
| 1121 int weak_global_handle_count; |
| 1122 int pending_global_handle_count; |
| 1123 int near_death_global_handle_count; |
| 1124 int destroyed_global_handle_count; |
| 1125 }; |
| 1126 |
| 1127 |
| 1103 class AlwaysAllocateScope { | 1128 class AlwaysAllocateScope { |
| 1104 public: | 1129 public: |
| 1105 AlwaysAllocateScope() { | 1130 AlwaysAllocateScope() { |
| 1106 // We shouldn't hit any nested scopes, because that requires | 1131 // We shouldn't hit any nested scopes, because that requires |
| 1107 // non-handle code to call handle code. The code still works but | 1132 // non-handle code to call handle code. The code still works but |
| 1108 // performance will degrade, so we want to catch this situation | 1133 // performance will degrade, so we want to catch this situation |
| 1109 // in debug mode. | 1134 // in debug mode. |
| 1110 ASSERT(Heap::always_allocate_scope_depth_ == 0); | 1135 ASSERT(Heap::always_allocate_scope_depth_ == 0); |
| 1111 Heap::always_allocate_scope_depth_++; | 1136 Heap::always_allocate_scope_depth_++; |
| 1112 } | 1137 } |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 } | 1616 } |
| 1592 static TranscendentalCache* caches_[kNumberOfCaches]; | 1617 static TranscendentalCache* caches_[kNumberOfCaches]; |
| 1593 Element elements_[kCacheSize]; | 1618 Element elements_[kCacheSize]; |
| 1594 Type type_; | 1619 Type type_; |
| 1595 }; | 1620 }; |
| 1596 | 1621 |
| 1597 | 1622 |
| 1598 } } // namespace v8::internal | 1623 } } // namespace v8::internal |
| 1599 | 1624 |
| 1600 #endif // V8_HEAP_H_ | 1625 #endif // V8_HEAP_H_ |
| OLD | NEW |