Fixing Heap::Available() to return total of all spaces.

The Heap::Available method adds up the available size from only 4 of
the spaces. This CL fixes the method to return total of all spaces.

BUG=481504
LOG=N

Review URL: https://codereview.chromium.org/1141693003

Cr-Commit-Position: refs/heads/master@{#28566}
This commit is contained in:
ssid 2015-05-21 11:14:50 -07:00 committed by Commit bot
parent 7ffdb5194d
commit 3f162d416e

View File

@ -229,8 +229,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;
}