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

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

Issue 868883002: Remove the dependency of Zone on Isolate (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix compilation issues Created 5 years, 11 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/zone-pool.h ('k') | src/deoptimizer.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 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Update max. 58 // Update max.
59 max_allocated_bytes_ = std::max(max_allocated_bytes_, current_total); 59 max_allocated_bytes_ = std::max(max_allocated_bytes_, current_total);
60 // Drop zone from initial value map. 60 // Drop zone from initial value map.
61 InitialValues::iterator it = initial_values_.find(zone); 61 InitialValues::iterator it = initial_values_.find(zone);
62 if (it != initial_values_.end()) { 62 if (it != initial_values_.end()) {
63 initial_values_.erase(it); 63 initial_values_.erase(it);
64 } 64 }
65 } 65 }
66 66
67 67
68 ZonePool::ZonePool(Isolate* isolate) 68 ZonePool::ZonePool() : max_allocated_bytes_(0), total_deleted_bytes_(0) {}
69 : isolate_(isolate), max_allocated_bytes_(0), total_deleted_bytes_(0) {}
70 69
71 70
72 ZonePool::~ZonePool() { 71 ZonePool::~ZonePool() {
73 DCHECK(used_.empty()); 72 DCHECK(used_.empty());
74 DCHECK(stats_.empty()); 73 DCHECK(stats_.empty());
75 for (Zone* zone : unused_) { 74 for (Zone* zone : unused_) {
76 delete zone; 75 delete zone;
77 } 76 }
78 } 77 }
79 78
(...skipping 17 matching lines...) Expand all
97 } 96 }
98 97
99 98
100 Zone* ZonePool::NewEmptyZone() { 99 Zone* ZonePool::NewEmptyZone() {
101 Zone* zone; 100 Zone* zone;
102 // Grab a zone from pool if possible. 101 // Grab a zone from pool if possible.
103 if (!unused_.empty()) { 102 if (!unused_.empty()) {
104 zone = unused_.back(); 103 zone = unused_.back();
105 unused_.pop_back(); 104 unused_.pop_back();
106 } else { 105 } else {
107 zone = new Zone(isolate_); 106 zone = new Zone();
108 } 107 }
109 used_.push_back(zone); 108 used_.push_back(zone);
110 DCHECK_EQ(0, zone->allocation_size()); 109 DCHECK_EQ(0, zone->allocation_size());
111 return zone; 110 return zone;
112 } 111 }
113 112
114 113
115 void ZonePool::ReturnZone(Zone* zone) { 114 void ZonePool::ReturnZone(Zone* zone) {
116 size_t current_total = GetCurrentAllocatedBytes(); 115 size_t current_total = GetCurrentAllocatedBytes();
117 // Update max. 116 // Update max.
(...skipping 13 matching lines...) Expand all
131 } else { 130 } else {
132 zone->DeleteAll(); 131 zone->DeleteAll();
133 DCHECK_EQ(0, zone->allocation_size()); 132 DCHECK_EQ(0, zone->allocation_size());
134 unused_.push_back(zone); 133 unused_.push_back(zone);
135 } 134 }
136 } 135 }
137 136
138 } // namespace compiler 137 } // namespace compiler
139 } // namespace internal 138 } // namespace internal
140 } // namespace v8 139 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/zone-pool.h ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698