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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // Returns the maximum object size that heap supports. Objects larger than | 237 // Returns the maximum object size that heap supports. Objects larger than |
238 // the maximum heap object size are allocated in a large object space. | 238 // the maximum heap object size are allocated in a large object space. |
239 static inline int MaxHeapObjectSize(); | 239 static inline int MaxHeapObjectSize(); |
240 | 240 |
241 // Returns of size of all objects residing in the heap. | 241 // Returns of size of all objects residing in the heap. |
242 static int SizeOfObjects(); | 242 static int SizeOfObjects(); |
243 | 243 |
244 // Return the starting address and a mask for the new space. And-masking an | 244 // Return the starting address and a mask for the new space. And-masking an |
245 // address with the mask will result in the start address of the new space | 245 // address with the mask will result in the start address of the new space |
246 // for all addresses in either semispace. | 246 // for all addresses in either semispace. |
247 static Address NewSpaceStart() { return new_space_->start(); } | 247 static Address NewSpaceStart() { return new_space_.start(); } |
248 static uint32_t NewSpaceMask() { return new_space_->mask(); } | 248 static uint32_t NewSpaceMask() { return new_space_.mask(); } |
249 static Address NewSpaceTop() { return new_space_->top(); } | 249 static Address NewSpaceTop() { return new_space_.top(); } |
250 | 250 |
251 static NewSpace* new_space() { return new_space_; } | 251 static NewSpace* new_space() { return &new_space_; } |
252 static OldSpace* old_pointer_space() { return old_pointer_space_; } | 252 static OldSpace* old_pointer_space() { return old_pointer_space_; } |
253 static OldSpace* old_data_space() { return old_data_space_; } | 253 static OldSpace* old_data_space() { return old_data_space_; } |
254 static OldSpace* code_space() { return code_space_; } | 254 static OldSpace* code_space() { return code_space_; } |
255 static MapSpace* map_space() { return map_space_; } | 255 static MapSpace* map_space() { return map_space_; } |
256 static LargeObjectSpace* lo_space() { return lo_space_; } | 256 static LargeObjectSpace* lo_space() { return lo_space_; } |
257 | 257 |
258 static Address* NewSpaceAllocationTopAddress() { | 258 static Address* NewSpaceAllocationTopAddress() { |
259 return new_space_->allocation_top_address(); | 259 return new_space_.allocation_top_address(); |
260 } | 260 } |
261 static Address* NewSpaceAllocationLimitAddress() { | 261 static Address* NewSpaceAllocationLimitAddress() { |
262 return new_space_->allocation_limit_address(); | 262 return new_space_.allocation_limit_address(); |
263 } | 263 } |
264 | 264 |
265 // Allocates and initializes a new JavaScript object based on a | 265 // Allocates and initializes a new JavaScript object based on a |
266 // constructor. | 266 // constructor. |
267 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 267 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
268 // failed. | 268 // failed. |
269 // Please note this does not perform a garbage collection. | 269 // Please note this does not perform a garbage collection. |
270 static Object* AllocateJSObject(JSFunction* constructor, | 270 static Object* AllocateJSObject(JSFunction* constructor, |
271 PretenureFlag pretenure = NOT_TENURED); | 271 PretenureFlag pretenure = NOT_TENURED); |
272 | 272 |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 static int semispace_size_; | 720 static int semispace_size_; |
721 static int initial_semispace_size_; | 721 static int initial_semispace_size_; |
722 static int young_generation_size_; | 722 static int young_generation_size_; |
723 static int old_generation_size_; | 723 static int old_generation_size_; |
724 | 724 |
725 static int new_space_growth_limit_; | 725 static int new_space_growth_limit_; |
726 static int scavenge_count_; | 726 static int scavenge_count_; |
727 | 727 |
728 static const int kMaxMapSpaceSize = 8*MB; | 728 static const int kMaxMapSpaceSize = 8*MB; |
729 | 729 |
730 static NewSpace* new_space_; | 730 static NewSpace new_space_; |
731 static OldSpace* old_pointer_space_; | 731 static OldSpace* old_pointer_space_; |
732 static OldSpace* old_data_space_; | 732 static OldSpace* old_data_space_; |
733 static OldSpace* code_space_; | 733 static OldSpace* code_space_; |
734 static MapSpace* map_space_; | 734 static MapSpace* map_space_; |
735 static LargeObjectSpace* lo_space_; | 735 static LargeObjectSpace* lo_space_; |
736 static HeapState gc_state_; | 736 static HeapState gc_state_; |
737 | 737 |
738 // Returns the size of object residing in non new spaces. | 738 // Returns the size of object residing in non new spaces. |
739 static int PromotedSpaceSize(); | 739 static int PromotedSpaceSize(); |
740 | 740 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 // Performs a major collection in the whole heap. | 832 // Performs a major collection in the whole heap. |
833 static void MarkCompact(GCTracer* tracer); | 833 static void MarkCompact(GCTracer* tracer); |
834 | 834 |
835 // Code to be run before and after mark-compact. | 835 // Code to be run before and after mark-compact. |
836 static void MarkCompactPrologue(); | 836 static void MarkCompactPrologue(); |
837 static void MarkCompactEpilogue(); | 837 static void MarkCompactEpilogue(); |
838 | 838 |
839 // Helper function used by CopyObject to copy a source object to an | 839 // Helper function used by CopyObject to copy a source object to an |
840 // allocated target object and update the forwarding pointer in the source | 840 // allocated target object and update the forwarding pointer in the source |
841 // object. Returns the target object. | 841 // object. Returns the target object. |
842 static HeapObject* MigrateObject(HeapObject** source_p, | 842 static HeapObject* MigrateObject(HeapObject* source, |
843 HeapObject* target, | 843 HeapObject* target, |
844 int size); | 844 int size); |
845 | 845 |
846 // Helper function that governs the promotion policy from new space to | 846 // Helper function that governs the promotion policy from new space to |
847 // old. If the object's old address lies below the new space's age | 847 // old. If the object's old address lies below the new space's age |
848 // mark or if we've already filled the bottom 1/16th of the to space, | 848 // mark or if we've already filled the bottom 1/16th of the to space, |
849 // we try to promote this object. | 849 // we try to promote this object. |
850 static inline bool ShouldBePromoted(Address old_address, int object_size); | 850 static inline bool ShouldBePromoted(Address old_address, int object_size); |
851 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 851 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
852 // Record the copy of an object in the NewSpace's statistics. | 852 // Record the copy of an object in the NewSpace's statistics. |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 int marked_count_; | 1165 int marked_count_; |
1166 | 1166 |
1167 // The count from the end of the previous full GC. Will be zero if there | 1167 // The count from the end of the previous full GC. Will be zero if there |
1168 // was no previous full GC. | 1168 // was no previous full GC. |
1169 int previous_marked_count_; | 1169 int previous_marked_count_; |
1170 }; | 1170 }; |
1171 | 1171 |
1172 } } // namespace v8::internal | 1172 } } // namespace v8::internal |
1173 | 1173 |
1174 #endif // V8_HEAP_H_ | 1174 #endif // V8_HEAP_H_ |
OLD | NEW |