Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 99f2e93f505f78a4d3894f828083d41b42d3decd..50b26820dfeccc7a4db37027e6bd9ec52f022857 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -227,8 +227,12 @@ void Heap::UpdateMaximumCommitted() { |
intptr_t Heap::Available() { |
if (!HasBeenSetUp()) return 0; |
- return new_space_.Available() + old_space_->Available() + |
- code_space_->Available() + map_space_->Available(); |
+ intptr_t total = 0; |
+ AllSpaces spaces(this); |
+ for (Space* space = spaces.next(); space != NULL; space = spaces.next()) { |
+ total += space->Available(); |
+ } |
+ return total; |
} |