OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 ms_count_(0), | 111 ms_count_(0), |
112 gc_count_(0), | 112 gc_count_(0), |
113 remembered_unmapped_pages_index_(0), | 113 remembered_unmapped_pages_index_(0), |
114 unflattened_strings_length_(0), | 114 unflattened_strings_length_(0), |
115 #ifdef DEBUG | 115 #ifdef DEBUG |
116 allocation_allowed_(true), | 116 allocation_allowed_(true), |
117 allocation_timeout_(0), | 117 allocation_timeout_(0), |
118 disallow_allocation_failure_(false), | 118 disallow_allocation_failure_(false), |
119 #endif // DEBUG | 119 #endif // DEBUG |
120 new_space_high_promotion_mode_active_(false), | 120 new_space_high_promotion_mode_active_(false), |
121 old_gen_promotion_limit_(kMinimumPromotionLimit), | 121 old_generation_allocation_limit_(kMinimumOldGenerationAllocationLimit), |
122 old_gen_allocation_limit_(kMinimumAllocationLimit), | |
123 size_of_old_gen_at_last_old_space_gc_(0), | 122 size_of_old_gen_at_last_old_space_gc_(0), |
124 external_allocation_limit_(0), | 123 external_allocation_limit_(0), |
125 amount_of_external_allocated_memory_(0), | 124 amount_of_external_allocated_memory_(0), |
126 amount_of_external_allocated_memory_at_last_global_gc_(0), | 125 amount_of_external_allocated_memory_at_last_global_gc_(0), |
127 old_gen_exhausted_(false), | 126 old_gen_exhausted_(false), |
128 store_buffer_rebuilder_(store_buffer()), | 127 store_buffer_rebuilder_(store_buffer()), |
129 hidden_string_(NULL), | 128 hidden_string_(NULL), |
130 global_gc_prologue_callback_(NULL), | 129 global_gc_prologue_callback_(NULL), |
131 global_gc_epilogue_callback_(NULL), | 130 global_gc_epilogue_callback_(NULL), |
132 gc_safe_size_of_old_object_(NULL), | 131 gc_safe_size_of_old_object_(NULL), |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 *reason = "GC in old space requested"; | 274 *reason = "GC in old space requested"; |
276 return MARK_COMPACTOR; | 275 return MARK_COMPACTOR; |
277 } | 276 } |
278 | 277 |
279 if (FLAG_gc_global || (FLAG_stress_compaction && (gc_count_ & 1) != 0)) { | 278 if (FLAG_gc_global || (FLAG_stress_compaction && (gc_count_ & 1) != 0)) { |
280 *reason = "GC in old space forced by flags"; | 279 *reason = "GC in old space forced by flags"; |
281 return MARK_COMPACTOR; | 280 return MARK_COMPACTOR; |
282 } | 281 } |
283 | 282 |
284 // Is enough data promoted to justify a global GC? | 283 // Is enough data promoted to justify a global GC? |
285 if (OldGenerationPromotionLimitReached()) { | 284 if (OldGenerationAllocationLimitReached()) { |
286 isolate_->counters()->gc_compactor_caused_by_promoted_data()->Increment(); | 285 isolate_->counters()->gc_compactor_caused_by_promoted_data()->Increment(); |
287 *reason = "promotion limit reached"; | 286 *reason = "promotion limit reached"; |
288 return MARK_COMPACTOR; | 287 return MARK_COMPACTOR; |
289 } | 288 } |
290 | 289 |
291 // Have allocation in OLD and LO failed? | 290 // Have allocation in OLD and LO failed? |
292 if (old_gen_exhausted_) { | 291 if (old_gen_exhausted_) { |
293 isolate_->counters()-> | 292 isolate_->counters()-> |
294 gc_compactor_caused_by_oldspace_exhaustion()->Increment(); | 293 gc_compactor_caused_by_oldspace_exhaustion()->Increment(); |
295 *reason = "old generations exhausted"; | 294 *reason = "old generations exhausted"; |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 | 908 |
910 if (collector == MARK_COMPACTOR) { | 909 if (collector == MARK_COMPACTOR) { |
911 // Perform mark-sweep with optional compaction. | 910 // Perform mark-sweep with optional compaction. |
912 MarkCompact(tracer); | 911 MarkCompact(tracer); |
913 sweep_generation_++; | 912 sweep_generation_++; |
914 | 913 |
915 UpdateSurvivalRateTrend(start_new_space_size); | 914 UpdateSurvivalRateTrend(start_new_space_size); |
916 | 915 |
917 size_of_old_gen_at_last_old_space_gc_ = PromotedSpaceSizeOfObjects(); | 916 size_of_old_gen_at_last_old_space_gc_ = PromotedSpaceSizeOfObjects(); |
918 | 917 |
919 old_gen_promotion_limit_ = | 918 old_generation_allocation_limit_ = |
920 OldGenPromotionLimit(size_of_old_gen_at_last_old_space_gc_); | 919 OldGenerationAllocationLimit(size_of_old_gen_at_last_old_space_gc_); |
921 old_gen_allocation_limit_ = | |
922 OldGenAllocationLimit(size_of_old_gen_at_last_old_space_gc_); | |
923 | 920 |
924 old_gen_exhausted_ = false; | 921 old_gen_exhausted_ = false; |
925 } else { | 922 } else { |
926 tracer_ = tracer; | 923 tracer_ = tracer; |
927 Scavenge(); | 924 Scavenge(); |
928 tracer_ = NULL; | 925 tracer_ = NULL; |
929 | 926 |
930 UpdateSurvivalRateTrend(start_new_space_size); | 927 UpdateSurvivalRateTrend(start_new_space_size); |
931 } | 928 } |
932 | 929 |
(...skipping 5019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5952 } | 5949 } |
5953 | 5950 |
5954 | 5951 |
5955 // This function expects that NewSpace's allocated objects histogram is | 5952 // This function expects that NewSpace's allocated objects histogram is |
5956 // populated (via a call to CollectStatistics or else as a side effect of a | 5953 // populated (via a call to CollectStatistics or else as a side effect of a |
5957 // just-completed scavenge collection). | 5954 // just-completed scavenge collection). |
5958 void Heap::ReportHeapStatistics(const char* title) { | 5955 void Heap::ReportHeapStatistics(const char* title) { |
5959 USE(title); | 5956 USE(title); |
5960 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", | 5957 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", |
5961 title, gc_count_); | 5958 title, gc_count_); |
5962 PrintF("old_gen_promotion_limit_ %" V8_PTR_PREFIX "d\n", | 5959 PrintF("old_generation_allocation_limit_ %" V8_PTR_PREFIX "d\n", |
5963 old_gen_promotion_limit_); | 5960 old_generation_allocation_limit_); |
5964 PrintF("old_gen_allocation_limit_ %" V8_PTR_PREFIX "d\n", | |
5965 old_gen_allocation_limit_); | |
5966 | 5961 |
5967 PrintF("\n"); | 5962 PrintF("\n"); |
5968 PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles(isolate_)); | 5963 PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles(isolate_)); |
5969 isolate_->global_handles()->PrintStats(); | 5964 isolate_->global_handles()->PrintStats(); |
5970 PrintF("\n"); | 5965 PrintF("\n"); |
5971 | 5966 |
5972 PrintF("Heap statistics : "); | 5967 PrintF("Heap statistics : "); |
5973 isolate_->memory_allocator()->ReportStatistics(); | 5968 isolate_->memory_allocator()->ReportStatistics(); |
5974 PrintF("To space : "); | 5969 PrintF("To space : "); |
5975 new_space_.ReportStatistics(); | 5970 new_space_.ReportStatistics(); |
(...skipping 1967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7943 if (FLAG_parallel_recompilation) { | 7938 if (FLAG_parallel_recompilation) { |
7944 heap_->relocation_mutex_->Lock(); | 7939 heap_->relocation_mutex_->Lock(); |
7945 #ifdef DEBUG | 7940 #ifdef DEBUG |
7946 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 7941 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
7947 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 7942 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
7948 #endif // DEBUG | 7943 #endif // DEBUG |
7949 } | 7944 } |
7950 } | 7945 } |
7951 | 7946 |
7952 } } // namespace v8::internal | 7947 } } // namespace v8::internal |
OLD | NEW |