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

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

Issue 893533003: Revert "Make GCC happy again." and "Initial switch to Chromium-style CHECK_* and DCHECK_* macros.". (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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') | src/deoptimizer.h » ('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 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
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 Zone* ZonePool::NewEmptyZone() { 99 Zone* ZonePool::NewEmptyZone() {
100 Zone* zone; 100 Zone* zone;
101 // Grab a zone from pool if possible. 101 // Grab a zone from pool if possible.
102 if (!unused_.empty()) { 102 if (!unused_.empty()) {
103 zone = unused_.back(); 103 zone = unused_.back();
104 unused_.pop_back(); 104 unused_.pop_back();
105 } else { 105 } else {
106 zone = new Zone(); 106 zone = new Zone();
107 } 107 }
108 used_.push_back(zone); 108 used_.push_back(zone);
109 DCHECK_EQ(0u, zone->allocation_size()); 109 DCHECK_EQ(0, 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 (auto 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(0, 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') | src/deoptimizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698