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