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

Side by Side Diff: src/compiler/zone-pool.cc

Issue 1738973002: [turbofan] More "auto" keyword cleanup (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « src/compiler/verifier.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/compiler/zone-pool.h" 5 #include "src/compiler/zone-pool.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace compiler { 9 namespace compiler {
10 10
11 ZonePool::StatsScope::StatsScope(ZonePool* zone_pool) 11 ZonePool::StatsScope::StatsScope(ZonePool* zone_pool)
12 : zone_pool_(zone_pool), 12 : zone_pool_(zone_pool),
13 total_allocated_bytes_at_start_(zone_pool->GetTotalAllocatedBytes()), 13 total_allocated_bytes_at_start_(zone_pool->GetTotalAllocatedBytes()),
14 max_allocated_bytes_(0) { 14 max_allocated_bytes_(0) {
15 zone_pool_->stats_.push_back(this); 15 zone_pool_->stats_.push_back(this);
16 for (auto zone : zone_pool_->used_) { 16 for (Zone* zone : zone_pool_->used_) {
17 size_t size = static_cast<size_t>(zone->allocation_size()); 17 size_t size = static_cast<size_t>(zone->allocation_size());
18 std::pair<InitialValues::iterator, bool> res = 18 std::pair<InitialValues::iterator, bool> res =
19 initial_values_.insert(std::make_pair(zone, size)); 19 initial_values_.insert(std::make_pair(zone, size));
20 USE(res); 20 USE(res);
21 DCHECK(res.second); 21 DCHECK(res.second);
22 } 22 }
23 } 23 }
24 24
25 25
26 ZonePool::StatsScope::~StatsScope() { 26 ZonePool::StatsScope::~StatsScope() {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 DCHECK_EQ(0u, zone->allocation_size()); 109 DCHECK_EQ(0u, zone->allocation_size());
110 return zone; 110 return zone;
111 } 111 }
112 112
113 113
114 void ZonePool::ReturnZone(Zone* zone) { 114 void ZonePool::ReturnZone(Zone* zone) {
115 size_t current_total = GetCurrentAllocatedBytes(); 115 size_t current_total = GetCurrentAllocatedBytes();
116 // Update max. 116 // Update max.
117 max_allocated_bytes_ = std::max(max_allocated_bytes_, current_total); 117 max_allocated_bytes_ = std::max(max_allocated_bytes_, current_total);
118 // Update stats. 118 // Update stats.
119 for (auto stat_scope : stats_) { 119 for (StatsScope* stat_scope : stats_) {
120 stat_scope->ZoneReturned(zone); 120 stat_scope->ZoneReturned(zone);
121 } 121 }
122 // Remove from used. 122 // Remove from used.
123 Used::iterator it = std::find(used_.begin(), used_.end(), zone); 123 Used::iterator it = std::find(used_.begin(), used_.end(), zone);
124 DCHECK(it != used_.end()); 124 DCHECK(it != used_.end());
125 used_.erase(it); 125 used_.erase(it);
126 total_deleted_bytes_ += static_cast<size_t>(zone->allocation_size()); 126 total_deleted_bytes_ += static_cast<size_t>(zone->allocation_size());
127 // Delete zone or clear and stash on unused_. 127 // Delete zone or clear and stash on unused_.
128 if (unused_.size() >= kMaxUnusedSize) { 128 if (unused_.size() >= kMaxUnusedSize) {
129 delete zone; 129 delete zone;
130 } else { 130 } else {
131 zone->DeleteAll(); 131 zone->DeleteAll();
132 DCHECK_EQ(0u, zone->allocation_size()); 132 DCHECK_EQ(0u, zone->allocation_size());
133 unused_.push_back(zone); 133 unused_.push_back(zone);
134 } 134 }
135 } 135 }
136 136
137 } // namespace compiler 137 } // namespace compiler
138 } // namespace internal 138 } // namespace internal
139 } // namespace v8 139 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/verifier.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698