Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: src/heap.h

Issue 3454035: Revert attempt to make heap size 32/64 clean. This change needs to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/global-handles.cc ('k') | src/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 static void SetStackLimits(); 238 static void SetStackLimits();
239 239
240 // Returns whether Setup has been called. 240 // Returns whether Setup has been called.
241 static bool HasBeenSetup(); 241 static bool HasBeenSetup();
242 242
243 // Returns the maximum amount of memory reserved for the heap. For 243 // Returns the maximum amount of memory reserved for the heap. For
244 // the young generation, we reserve 4 times the amount needed for a 244 // the young generation, we reserve 4 times the amount needed for a
245 // semi space. The young generation consists of two semi spaces and 245 // semi space. The young generation consists of two semi spaces and
246 // we reserve twice the amount needed for those in order to ensure 246 // we reserve twice the amount needed for those in order to ensure
247 // that new space can be aligned to its size. 247 // that new space can be aligned to its size.
248 static intptr_t MaxReserved() { 248 static int MaxReserved() {
249 return 4 * reserved_semispace_size_ + max_old_generation_size_; 249 return 4 * reserved_semispace_size_ + max_old_generation_size_;
250 } 250 }
251 static int MaxSemiSpaceSize() { return max_semispace_size_; } 251 static int MaxSemiSpaceSize() { return max_semispace_size_; }
252 static int ReservedSemiSpaceSize() { return reserved_semispace_size_; } 252 static int ReservedSemiSpaceSize() { return reserved_semispace_size_; }
253 static int InitialSemiSpaceSize() { return initial_semispace_size_; } 253 static int InitialSemiSpaceSize() { return initial_semispace_size_; }
254 static intptr_t MaxOldGenerationSize() { return max_old_generation_size_; } 254 static int MaxOldGenerationSize() { return max_old_generation_size_; }
255 255
256 // Returns the capacity of the heap in bytes w/o growing. Heap grows when 256 // Returns the capacity of the heap in bytes w/o growing. Heap grows when
257 // more spaces are needed until it reaches the limit. 257 // more spaces are needed until it reaches the limit.
258 static int Capacity(); 258 static int Capacity();
259 259
260 // Returns the amount of memory currently committed for the heap. 260 // Returns the amount of memory currently committed for the heap.
261 static int CommittedMemory(); 261 static int CommittedMemory();
262 262
263 // Returns the available bytes in space w/o growing. 263 // Returns the available bytes in space w/o growing.
264 // Heap doesn't guarantee that it can allocate an object that requires 264 // Heap doesn't guarantee that it can allocate an object that requires
265 // all available bytes. Check MaxHeapObjectSize() instead. 265 // all available bytes. Check MaxHeapObjectSize() instead.
266 static int Available(); 266 static int Available();
267 267
268 // Returns the maximum object size in paged space. 268 // Returns the maximum object size in paged space.
269 static inline int MaxObjectSizeInPagedSpace(); 269 static inline int MaxObjectSizeInPagedSpace();
270 270
271 // Returns of size of all objects residing in the heap. 271 // Returns of size of all objects residing in the heap.
272 static intptr_t SizeOfObjects(); 272 static int SizeOfObjects();
273 273
274 // Return the starting address and a mask for the new space. And-masking an 274 // Return the starting address and a mask for the new space. And-masking an
275 // address with the mask will result in the start address of the new space 275 // address with the mask will result in the start address of the new space
276 // for all addresses in either semispace. 276 // for all addresses in either semispace.
277 static Address NewSpaceStart() { return new_space_.start(); } 277 static Address NewSpaceStart() { return new_space_.start(); }
278 static uintptr_t NewSpaceMask() { return new_space_.mask(); } 278 static uintptr_t NewSpaceMask() { return new_space_.mask(); }
279 static Address NewSpaceTop() { return new_space_.top(); } 279 static Address NewSpaceTop() { return new_space_.top(); }
280 280
281 static NewSpace* new_space() { return &new_space_; } 281 static NewSpace* new_space() { return &new_space_; }
282 static OldSpace* old_pointer_space() { return old_pointer_space_; } 282 static OldSpace* old_pointer_space() { return old_pointer_space_; }
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1062 static void ClearJSFunctionResultCaches(); 1062 static void ClearJSFunctionResultCaches();
1063 1063
1064 static void ClearNormalizedMapCaches(); 1064 static void ClearNormalizedMapCaches();
1065 1065
1066 static GCTracer* tracer() { return tracer_; } 1066 static GCTracer* tracer() { return tracer_; }
1067 1067
1068 private: 1068 private:
1069 static int reserved_semispace_size_; 1069 static int reserved_semispace_size_;
1070 static int max_semispace_size_; 1070 static int max_semispace_size_;
1071 static int initial_semispace_size_; 1071 static int initial_semispace_size_;
1072 static intptr_t max_old_generation_size_; 1072 static int max_old_generation_size_;
1073 static intptr_t code_range_size_; 1073 static size_t code_range_size_;
1074 1074
1075 // For keeping track of how much data has survived 1075 // For keeping track of how much data has survived
1076 // scavenge since last new space expansion. 1076 // scavenge since last new space expansion.
1077 static int survived_since_last_expansion_; 1077 static int survived_since_last_expansion_;
1078 1078
1079 static int always_allocate_scope_depth_; 1079 static int always_allocate_scope_depth_;
1080 static int linear_allocation_scope_depth_; 1080 static int linear_allocation_scope_depth_;
1081 1081
1082 // For keeping track of context disposals. 1082 // For keeping track of context disposals.
1083 static int contexts_disposed_; 1083 static int contexts_disposed_;
1084 1084
1085 #if defined(V8_TARGET_ARCH_X64) 1085 #if defined(V8_TARGET_ARCH_X64)
1086 static const int kMaxObjectSizeInNewSpace = 512*KB; 1086 static const int kMaxObjectSizeInNewSpace = 512*KB;
1087 #else 1087 #else
1088 static const int kMaxObjectSizeInNewSpace = 256*KB; 1088 static const int kMaxObjectSizeInNewSpace = 256*KB;
1089 #endif 1089 #endif
1090 1090
1091 static NewSpace new_space_; 1091 static NewSpace new_space_;
1092 static OldSpace* old_pointer_space_; 1092 static OldSpace* old_pointer_space_;
1093 static OldSpace* old_data_space_; 1093 static OldSpace* old_data_space_;
1094 static OldSpace* code_space_; 1094 static OldSpace* code_space_;
1095 static MapSpace* map_space_; 1095 static MapSpace* map_space_;
1096 static CellSpace* cell_space_; 1096 static CellSpace* cell_space_;
1097 static LargeObjectSpace* lo_space_; 1097 static LargeObjectSpace* lo_space_;
1098 static HeapState gc_state_; 1098 static HeapState gc_state_;
1099 1099
1100 // Returns the size of object residing in non new spaces. 1100 // Returns the size of object residing in non new spaces.
1101 static intptr_t PromotedSpaceSize(); 1101 static int PromotedSpaceSize();
1102 1102
1103 // Returns the amount of external memory registered since last global gc. 1103 // Returns the amount of external memory registered since last global gc.
1104 static int PromotedExternalMemorySize(); 1104 static int PromotedExternalMemorySize();
1105 1105
1106 static int mc_count_; // how many mark-compact collections happened 1106 static int mc_count_; // how many mark-compact collections happened
1107 static int ms_count_; // how many mark-sweep collections happened 1107 static int ms_count_; // how many mark-sweep collections happened
1108 static int gc_count_; // how many gc happened 1108 static int gc_count_; // how many gc happened
1109 1109
1110 // Total length of the strings we failed to flatten since the last GC. 1110 // Total length of the strings we failed to flatten since the last GC.
1111 static int unflattened_strings_length_; 1111 static int unflattened_strings_length_;
(...skipping 14 matching lines...) Expand all
1126 static int allocation_timeout_; 1126 static int allocation_timeout_;
1127 1127
1128 // Do we expect to be able to handle allocation failure at this 1128 // Do we expect to be able to handle allocation failure at this
1129 // time? 1129 // time?
1130 static bool disallow_allocation_failure_; 1130 static bool disallow_allocation_failure_;
1131 #endif // DEBUG 1131 #endif // DEBUG
1132 1132
1133 // Limit that triggers a global GC on the next (normally caused) GC. This 1133 // Limit that triggers a global GC on the next (normally caused) GC. This
1134 // is checked when we have already decided to do a GC to help determine 1134 // is checked when we have already decided to do a GC to help determine
1135 // which collector to invoke. 1135 // which collector to invoke.
1136 static intptr_t old_gen_promotion_limit_; 1136 static int old_gen_promotion_limit_;
1137 1137
1138 // Limit that triggers a global GC as soon as is reasonable. This is 1138 // Limit that triggers a global GC as soon as is reasonable. This is
1139 // checked before expanding a paged space in the old generation and on 1139 // checked before expanding a paged space in the old generation and on
1140 // every allocation in large object space. 1140 // every allocation in large object space.
1141 static intptr_t old_gen_allocation_limit_; 1141 static int old_gen_allocation_limit_;
1142 1142
1143 // Limit on the amount of externally allocated memory allowed 1143 // Limit on the amount of externally allocated memory allowed
1144 // between global GCs. If reached a global GC is forced. 1144 // between global GCs. If reached a global GC is forced.
1145 static intptr_t external_allocation_limit_; 1145 static int external_allocation_limit_;
1146 1146
1147 // The amount of external memory registered through the API kept alive 1147 // The amount of external memory registered through the API kept alive
1148 // by global handles 1148 // by global handles
1149 static int amount_of_external_allocated_memory_; 1149 static int amount_of_external_allocated_memory_;
1150 1150
1151 // Caches the amount of external memory registered at the last global gc. 1151 // Caches the amount of external memory registered at the last global gc.
1152 static int amount_of_external_allocated_memory_at_last_global_gc_; 1152 static int amount_of_external_allocated_memory_at_last_global_gc_;
1153 1153
1154 // Indicates that an allocation has failed in the old generation since the 1154 // Indicates that an allocation has failed in the old generation since the
1155 // last GC. 1155 // last GC.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 } 1224 }
1225 1225
1226 // Checks whether a global GC is necessary 1226 // Checks whether a global GC is necessary
1227 static GarbageCollector SelectGarbageCollector(AllocationSpace space); 1227 static GarbageCollector SelectGarbageCollector(AllocationSpace space);
1228 1228
1229 // Performs garbage collection 1229 // Performs garbage collection
1230 static void PerformGarbageCollection(GarbageCollector collector, 1230 static void PerformGarbageCollection(GarbageCollector collector,
1231 GCTracer* tracer, 1231 GCTracer* tracer,
1232 CollectionPolicy collectionPolicy); 1232 CollectionPolicy collectionPolicy);
1233 1233
1234 static const intptr_t kMinimumPromotionLimit = 2 * MB; 1234 static const int kMinimumPromotionLimit = 2 * MB;
1235 static const intptr_t kMinimumAllocationLimit = 8 * MB; 1235 static const int kMinimumAllocationLimit = 8 * MB;
1236 1236
1237 inline static void UpdateOldSpaceLimits(); 1237 inline static void UpdateOldSpaceLimits();
1238 1238
1239 // Allocate an uninitialized object in map space. The behavior is identical 1239 // Allocate an uninitialized object in map space. The behavior is identical
1240 // to Heap::AllocateRaw(size_in_bytes, MAP_SPACE), except that (a) it doesn't 1240 // to Heap::AllocateRaw(size_in_bytes, MAP_SPACE), except that (a) it doesn't
1241 // have to test the allocation space argument and (b) can reduce code size 1241 // have to test the allocation space argument and (b) can reduce code size
1242 // (since both AllocateRaw and AllocateRawMap are inlined). 1242 // (since both AllocateRaw and AllocateRawMap are inlined).
1243 MUST_USE_RESULT static inline Object* AllocateRawMap(); 1243 MUST_USE_RESULT static inline Object* AllocateRawMap();
1244 1244
1245 // Allocate an uninitialized object in the global property cell space. 1245 // Allocate an uninitialized object in the global property cell space.
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1830 int marked_count() { return marked_count_; } 1830 int marked_count() { return marked_count_; }
1831 1831
1832 void increment_promoted_objects_size(int object_size) { 1832 void increment_promoted_objects_size(int object_size) {
1833 promoted_objects_size_ += object_size; 1833 promoted_objects_size_ += object_size;
1834 } 1834 }
1835 1835
1836 // Returns maximum GC pause. 1836 // Returns maximum GC pause.
1837 static int get_max_gc_pause() { return max_gc_pause_; } 1837 static int get_max_gc_pause() { return max_gc_pause_; }
1838 1838
1839 // Returns maximum size of objects alive after GC. 1839 // Returns maximum size of objects alive after GC.
1840 static intptr_t get_max_alive_after_gc() { return max_alive_after_gc_; } 1840 static int get_max_alive_after_gc() { return max_alive_after_gc_; }
1841 1841
1842 // Returns minimal interval between two subsequent collections. 1842 // Returns minimal interval between two subsequent collections.
1843 static int get_min_in_mutator() { return min_in_mutator_; } 1843 static int get_min_in_mutator() { return min_in_mutator_; }
1844 1844
1845 private: 1845 private:
1846 // Returns a string matching the collector. 1846 // Returns a string matching the collector.
1847 const char* CollectorString(); 1847 const char* CollectorString();
1848 1848
1849 // Returns size of object in heap (in MB). 1849 // Returns size of object in heap (in MB).
1850 double SizeOfHeapObjects() { 1850 double SizeOfHeapObjects() {
1851 return (static_cast<double>(Heap::SizeOfObjects())) / MB; 1851 return (static_cast<double>(Heap::SizeOfObjects())) / MB;
1852 } 1852 }
1853 1853
1854 double start_time_; // Timestamp set in the constructor. 1854 double start_time_; // Timestamp set in the constructor.
1855 intptr_t start_size_; // Size of objects in heap set in constructor. 1855 int start_size_; // Size of objects in heap set in constructor.
1856 GarbageCollector collector_; // Type of collector. 1856 GarbageCollector collector_; // Type of collector.
1857 1857
1858 // A count (including this one, eg, the first collection is 1) of the 1858 // A count (including this one, eg, the first collection is 1) of the
1859 // number of garbage collections. 1859 // number of garbage collections.
1860 int gc_count_; 1860 int gc_count_;
1861 1861
1862 // A count (including this one) of the number of full garbage collections. 1862 // A count (including this one) of the number of full garbage collections.
1863 int full_gc_count_; 1863 int full_gc_count_;
1864 1864
1865 // True if the current GC is a compacting full collection, false 1865 // True if the current GC is a compacting full collection, false
(...skipping 11 matching lines...) Expand all
1877 1877
1878 // The count from the end of the previous full GC. Will be zero if there 1878 // The count from the end of the previous full GC. Will be zero if there
1879 // was no previous full GC. 1879 // was no previous full GC.
1880 int previous_marked_count_; 1880 int previous_marked_count_;
1881 1881
1882 // Amounts of time spent in different scopes during GC. 1882 // Amounts of time spent in different scopes during GC.
1883 double scopes_[Scope::kNumberOfScopes]; 1883 double scopes_[Scope::kNumberOfScopes];
1884 1884
1885 // Total amount of space either wasted or contained in one of free lists 1885 // Total amount of space either wasted or contained in one of free lists
1886 // before the current GC. 1886 // before the current GC.
1887 intptr_t in_free_list_or_wasted_before_gc_; 1887 int in_free_list_or_wasted_before_gc_;
1888 1888
1889 // Difference between space used in the heap at the beginning of the current 1889 // Difference between space used in the heap at the beginning of the current
1890 // collection and the end of the previous collection. 1890 // collection and the end of the previous collection.
1891 intptr_t allocated_since_last_gc_; 1891 int allocated_since_last_gc_;
1892 1892
1893 // Amount of time spent in mutator that is time elapsed between end of the 1893 // Amount of time spent in mutator that is time elapsed between end of the
1894 // previous collection and the beginning of the current one. 1894 // previous collection and the beginning of the current one.
1895 double spent_in_mutator_; 1895 double spent_in_mutator_;
1896 1896
1897 // Size of objects promoted during the current collection. 1897 // Size of objects promoted during the current collection.
1898 intptr_t promoted_objects_size_; 1898 int promoted_objects_size_;
1899 1899
1900 // Maximum GC pause. 1900 // Maximum GC pause.
1901 static int max_gc_pause_; 1901 static int max_gc_pause_;
1902 1902
1903 // Maximum size of objects alive after GC. 1903 // Maximum size of objects alive after GC.
1904 static intptr_t max_alive_after_gc_; 1904 static int max_alive_after_gc_;
1905 1905
1906 // Minimal interval between two subsequent collections. 1906 // Minimal interval between two subsequent collections.
1907 static int min_in_mutator_; 1907 static int min_in_mutator_;
1908 1908
1909 // Size of objects alive after last GC. 1909 // Size of objects alive after last GC.
1910 static intptr_t alive_after_last_gc_; 1910 static int alive_after_last_gc_;
1911 1911
1912 static double last_gc_end_timestamp_; 1912 static double last_gc_end_timestamp_;
1913 }; 1913 };
1914 1914
1915 1915
1916 class TranscendentalCache { 1916 class TranscendentalCache {
1917 public: 1917 public:
1918 enum Type {ACOS, ASIN, ATAN, COS, EXP, LOG, SIN, TAN, kNumberOfCaches}; 1918 enum Type {ACOS, ASIN, ATAN, COS, EXP, LOG, SIN, TAN, kNumberOfCaches};
1919 1919
1920 explicit TranscendentalCache(Type t); 1920 explicit TranscendentalCache(Type t);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 2039
2040 // To speed up scavenge collections new space string are kept 2040 // To speed up scavenge collections new space string are kept
2041 // separate from old space strings. 2041 // separate from old space strings.
2042 static List<Object*> new_space_strings_; 2042 static List<Object*> new_space_strings_;
2043 static List<Object*> old_space_strings_; 2043 static List<Object*> old_space_strings_;
2044 }; 2044 };
2045 2045
2046 } } // namespace v8::internal 2046 } } // namespace v8::internal
2047 2047
2048 #endif // V8_HEAP_H_ 2048 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/global-handles.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698