Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 #endif | 55 #endif |
| 56 #if V8_TARGET_ARCH_MIPS && !V8_INTERPRETED_REGEXP | 56 #if V8_TARGET_ARCH_MIPS && !V8_INTERPRETED_REGEXP |
| 57 #include "regexp-macro-assembler.h" | 57 #include "regexp-macro-assembler.h" |
| 58 #include "mips/regexp-macro-assembler-mips.h" | 58 #include "mips/regexp-macro-assembler-mips.h" |
| 59 #endif | 59 #endif |
| 60 | 60 |
| 61 namespace v8 { | 61 namespace v8 { |
| 62 namespace internal { | 62 namespace internal { |
| 63 | 63 |
| 64 | 64 |
| 65 static const intptr_t kMinimumPromotionLimit = | |
| 66 2 * (Page::kPageSize > MB ? Page::kPageSize : MB); | |
| 67 static const intptr_t kMinimumAllocationLimit = | |
| 68 8 * (Page::kPageSize > MB ? Page::kPageSize : MB); | |
| 69 | |
| 70 | |
| 71 static Mutex* gc_initializer_mutex = OS::CreateMutex(); | 65 static Mutex* gc_initializer_mutex = OS::CreateMutex(); |
| 72 | 66 |
| 73 | 67 |
| 74 Heap::Heap() | 68 Heap::Heap() |
| 75 : isolate_(NULL), | 69 : isolate_(NULL), |
| 76 // semispace_size_ should be a power of 2 and old_generation_size_ should be | 70 // semispace_size_ should be a power of 2 and old_generation_size_ should be |
| 77 // a multiple of Page::kPageSize. | 71 // a multiple of Page::kPageSize. |
| 78 #if defined(ANDROID) | 72 #if defined(ANDROID) |
| 79 #define LUMP_OF_MEMORY (128 * KB) | 73 #define LUMP_OF_MEMORY (128 * KB) |
| 80 code_range_size_(0), | 74 code_range_size_(0), |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 gc_count_(0), | 108 gc_count_(0), |
| 115 unflattened_strings_length_(0), | 109 unflattened_strings_length_(0), |
| 116 #ifdef DEBUG | 110 #ifdef DEBUG |
| 117 allocation_allowed_(true), | 111 allocation_allowed_(true), |
| 118 allocation_timeout_(0), | 112 allocation_timeout_(0), |
| 119 disallow_allocation_failure_(false), | 113 disallow_allocation_failure_(false), |
| 120 debug_utils_(NULL), | 114 debug_utils_(NULL), |
| 121 #endif // DEBUG | 115 #endif // DEBUG |
| 122 old_gen_promotion_limit_(kMinimumPromotionLimit), | 116 old_gen_promotion_limit_(kMinimumPromotionLimit), |
| 123 old_gen_allocation_limit_(kMinimumAllocationLimit), | 117 old_gen_allocation_limit_(kMinimumAllocationLimit), |
| 118 old_gen_limit_factor_(1), | |
| 124 external_allocation_limit_(0), | 119 external_allocation_limit_(0), |
| 125 amount_of_external_allocated_memory_(0), | 120 amount_of_external_allocated_memory_(0), |
| 126 amount_of_external_allocated_memory_at_last_global_gc_(0), | 121 amount_of_external_allocated_memory_at_last_global_gc_(0), |
| 127 old_gen_exhausted_(false), | 122 old_gen_exhausted_(false), |
| 128 store_buffer_rebuilder_(store_buffer()), | 123 store_buffer_rebuilder_(store_buffer()), |
| 129 hidden_symbol_(NULL), | 124 hidden_symbol_(NULL), |
| 130 global_gc_prologue_callback_(NULL), | 125 global_gc_prologue_callback_(NULL), |
| 131 global_gc_epilogue_callback_(NULL), | 126 global_gc_epilogue_callback_(NULL), |
| 132 gc_safe_size_of_old_object_(NULL), | 127 gc_safe_size_of_old_object_(NULL), |
| 133 total_regexp_code_generated_(0), | 128 total_regexp_code_generated_(0), |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 724 // Perform mark-sweep with optional compaction. | 719 // Perform mark-sweep with optional compaction. |
| 725 MarkCompact(tracer); | 720 MarkCompact(tracer); |
| 726 sweep_generation_++; | 721 sweep_generation_++; |
| 727 bool high_survival_rate_during_scavenges = IsHighSurvivalRate() && | 722 bool high_survival_rate_during_scavenges = IsHighSurvivalRate() && |
| 728 IsStableOrIncreasingSurvivalTrend(); | 723 IsStableOrIncreasingSurvivalTrend(); |
| 729 | 724 |
| 730 UpdateSurvivalRateTrend(start_new_space_size); | 725 UpdateSurvivalRateTrend(start_new_space_size); |
| 731 | 726 |
| 732 intptr_t old_gen_size = PromotedSpaceSize(); | 727 intptr_t old_gen_size = PromotedSpaceSize(); |
| 733 old_gen_promotion_limit_ = | 728 old_gen_promotion_limit_ = |
| 734 old_gen_size + | 729 Max(new_space()->Capacity() + old_gen_size + kMinimumPromotionLimit, |
| 735 Max(kMinimumPromotionLimit, old_gen_size / 3) + | 730 new_space()->Capacity() + PromotionFactor(old_gen_size)); |
| 736 new_space()->Capacity(); | |
| 737 old_gen_allocation_limit_ = | 731 old_gen_allocation_limit_ = |
| 738 old_gen_size + | 732 Max(new_space()->Capacity() + old_gen_size + kMinimumAllocationLimit, |
| 739 Max(kMinimumAllocationLimit, old_gen_size / 2) + | 733 new_space()->Capacity() + AllocationFactor(old_gen_size)); |
|
Vyacheslav Egorov (Chromium)
2011/08/11 15:11:34
maybe instead of XFactor you should call it XDelta
Erik Corry
2011/08/11 16:09:08
This function does not exist any more.
| |
| 740 new_space()->Capacity(); | |
| 741 | 734 |
| 742 if (high_survival_rate_during_scavenges && | 735 if (high_survival_rate_during_scavenges && |
| 743 IsStableOrIncreasingSurvivalTrend()) { | 736 IsStableOrIncreasingSurvivalTrend()) { |
| 744 // Stable high survival rates of young objects both during partial and | 737 // Stable high survival rates of young objects both during partial and |
| 745 // full collection indicate that mutator is either building or modifying | 738 // full collection indicate that mutator is either building or modifying |
| 746 // a structure with a long lifetime. | 739 // a structure with a long lifetime. |
| 747 // In this case we aggressively raise old generation memory limits to | 740 // In this case we aggressively raise old generation memory limits to |
| 748 // postpone subsequent mark-sweep collection and thus trade memory | 741 // postpone subsequent mark-sweep collection and thus trade memory |
| 749 // space for the mutation speed. | 742 // space for the mutation speed. |
| 750 old_gen_promotion_limit_ *= 2; | 743 old_gen_limit_factor_ = 2; |
| 751 old_gen_allocation_limit_ *= 2; | 744 } else { |
| 745 old_gen_limit_factor_ = 1; | |
| 752 } | 746 } |
| 747 old_gen_promotion_limit_ *= old_gen_limit_factor_; | |
| 748 old_gen_allocation_limit_ *= old_gen_limit_factor_; | |
| 753 | 749 |
| 754 old_gen_exhausted_ = false; | 750 old_gen_exhausted_ = false; |
| 755 } else { | 751 } else { |
| 756 tracer_ = tracer; | 752 tracer_ = tracer; |
| 757 Scavenge(); | 753 Scavenge(); |
| 758 tracer_ = NULL; | 754 tracer_ = NULL; |
| 759 | 755 |
| 760 UpdateSurvivalRateTrend(start_new_space_size); | 756 UpdateSurvivalRateTrend(start_new_space_size); |
| 761 } | 757 } |
| 762 | 758 |
| (...skipping 3480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4243 // populated (via a call to CollectStatistics or else as a side effect of a | 4239 // populated (via a call to CollectStatistics or else as a side effect of a |
| 4244 // just-completed scavenge collection). | 4240 // just-completed scavenge collection). |
| 4245 void Heap::ReportHeapStatistics(const char* title) { | 4241 void Heap::ReportHeapStatistics(const char* title) { |
| 4246 USE(title); | 4242 USE(title); |
| 4247 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", | 4243 PrintF(">>>>>> =============== %s (%d) =============== >>>>>>\n", |
| 4248 title, gc_count_); | 4244 title, gc_count_); |
| 4249 PrintF("old_gen_promotion_limit_ %" V8_PTR_PREFIX "d\n", | 4245 PrintF("old_gen_promotion_limit_ %" V8_PTR_PREFIX "d\n", |
| 4250 old_gen_promotion_limit_); | 4246 old_gen_promotion_limit_); |
| 4251 PrintF("old_gen_allocation_limit_ %" V8_PTR_PREFIX "d\n", | 4247 PrintF("old_gen_allocation_limit_ %" V8_PTR_PREFIX "d\n", |
| 4252 old_gen_allocation_limit_); | 4248 old_gen_allocation_limit_); |
| 4249 PrintF("old_gen_limit_factor_ %d\n", old_gen_limit_factor_); | |
| 4253 | 4250 |
| 4254 PrintF("\n"); | 4251 PrintF("\n"); |
| 4255 PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles()); | 4252 PrintF("Number of handles : %d\n", HandleScope::NumberOfHandles()); |
| 4256 isolate_->global_handles()->PrintStats(); | 4253 isolate_->global_handles()->PrintStats(); |
| 4257 PrintF("\n"); | 4254 PrintF("\n"); |
| 4258 | 4255 |
| 4259 PrintF("Heap statistics : "); | 4256 PrintF("Heap statistics : "); |
| 4260 isolate_->memory_allocator()->ReportStatistics(); | 4257 isolate_->memory_allocator()->ReportStatistics(); |
| 4261 PrintF("To space : "); | 4258 PrintF("To space : "); |
| 4262 new_space_.ReportStatistics(); | 4259 new_space_.ReportStatistics(); |
| (...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6029 } | 6026 } |
| 6030 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); | 6027 isolate_->heap()->store_buffer()->Filter(MemoryChunk::ABOUT_TO_BE_FREED); |
| 6031 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { | 6028 for (chunk = chunks_queued_for_free_; chunk != NULL; chunk = next) { |
| 6032 next = chunk->next_chunk(); | 6029 next = chunk->next_chunk(); |
| 6033 isolate_->memory_allocator()->Free(chunk); | 6030 isolate_->memory_allocator()->Free(chunk); |
| 6034 } | 6031 } |
| 6035 chunks_queued_for_free_ = NULL; | 6032 chunks_queued_for_free_ = NULL; |
| 6036 } | 6033 } |
| 6037 | 6034 |
| 6038 } } // namespace v8::internal | 6035 } } // namespace v8::internal |
| OLD | NEW |