OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/base/adapters.h" | 5 #include "src/base/adapters.h" |
6 #include "src/compiler/linkage.h" | 6 #include "src/compiler/linkage.h" |
7 #include "src/compiler/register-allocator.h" | 7 #include "src/compiler/register-allocator.h" |
8 #include "src/string-stream.h" | 8 #include "src/string-stream.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2211 | 2211 |
2212 unsigned use_count = 0; | 2212 unsigned use_count = 0; |
2213 auto* pos = range->first_pos(); | 2213 auto* pos = range->first_pos(); |
2214 while (pos != nullptr) { | 2214 while (pos != nullptr) { |
2215 use_count++; | 2215 use_count++; |
2216 pos = pos->next(); | 2216 pos = pos->next(); |
2217 } | 2217 } |
2218 | 2218 |
2219 // GetLiveRangeSize is DCHECK-ed to not be 0 | 2219 // GetLiveRangeSize is DCHECK-ed to not be 0 |
2220 unsigned range_size = GetLiveRangeSize(range); | 2220 unsigned range_size = GetLiveRangeSize(range); |
2221 DCHECK_NE(0, range_size); | 2221 DCHECK_NE(0U, range_size); |
2222 | 2222 |
2223 return static_cast<float>(use_count) / static_cast<float>(range_size); | 2223 return static_cast<float>(use_count) / static_cast<float>(range_size); |
2224 } | 2224 } |
2225 | 2225 |
2226 | 2226 |
2227 float GreedyAllocator::CalculateMaxSpillWeight( | 2227 float GreedyAllocator::CalculateMaxSpillWeight( |
2228 const ZoneSet<LiveRange*>& ranges) { | 2228 const ZoneSet<LiveRange*>& ranges) { |
2229 float max = 0.0; | 2229 float max = 0.0; |
2230 for (auto* r : ranges) { | 2230 for (auto* r : ranges) { |
2231 max = std::max(max, CalculateSpillWeight(r)); | 2231 max = std::max(max, CalculateSpillWeight(r)); |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2841 auto eliminate = moves->PrepareInsertAfter(move); | 2841 auto eliminate = moves->PrepareInsertAfter(move); |
2842 to_insert.push_back(move); | 2842 to_insert.push_back(move); |
2843 if (eliminate != nullptr) to_eliminate.push_back(eliminate); | 2843 if (eliminate != nullptr) to_eliminate.push_back(eliminate); |
2844 } | 2844 } |
2845 } | 2845 } |
2846 | 2846 |
2847 | 2847 |
2848 } // namespace compiler | 2848 } // namespace compiler |
2849 } // namespace internal | 2849 } // namespace internal |
2850 } // namespace v8 | 2850 } // namespace v8 |
OLD | NEW |