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

Side by Side Diff: src/heap.h

Issue 1622016: Reverting r4318 (merge of scavenge into sweeping pass of MSC garbage collecto... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 8 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 | « no previous file | 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 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 V(global_eval_symbol, "GlobalEval") \ 193 V(global_eval_symbol, "GlobalEval") \
194 V(identity_hash_symbol, "v8::IdentityHash") \ 194 V(identity_hash_symbol, "v8::IdentityHash") \
195 V(closure_symbol, "(closure)") 195 V(closure_symbol, "(closure)")
196 196
197 197
198 // Forward declaration of the GCTracer class. 198 // Forward declaration of the GCTracer class.
199 class GCTracer; 199 class GCTracer;
200 class HeapStats; 200 class HeapStats;
201 201
202 202
203 typedef String* (*ExternalStringTableUpdaterCallback)(Object** pointer);
204
205
206 // The all static Heap captures the interface to the global object heap. 203 // The all static Heap captures the interface to the global object heap.
207 // All JavaScript contexts by this process share the same object heap. 204 // All JavaScript contexts by this process share the same object heap.
208 205
209 class Heap : public AllStatic { 206 class Heap : public AllStatic {
210 public: 207 public:
211 // Configure heap size before setup. Return false if the heap has been 208 // Configure heap size before setup. Return false if the heap has been
212 // setup already. 209 // setup already.
213 static bool ConfigureHeap(int max_semispace_size, int max_old_gen_size); 210 static bool ConfigureHeap(int max_semispace_size, int max_old_gen_size);
214 static bool ConfigureHeapDefault(); 211 static bool ConfigureHeapDefault();
215 212
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 937
941 static Object* NumberToString(Object* number, 938 static Object* NumberToString(Object* number,
942 bool check_number_string_cache = true); 939 bool check_number_string_cache = true);
943 940
944 static Map* MapForExternalArrayType(ExternalArrayType array_type); 941 static Map* MapForExternalArrayType(ExternalArrayType array_type);
945 static RootListIndex RootIndexForExternalArrayType( 942 static RootListIndex RootIndexForExternalArrayType(
946 ExternalArrayType array_type); 943 ExternalArrayType array_type);
947 944
948 static void RecordStats(HeapStats* stats); 945 static void RecordStats(HeapStats* stats);
949 946
950 // Copy block of memory from src to dst. Size of block should be aligned
951 // by pointer size.
952 static inline void CopyBlock(Object** dst, Object** src, int byte_size);
953
954 // Optimized version of memmove for blocks with pointer size aligned sizes and
955 // pointer size aligned addresses.
956 static inline void MoveBlock(Object** dst, Object** src, size_t byte_size);
957
958 // Check new space expansion criteria and expand semispaces if it was hit.
959 static void CheckNewSpaceExpansionCriteria();
960
961 static inline void IncrementYoungSurvivorsCounter(int survived) {
962 survived_since_last_expansion_ += survived;
963 }
964
965 static void UpdateNewSpaceReferencesInExternalStringTable(
966 ExternalStringTableUpdaterCallback updater_func);
967
968 // Helper function that governs the promotion policy from new space to
969 // old. If the object's old address lies below the new space's age
970 // mark or if we've already filled the bottom 1/16th of the to space,
971 // we try to promote this object.
972 static inline bool ShouldBePromoted(Address old_address, int object_size);
973
974 static int MaxObjectSizeInNewSpace() { return kMaxObjectSizeInNewSpace; } 947 static int MaxObjectSizeInNewSpace() { return kMaxObjectSizeInNewSpace; }
975 948
976 private: 949 private:
977 static int reserved_semispace_size_; 950 static int reserved_semispace_size_;
978 static int max_semispace_size_; 951 static int max_semispace_size_;
979 static int initial_semispace_size_; 952 static int initial_semispace_size_;
980 static int max_old_generation_size_; 953 static int max_old_generation_size_;
981 static size_t code_range_size_; 954 static size_t code_range_size_;
982 955
983 // For keeping track of how much data has survived 956 // For keeping track of how much data has survived
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 1133
1161 static Object* CreateOddball(Map* map, 1134 static Object* CreateOddball(Map* map,
1162 const char* to_string, 1135 const char* to_string,
1163 Object* to_number); 1136 Object* to_number);
1164 1137
1165 // Allocate empty fixed array. 1138 // Allocate empty fixed array.
1166 static Object* AllocateEmptyFixedArray(); 1139 static Object* AllocateEmptyFixedArray();
1167 1140
1168 // Performs a minor collection in new generation. 1141 // Performs a minor collection in new generation.
1169 static void Scavenge(); 1142 static void Scavenge();
1170 1143 static void ScavengeExternalStringTable();
1171 static String* UpdateNewSpaceReferenceInExternalStringTableEntry(
1172 Object** pointer);
1173
1174 static Address DoScavenge(ObjectVisitor* scavenge_visitor, 1144 static Address DoScavenge(ObjectVisitor* scavenge_visitor,
1175 Address new_space_front); 1145 Address new_space_front);
1176 1146
1177 // Performs a major collection in the whole heap. 1147 // Performs a major collection in the whole heap.
1178 static void MarkCompact(GCTracer* tracer); 1148 static void MarkCompact(GCTracer* tracer);
1179 1149
1180 // Code to be run before and after mark-compact. 1150 // Code to be run before and after mark-compact.
1181 static void MarkCompactPrologue(bool is_compacting); 1151 static void MarkCompactPrologue(bool is_compacting);
1182 static void MarkCompactEpilogue(bool is_compacting); 1152 static void MarkCompactEpilogue(bool is_compacting);
1183 1153
1184 // Helper function used by CopyObject to copy a source object to an 1154 // Helper function used by CopyObject to copy a source object to an
1185 // allocated target object and update the forwarding pointer in the source 1155 // allocated target object and update the forwarding pointer in the source
1186 // object. Returns the target object. 1156 // object. Returns the target object.
1187 static inline HeapObject* MigrateObject(HeapObject* source, 1157 static inline HeapObject* MigrateObject(HeapObject* source,
1188 HeapObject* target, 1158 HeapObject* target,
1189 int size); 1159 int size);
1190 1160
1161 // Helper function that governs the promotion policy from new space to
1162 // old. If the object's old address lies below the new space's age
1163 // mark or if we've already filled the bottom 1/16th of the to space,
1164 // we try to promote this object.
1165 static inline bool ShouldBePromoted(Address old_address, int object_size);
1191 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) 1166 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING)
1192 // Record the copy of an object in the NewSpace's statistics. 1167 // Record the copy of an object in the NewSpace's statistics.
1193 static void RecordCopiedObject(HeapObject* obj); 1168 static void RecordCopiedObject(HeapObject* obj);
1194 1169
1195 // Record statistics before and after garbage collection. 1170 // Record statistics before and after garbage collection.
1196 static void ReportStatisticsBeforeGC(); 1171 static void ReportStatisticsBeforeGC();
1197 static void ReportStatisticsAfterGC(); 1172 static void ReportStatisticsAfterGC();
1198 #endif 1173 #endif
1199 1174
1200 // Rebuild remembered set in an old space. 1175 // Rebuild remembered set in an old space.
1201 static void RebuildRSets(PagedSpace* space); 1176 static void RebuildRSets(PagedSpace* space);
1202 1177
1203 // Rebuild remembered set in the large object space. 1178 // Rebuild remembered set in the large object space.
1204 static void RebuildRSets(LargeObjectSpace* space); 1179 static void RebuildRSets(LargeObjectSpace* space);
1205 1180
1206 // Slow part of scavenge object. 1181 // Slow part of scavenge object.
1207 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); 1182 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object);
1208 1183
1184 // Copy memory from src to dst.
1185 static inline void CopyBlock(Object** dst, Object** src, int byte_size);
1186
1209 // Initializes a function with a shared part and prototype. 1187 // Initializes a function with a shared part and prototype.
1210 // Returns the function. 1188 // Returns the function.
1211 // Note: this code was factored out of AllocateFunction such that 1189 // Note: this code was factored out of AllocateFunction such that
1212 // other parts of the VM could use it. Specifically, a function that creates 1190 // other parts of the VM could use it. Specifically, a function that creates
1213 // instances of type JS_FUNCTION_TYPE benefit from the use of this function. 1191 // instances of type JS_FUNCTION_TYPE benefit from the use of this function.
1214 // Please note this does not perform a garbage collection. 1192 // Please note this does not perform a garbage collection.
1215 static inline Object* InitializeFunction(JSFunction* function, 1193 static inline Object* InitializeFunction(JSFunction* function,
1216 SharedFunctionInfo* shared, 1194 SharedFunctionInfo* shared,
1217 Object* prototype); 1195 Object* prototype);
1218 1196
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 1806
1829 // To speed up scavenge collections new space string are kept 1807 // To speed up scavenge collections new space string are kept
1830 // separate from old space strings. 1808 // separate from old space strings.
1831 static List<Object*> new_space_strings_; 1809 static List<Object*> new_space_strings_;
1832 static List<Object*> old_space_strings_; 1810 static List<Object*> old_space_strings_;
1833 }; 1811 };
1834 1812
1835 } } // namespace v8::internal 1813 } } // namespace v8::internal
1836 1814
1837 #endif // V8_HEAP_H_ 1815 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698