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

Side by Side Diff: src/heap.h

Issue 296413004: Remove high promotion mode. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 | « src/execution.cc ('k') | 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_H_ 5 #ifndef V8_HEAP_H_
6 #define V8_HEAP_H_ 6 #define V8_HEAP_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "allocation.h" 10 #include "allocation.h"
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 // Support for the API. 1028 // Support for the API.
1029 // 1029 //
1030 1030
1031 void CreateApiObjects(); 1031 void CreateApiObjects();
1032 1032
1033 // Adjusts the amount of registered external memory. 1033 // Adjusts the amount of registered external memory.
1034 // Returns the adjusted value. 1034 // Returns the adjusted value.
1035 inline int64_t AdjustAmountOfExternalAllocatedMemory( 1035 inline int64_t AdjustAmountOfExternalAllocatedMemory(
1036 int64_t change_in_bytes); 1036 int64_t change_in_bytes);
1037 1037
1038 // This is only needed for testing high promotion mode.
1039 void SetNewSpaceHighPromotionModeActive(bool mode) {
1040 new_space_high_promotion_mode_active_ = mode;
1041 }
1042
1043 // Returns the allocation mode (pre-tenuring) based on observed promotion 1038 // Returns the allocation mode (pre-tenuring) based on observed promotion
1044 // rates of previous collections. 1039 // rates of previous collections.
1045 inline PretenureFlag GetPretenureMode() { 1040 inline PretenureFlag GetPretenureMode() {
1046 return FLAG_pretenuring && new_space_high_promotion_mode_active_ 1041 return FLAG_pretenuring ? TENURED : NOT_TENURED;
1047 ? TENURED : NOT_TENURED;
1048 }
1049
1050 inline Address* NewSpaceHighPromotionModeActiveAddress() {
1051 return reinterpret_cast<Address*>(&new_space_high_promotion_mode_active_);
1052 } 1042 }
1053 1043
1054 inline intptr_t PromotedTotalSize() { 1044 inline intptr_t PromotedTotalSize() {
1055 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); 1045 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize();
1056 if (total > kMaxInt) return static_cast<intptr_t>(kMaxInt); 1046 if (total > kMaxInt) return static_cast<intptr_t>(kMaxInt);
1057 if (total < 0) return 0; 1047 if (total < 0) return 0;
1058 return static_cast<intptr_t>(total); 1048 return static_cast<intptr_t>(total);
1059 } 1049 }
1060 1050
1061 inline intptr_t OldGenerationSpaceAvailable() { 1051 inline intptr_t OldGenerationSpaceAvailable() {
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1575 ROOT_LIST(ROOT_ACCESSOR) 1565 ROOT_LIST(ROOT_ACCESSOR)
1576 #undef ROOT_ACCESSOR 1566 #undef ROOT_ACCESSOR
1577 1567
1578 #ifdef DEBUG 1568 #ifdef DEBUG
1579 // If the --gc-interval flag is set to a positive value, this 1569 // If the --gc-interval flag is set to a positive value, this
1580 // variable holds the value indicating the number of allocations 1570 // variable holds the value indicating the number of allocations
1581 // remain until the next failure and garbage collection. 1571 // remain until the next failure and garbage collection.
1582 int allocation_timeout_; 1572 int allocation_timeout_;
1583 #endif // DEBUG 1573 #endif // DEBUG
1584 1574
1585 // Indicates that the new space should be kept small due to high promotion
1586 // rates caused by the mutator allocating a lot of long-lived objects.
1587 // TODO(hpayer): change to bool if no longer accessed from generated code
1588 intptr_t new_space_high_promotion_mode_active_;
1589
1590 // Limit that triggers a global GC on the next (normally caused) GC. This 1575 // Limit that triggers a global GC on the next (normally caused) GC. This
1591 // is checked when we have already decided to do a GC to help determine 1576 // is checked when we have already decided to do a GC to help determine
1592 // which collector to invoke, before expanding a paged space in the old 1577 // which collector to invoke, before expanding a paged space in the old
1593 // generation and on every allocation in large object space. 1578 // generation and on every allocation in large object space.
1594 intptr_t old_generation_allocation_limit_; 1579 intptr_t old_generation_allocation_limit_;
1595 1580
1596 // Used to adjust the limits that control the timing of the next GC. 1581 // Used to adjust the limits that control the timing of the next GC.
1597 intptr_t size_of_old_gen_at_last_old_space_gc_; 1582 intptr_t size_of_old_gen_at_last_old_space_gc_;
1598 1583
1599 // Limit on the amount of externally allocated memory allowed 1584 // Limit on the amount of externally allocated memory allowed
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 // Sets used allocation sites entries to undefined. 2005 // Sets used allocation sites entries to undefined.
2021 void FlushAllocationSitesScratchpad(); 2006 void FlushAllocationSitesScratchpad();
2022 2007
2023 // Initializes the allocation sites scratchpad with undefined values. 2008 // Initializes the allocation sites scratchpad with undefined values.
2024 void InitializeAllocationSitesScratchpad(); 2009 void InitializeAllocationSitesScratchpad();
2025 2010
2026 // Adds an allocation site to the scratchpad if there is space left. 2011 // Adds an allocation site to the scratchpad if there is space left.
2027 void AddAllocationSiteToScratchpad(AllocationSite* site, 2012 void AddAllocationSiteToScratchpad(AllocationSite* site,
2028 ScratchpadSlotMode mode); 2013 ScratchpadSlotMode mode);
2029 2014
2030 void UpdateSurvivalRateTrend(int start_new_space_size); 2015 void UpdateSurvivalStatistics(int start_new_space_size);
2031
2032 enum SurvivalRateTrend { INCREASING, STABLE, DECREASING, FLUCTUATING };
2033 2016
2034 static const int kYoungSurvivalRateHighThreshold = 90; 2017 static const int kYoungSurvivalRateHighThreshold = 90;
2035 static const int kYoungSurvivalRateLowThreshold = 10;
2036 static const int kYoungSurvivalRateAllowedDeviation = 15; 2018 static const int kYoungSurvivalRateAllowedDeviation = 15;
2037 2019
2038 static const int kOldSurvivalRateLowThreshold = 10; 2020 static const int kOldSurvivalRateLowThreshold = 10;
2039 2021
2040 int high_survival_rate_period_length_; 2022 int high_survival_rate_period_length_;
2041 int low_survival_rate_period_length_;
2042 double survival_rate_;
2043 intptr_t promoted_objects_size_; 2023 intptr_t promoted_objects_size_;
2044 double promotion_rate_; 2024 double promotion_rate_;
2045 intptr_t semi_space_copied_object_size_; 2025 intptr_t semi_space_copied_object_size_;
2046 double semi_space_copied_rate_; 2026 double semi_space_copied_rate_;
2047 SurvivalRateTrend previous_survival_rate_trend_;
2048 SurvivalRateTrend survival_rate_trend_;
2049 2027
2050 void set_survival_rate_trend(SurvivalRateTrend survival_rate_trend) { 2028 // TODO(hpayer): Allocation site pretenuring may make this method obsolete.
2051 ASSERT(survival_rate_trend != FLUCTUATING); 2029 // Re-visit incremental marking heuristics.
2052 previous_survival_rate_trend_ = survival_rate_trend_;
2053 survival_rate_trend_ = survival_rate_trend;
2054 }
2055
2056 SurvivalRateTrend survival_rate_trend() {
2057 if (survival_rate_trend_ == STABLE) {
2058 return STABLE;
2059 } else if (previous_survival_rate_trend_ == STABLE) {
2060 return survival_rate_trend_;
2061 } else if (survival_rate_trend_ != previous_survival_rate_trend_) {
2062 return FLUCTUATING;
2063 } else {
2064 return survival_rate_trend_;
2065 }
2066 }
2067
2068 bool IsStableOrIncreasingSurvivalTrend() {
2069 switch (survival_rate_trend()) {
2070 case STABLE:
2071 case INCREASING:
2072 return true;
2073 default:
2074 return false;
2075 }
2076 }
2077
2078 bool IsStableOrDecreasingSurvivalTrend() {
2079 switch (survival_rate_trend()) {
2080 case STABLE:
2081 case DECREASING:
2082 return true;
2083 default:
2084 return false;
2085 }
2086 }
2087
2088 bool IsIncreasingSurvivalTrend() {
2089 return survival_rate_trend() == INCREASING;
2090 }
2091
2092 bool IsHighSurvivalRate() { 2030 bool IsHighSurvivalRate() {
2093 return high_survival_rate_period_length_ > 0; 2031 return high_survival_rate_period_length_ > 0;
2094 } 2032 }
2095 2033
2096 bool IsLowSurvivalRate() {
2097 return low_survival_rate_period_length_ > 0;
2098 }
2099
2100 void SelectScavengingVisitorsTable(); 2034 void SelectScavengingVisitorsTable();
2101 2035
2102 void StartIdleRound() { 2036 void StartIdleRound() {
2103 mark_sweeps_since_idle_round_started_ = 0; 2037 mark_sweeps_since_idle_round_started_ = 0;
2104 } 2038 }
2105 2039
2106 void FinishIdleRound() { 2040 void FinishIdleRound() {
2107 mark_sweeps_since_idle_round_started_ = kMaxMarkSweepsInIdleRound; 2041 mark_sweeps_since_idle_round_started_ = kMaxMarkSweepsInIdleRound;
2108 scavenges_since_last_idle_round_ = 0; 2042 scavenges_since_last_idle_round_ = 0;
2109 } 2043 }
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2767 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2834 2768
2835 private: 2769 private:
2836 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2770 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2837 }; 2771 };
2838 #endif // DEBUG 2772 #endif // DEBUG
2839 2773
2840 } } // namespace v8::internal 2774 } } // namespace v8::internal
2841 2775
2842 #endif // V8_HEAP_H_ 2776 #endif // V8_HEAP_H_
OLDNEW
« no previous file with comments | « src/execution.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698