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

Side by Side Diff: src/heap/heap.cc

Issue 1141693003: Fixing Heap::Available() to return total of all spaces. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | 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 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 intptr_t current_committed_memory = CommittedMemory(); 220 intptr_t current_committed_memory = CommittedMemory();
221 if (current_committed_memory > maximum_committed_) { 221 if (current_committed_memory > maximum_committed_) {
222 maximum_committed_ = current_committed_memory; 222 maximum_committed_ = current_committed_memory;
223 } 223 }
224 } 224 }
225 225
226 226
227 intptr_t Heap::Available() { 227 intptr_t Heap::Available() {
228 if (!HasBeenSetUp()) return 0; 228 if (!HasBeenSetUp()) return 0;
229 229
230 return new_space_.Available() + old_space_->Available() + 230 intptr_t total = 0;
231 code_space_->Available() + map_space_->Available(); 231 AllSpaces spaces(this);
232 for (Space* space = spaces.next(); space != NULL; space = spaces.next()) {
233 total += space->Available();
234 }
235 return total;
232 } 236 }
233 237
234 238
235 bool Heap::HasBeenSetUp() { 239 bool Heap::HasBeenSetUp() {
236 return old_space_ != NULL && code_space_ != NULL && map_space_ != NULL && 240 return old_space_ != NULL && code_space_ != NULL && map_space_ != NULL &&
237 lo_space_ != NULL; 241 lo_space_ != NULL;
238 } 242 }
239 243
240 244
241 int Heap::GcSafeSizeOfOldObject(HeapObject* object) { 245 int Heap::GcSafeSizeOfOldObject(HeapObject* object) {
(...skipping 6261 matching lines...) Expand 10 before | Expand all | Expand 10 after
6503 } 6507 }
6504 delete list; 6508 delete list;
6505 } else { 6509 } else {
6506 prev = list; 6510 prev = list;
6507 } 6511 }
6508 list = next; 6512 list = next;
6509 } 6513 }
6510 } 6514 }
6511 } 6515 }
6512 } // namespace v8::internal 6516 } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698