OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |